diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index 586ec0a..2076414 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -66,10 +66,18 @@ jobs:
if: ${{ matrix.php < 7.0 }}
run: composer lint-lt70 -- --checkstyle | cs2pr
- - name: "Lint PHP files against parse errors - PHP 7.x"
- if: ${{ startsWith( matrix.php, '7' ) }}
+ - name: "Lint PHP files against parse errors - PHP 7.0"
+ if: ${{ matrix.php == '7.0' }}
+ run: composer lint70
+
+ - name: "Lint PHP files against parse errors - PHP 7.1 - 7.4"
+ if: ${{ startsWith( matrix.php, '7' ) && matrix.php != '7.0' }}
run: composer lint7
- - name: "Lint PHP files against parse errors - PHP >= 8.0"
- if: ${{ matrix.php >= 8.0 }}
+ - name: "Lint PHP files against parse errors - PHP 8.0 - 8.3"
+ if: ${{ matrix.php >= 8.0 && matrix.php < 8.4 }}
run: composer lint-gte80 -- --checkstyle | cs2pr
+
+ - name: "Lint PHP files against parse errors - PHP >= 8.4"
+ if: ${{ matrix.php >= 8.4 }}
+ run: composer lint-gte84
diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist
index 1fd0c6b..f1da52c 100644
--- a/.phpcs.xml.dist
+++ b/.phpcs.xml.dist
@@ -189,6 +189,9 @@
/tests/Polyfills/Fixtures/ValueObjectUnion\.php$
/tests/Polyfills/Fixtures/ValueObjectUnionNoReturnType\.php$
+
+ /tests/Polyfills/Fixtures/ValueObject\.php$
+
/tests/Polyfills/Fixtures/ValueObject\.php$
diff --git a/composer.json b/composer.json
index 9b7bf70..ad1e5cf 100644
--- a/composer.json
+++ b/composer.json
@@ -60,12 +60,18 @@
"lint7": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude src/Exceptions/Error.php --exclude src/Exceptions/TypeError.php --exclude tests/Polyfills/Fixtures/ValueObjectUnion.php --exclude tests/Polyfills/Fixtures/ValueObjectUnionNoReturnType.php"
],
+ "lint70": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude src/Exceptions/Error.php --exclude src/Exceptions/TypeError.php --exclude tests/Polyfills/Fixtures/ValueObject.php --exclude tests/Polyfills/Fixtures/ValueObjectUnion.php --exclude tests/Polyfills/Fixtures/ValueObjectUnionNoReturnType.php"
+ ],
"lint-lt70": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude src/TestCases/TestCasePHPUnitGte8.php --exclude src/TestListeners/TestListenerDefaultImplementationPHPUnitGte7.php --exclude tests/Polyfills/Fixtures/ChildValueObject.php --exclude tests/Polyfills/Fixtures/ValueObject.php --exclude tests/Polyfills/Fixtures/ValueObjectUnion.php --exclude tests/Polyfills/Fixtures/ValueObjectUnionNoReturnType.php"
],
"lint-gte80": [
"@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git"
],
+ "lint-gte84": [
+ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --show-deprecated --exclude vendor --exclude .git --exclude tests/Polyfills/Fixtures/ValueObjectNoReturnType.php"
+ ],
"check-cs": [
"@php ./vendor/squizlabs/php_codesniffer/bin/phpcs --runtime-set testVersion 5.6-"
],
@@ -86,9 +92,11 @@
]
},
"scripts-descriptions": {
- "lint7": "Check the PHP files for parse errors. (PHP 7.x)",
+ "lint7": "Check the PHP files for parse errors. (PHP 7.1 - 7.4)",
+ "lint70": "Check the PHP files for parse errors. (PHP 7.0)",
"lint-lt70": "Check the PHP files for parse errors. (PHP < 7.0)",
- "lint-gte80": "Check the PHP files for parse errors. (PHP 8.0+)",
+ "lint-gte80": "Check the PHP files for parse errors. (PHP 8.0 - 8.3)",
+ "lint-gte84": "Check the PHP files for parse errors. (PHP 8.4+)",
"check-cs": "Check the PHP files for code style violations and best practices.",
"fix-cs": "Auto-fix code style violations in the PHP files.",
"test": "Run the unit tests without code coverage (PHPUnit < 10).",
diff --git a/tests/Polyfills/AssertObjectEqualsPHPUnitLt940Test.php b/tests/Polyfills/AssertObjectEqualsPHPUnitLt940Test.php
index f248324..055dbdf 100644
--- a/tests/Polyfills/AssertObjectEqualsPHPUnitLt940Test.php
+++ b/tests/Polyfills/AssertObjectEqualsPHPUnitLt940Test.php
@@ -26,6 +26,8 @@
* would make a test incompatible with the PHPUnit 9.4.0+ native implementation
* of the assertion.
*
+ * These tests are not run on PHP 8.4+ as only PHPUnit 9.5+ is compatible with PHP 8.4.
+ *
* @covers \Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals
*/
final class AssertObjectEqualsPHPUnitLt940Test extends TestCase {
@@ -56,6 +58,10 @@ public function maybeSkipTest() {
if ( \version_compare( PHPUnit_Version::id(), '9.4.0', '>=' ) ) {
$this->markTestSkipped( 'This test can not be run with the PHPUnit native implementation of assertObjectEquals()' );
}
+
+ if ( \version_compare( \PHP_VERSION_ID, '8.3.99', '>' ) ) {
+ $this->markTestSkipped( 'This test can not be run on PHP 8.4 or higher as PHPUnit < 9.4.0 is not compatible with PHP 8.4' );
+ }
}
/**
diff --git a/tests/Polyfills/AssertObjectEqualsTest.php b/tests/Polyfills/AssertObjectEqualsTest.php
index 71d114a..771cddd 100644
--- a/tests/Polyfills/AssertObjectEqualsTest.php
+++ b/tests/Polyfills/AssertObjectEqualsTest.php
@@ -26,12 +26,16 @@
* Due to the use of return types in the classes under test (fixtures), these
* tests can only run on PHP 7.0 and higher.
*
+ * And due to the implicitly nullable parameter deprecation in PHP 8.4 requiring a
+ * nullable type for one of the tests, the minimum PHP version for running this
+ * version of the tests has been set to PHP 7.1.
+ *
* The `AssertObjectEqualsPHPUnitLt940Test` class mirrors this test class
- * and tests the polyfill method for PHP < 7.0.
+ * and tests the polyfill method for PHP < 7.1.
*
* @covers \Yoast\PHPUnitPolyfills\Polyfills\AssertObjectEquals
*
- * @requires PHP 7.0
+ * @requires PHP 7.1
*/
final class AssertObjectEqualsTest extends TestCase {
diff --git a/tests/Polyfills/Fixtures/ValueObject.php b/tests/Polyfills/Fixtures/ValueObject.php
index 323b27f..28d6cfd 100644
--- a/tests/Polyfills/Fixtures/ValueObject.php
+++ b/tests/Polyfills/Fixtures/ValueObject.php
@@ -66,7 +66,7 @@ public function equalsTwoParams( $other, $param ): bool {
*
* @return bool
*/
- public function equalsParamNotRequired( self $other = null ): bool {
+ public function equalsParamNotRequired( ?self $other = null ): bool {
return ( $this->value === $other->value );
}
diff --git a/tests/TestCases/TestCaseTestTrait.php b/tests/TestCases/TestCaseTestTrait.php
index 6034975..2e6efbb 100644
--- a/tests/TestCases/TestCaseTestTrait.php
+++ b/tests/TestCases/TestCaseTestTrait.php
@@ -125,7 +125,7 @@ final public function testAvailabilityEqualToSpecializations() {
/**
* Verify availability of trait polyfilled PHPUnit methods [14].
*
- * @requires PHP 7.0
+ * @requires PHP 7.1
*
* @return void
*/