-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: improve PHP 8.4 deprecation work-around
Follow-up on PR 159. This commit builds on the earlier change, but instead of making the whole `AssertObjectEqualsTest` class have a PHP 7.1 minimum requirement, it now limits that requirement to just the one affected test. The affected test now uses a separate test fixture to allow the bulk of the tests to run on PHP 7.0 (which was the previous minimum requirement for these tests).
- Loading branch information
Showing
6 changed files
with
53 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Yoast\PHPUnitPolyfills\Tests\Polyfills\Fixtures; | ||
|
||
/** | ||
* Fixture to test the AssertObjectEquals trait. | ||
* | ||
* The `equalsParamNotRequired()` method needs to be in this separate fixture as it needs | ||
* a nullable type declaration (PHP 7.1+) to prevent a deprecation about an implicitely nullable | ||
* type on PHP 8.4. | ||
*/ | ||
class ValueObjectParamNotRequired { | ||
|
||
/** | ||
* The value. | ||
* | ||
* @var mixed | ||
*/ | ||
protected $value; | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param mixed $value The value. | ||
*/ | ||
public function __construct( $value ) { | ||
$this->value = $value; | ||
} | ||
|
||
/** | ||
* Comparator method: incorrectly declared - parameter is not required. | ||
* | ||
* @param self|null $other Object to compare. | ||
* | ||
* @return bool | ||
*/ | ||
public function equalsParamNotRequired( ?self $other = null ): bool { | ||
return ( $this->value === $other->value ); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters