Skip to content

Commit

Permalink
Merge pull request #6 from macocci7/support_php_8.4
Browse files Browse the repository at this point in the history
Support PHP 8.4
  • Loading branch information
macocci7 authored Jan 5, 2025
2 parents c4257d0 + 2016413 commit ea4afe0
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tag_meged_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
coverage: xdebug
tools: composer:v2

Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/test_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
php-version: 8.3
tools: composer:v2

- name: Checkout code
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.2', '8.3']
php: ['8.2', '8.3', '8.4']

steps:
- name: Set up PHP
Expand All @@ -65,7 +65,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '14.x'
node-version: '20.x'

- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -85,13 +85,13 @@ jobs:
- name: PHP Lint
run: ./vendor/bin/parallel-lint src tests examples

# - name: Neon Lint
# run: ./vendor/nette/neon/bin/neon-lint conf
#- name: Neon Lint
# run: ./vendor/nette/neon/bin/neon-lint conf

- name: PHP MD
run: |
./vendor/bin/phpmd --version
./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml
#- name: PHP MD
# run: |
# ./vendor/bin/phpmd --version
# ./vendor/bin/phpmd ./src/ ./examples/ ./tests/ text phpmd.xml

- name: PHP Code Sniffer
run: |
Expand All @@ -115,7 +115,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.2']
php: ['8.3']

steps:
- name: Set up PHP
Expand All @@ -128,7 +128,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: '14.x'
node-version: '20.x'

- name: Checkout code
uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
vendor/
composer.lock
.php-version
.tool-versions
build/
node_modules/
storage/
1 change: 1 addition & 0 deletions PHP_VERSIONS
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
8.4
8.3
8.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,4 +259,4 @@ Here's an example code for using `Instance` rule object: [ValidateInstance.php](

***

*Copyright 2024 macocci7*
Copyright 2024 - 2025 macocci7.
48 changes: 7 additions & 41 deletions bin/TestAndLint.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/bash

# Script to Test and Lint
# - for the repository: macocci7/purephp-validation
# requirement:
# - phpenv/phpenv
# - https://github.com/jdx/mise installed
# - PHP versions defined in ../PHP_VERSIONS installed

CMD=phpenv
CMD=mise
$CMD -v &> /dev/null
if [ $? -ne 0 ]; then
echo "command [${CMD}] not found!"
Expand All @@ -20,46 +19,13 @@ if [ $? -ne 0 ]; then
exit 1
fi

test_and_lint() {
switch_version() {
echo "==========================================================="
echo "[PHP $1][phpenv local $1]"
phpenv local $1
if [ $? -ne 0 ]; then
echo "Failed to switch version to $i. skipped."
return 1
fi
echo "-----------------------------------------------------------"
echo "[PHP $1][php -v]"
php -v
echo "-----------------------------------------------------------"
echo "[PHP $1][parallel-lint]"
./vendor/bin/parallel-lint src tests examples
echo "-----------------------------------------------------------"
#echo "[PHP $1][neon-lint]"
#./vendor/nette/neon/bin/neon-lint conf
#echo "-----------------------------------------------------------"
echo "[PHP $1][phpcs]"
./vendor/bin/phpcs --ignore=vendor \
--standard=phpcs.xml \
-p \
-s \
.
echo "-----------------------------------------------------------"
echo "[PHP $1][phpmd]"
./vendor/bin/phpmd \
./src/ ./examples/ ./tests/ text \
phpmd.xml
echo "-----------------------------------------------------------"
echo "[PHP $1][phpstan]"
./vendor/bin/phpstan analyze -c phpstan.neon
echo "-----------------------------------------------------------"
echo "[PHP $1][phpunit]"
./vendor/bin/phpunit ./tests/ \
--color=auto
echo "-----------------------------------------------------------"
echo "[PHP $1][Switching PHP version to $1]"
mise x php@$1 -- bash bin/TestAndLintSub.sh $1;
}

echo "[[TesAndLint.sh]]"
echo "[[TestAndLint.sh]]"

SUPPORTED_PHP_VERSIONS=PHP_VERSIONS
if [ ! -f $SUPPORTED_PHP_VERSIONS ]; then
Expand All @@ -74,6 +40,6 @@ if [ ! -r $SUPPORTED_PHP_VERSIONS ]; then
fi
STR_CMD=''
while read version ; do
STR_CMD="$STR_CMD test_and_lint $version;"
STR_CMD="$STR_CMD switch_version $version;"
done < $SUPPORTED_PHP_VERSIONS
eval $STR_CMD
34 changes: 34 additions & 0 deletions bin/TestAndLintSub.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/bash

# Script to Test and Lint
# requirement:
# - PHP versions defined in ../PHP_VERSIONS installed

echo "-----------------------------------------------------------"
echo "[PHP $1][php -v]"
php -v
echo "-----------------------------------------------------------"
echo "[PHP $1][parallel-lint]"
./vendor/bin/parallel-lint src tests examples
#echo "-----------------------------------------------------------"
#echo "[PHP $1][neon-lint]"
#./vendor/nette/neon/bin/neon-lint conf
echo "-----------------------------------------------------------"
echo "[PHP $1][phpcs]"
./vendor/bin/phpcs --ignore=vendor \
--standard=phpcs.xml \
-p \
-s \
.
#echo "-----------------------------------------------------------"
#echo "[PHP $1][phpmd]"
#./vendor/bin/phpmd \
# ./src/ ./examples/ ./tests/ text \
# phpmd.xml
echo "-----------------------------------------------------------"
echo "[PHP $1][phpstan]"
./vendor/bin/phpstan analyze -c phpstan.neon
echo "-----------------------------------------------------------"
echo "[PHP $1][phpunit]"
./vendor/bin/phpunit ./tests/
echo "-----------------------------------------------------------"
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "macocci7/purephp-validation",
"description": "illuminate/validation wrapper for pure php.",
"version": "0.0.4",
"version": "0.0.5",
"type": "library",
"license": "MIT",
"autoload": {
Expand All @@ -18,14 +18,14 @@
"minimum-stability": "stable",
"require": {
"php": ">=8.2",
"illuminate/validation": "^11.5"
"illuminate/validation": "^11.37"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.9",
"phpunit/phpunit": "^11.1",
"squizlabs/php_codesniffer": "^3.11",
"phpunit/phpunit": "^11.5",
"phpmd/phpmd": "^2.15",
"php-parallel-lint/php-parallel-lint": "^1.4",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan": "^2.1",
"askdkc/breezejp": "^1.8"
}
}

0 comments on commit ea4afe0

Please sign in to comment.