From ce17b38e469120843ae9859a62855b7e460cb3dc Mon Sep 17 00:00:00 2001 From: Jay Klehr Date: Fri, 10 Jan 2025 12:50:55 -0700 Subject: [PATCH] Php84 (#286) * PHP 8.4 * removing dev package versions --------- Co-authored-by: Dorian Villet --- .github/workflows/build.yml | 6 +++--- composer.json | 6 +++--- grumphp.yml.dist | 3 +++ phpstan.neon | 11 +++++++---- src/Zend/Validate/EmailAddress.php | 5 ++--- src/Zend/Validate/Hostname.php | 3 +-- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3bb173d..7318ce0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,14 +13,14 @@ jobs: fail-fast: false matrix: operating-system: [ubuntu-latest] - php-versions: ["8.0", "8.1", "8.2", "8.3"] + php-versions: ["8.0", "8.1", "8.2", "8.3", "8.4"] composer-args: ["", "--prefer-lowest"] runs-on: ${{ matrix.operating-system }} steps: - name: Checkout uses: actions/checkout@v4 - name: Setup PHP - uses: shivammathur/setup-php@2.30.2 + uses: shivammathur/setup-php@2.32.0 with: php-version: ${{ matrix.php-versions }} extensions: mbstring @@ -49,7 +49,7 @@ jobs: - name: Test run: composer test-with-coverage - name: Upload Coverage - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v5 with: files: ./clover.xml verbose: true diff --git a/composer.json b/composer.json index 449a3fa..a5dc50b 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "license": "BSD-3-Clause", "prefer-stable": true, "require": { - "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0", + "php": "~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0", "diablomedia/zendframework1-exception": "^1.1.1", "diablomedia/zendframework1-config": "^2.0.5", "diablomedia/zendframework1-loader": "^1.0.5", @@ -35,8 +35,8 @@ }, "require-dev": { "phpunit/phpunit": "^9.6.19 || ^10.5.18", - "phpstan/phpstan": "1.10.67", - "friendsofphp/php-cs-fixer": "3.54.0", + "phpstan/phpstan": "2.1.1", + "friendsofphp/php-cs-fixer": "3.67.0", "maglnet/composer-require-checker": "^3.0.0", "phpro/grumphp-shim": "^2.0.0" }, diff --git a/grumphp.yml.dist b/grumphp.yml.dist index 0ddc213..29f09c1 100644 --- a/grumphp.yml.dist +++ b/grumphp.yml.dist @@ -1,5 +1,8 @@ # grumphp.yml grumphp: + environment: + variables: + PHP_CS_FIXER_IGNORE_ENV: "true" tasks: composer: strict: true diff --git a/phpstan.neon b/phpstan.neon index 735104a..50625d9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -10,20 +10,23 @@ parameters: - ./src/Zend/Validate/Hostname/* ignoreErrors: - '#Variable \$context in isset\(\) always exists and is not nullable\.#' - - '#Binary operation "\*" between string and .+ results in an error\.#' - - '#Binary operation "\*" between 3 and string results in an error\.#' + - '#Binary operation "\*" between non-empty-string and .+ results in an error\.#' + - '#Binary operation "\*" between 3 and non-empty-string results in an error\.#' # This is intentional for short circuiting/execution flow management - message: '#Do-while loop condition is always false\.#' path: ./src/Zend/Validate/Hostname.php - - message: '#Binary operation "\*" between int<1, max> and string results in an error\.#' + message: '#Binary operation "\*" between int<1, max> and non-empty-string results in an error\.#' path: ./src/Zend/Validate/Ccnum.php count: 1 - - message: '#Binary operation "\*" between int<1, max> and string results in an error\.#' + message: '#Binary operation "\*" between int<1, max> and non-empty-string results in an error\.#' path: ./src/Zend/Validate/CreditCard.php count: 1 + - + message: '#Call to function method_exists\(\) with object and ''__toString'' will always evaluate to true\.#' + path: ./src/Zend/Validate/NotEmpty.php # This does seem like a bug in ZF1, as the loop with $j will never run - message: '#Comparison operation "<" between int<4, max> and 4 is always false\.#' diff --git a/src/Zend/Validate/EmailAddress.php b/src/Zend/Validate/EmailAddress.php index 2dc69c7..bcad514 100644 --- a/src/Zend/Validate/EmailAddress.php +++ b/src/Zend/Validate/EmailAddress.php @@ -229,11 +229,10 @@ public function getHostnameValidator() } /** - * @param Zend_Validate_Hostname $hostnameValidator OPTIONAL - * @param int $allow OPTIONAL + * @param int $allow OPTIONAL * @return $this */ - public function setHostnameValidator(Zend_Validate_Hostname $hostnameValidator = null, $allow = Zend_Validate_Hostname::ALLOW_DNS) + public function setHostnameValidator(Zend_Validate_Hostname|null $hostnameValidator = null, $allow = Zend_Validate_Hostname::ALLOW_DNS) { if (!$hostnameValidator) { $hostnameValidator = new Zend_Validate_Hostname($allow); diff --git a/src/Zend/Validate/Hostname.php b/src/Zend/Validate/Hostname.php index 8531c34..3d41c9f 100644 --- a/src/Zend/Validate/Hostname.php +++ b/src/Zend/Validate/Hostname.php @@ -1581,10 +1581,9 @@ public function getIpValidator() } /** - * @param Zend_Validate_Ip $ipValidator OPTIONAL * @return Zend_Validate_Hostname */ - public function setIpValidator(Zend_Validate_Ip $ipValidator = null) + public function setIpValidator(Zend_Validate_Ip|null $ipValidator = null) { if ($ipValidator === null) { $ipValidator = new Zend_Validate_Ip();