-
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.
Merge pull request #170 from Yoast/feature/improve-php-8.4-workaround…
…-implicitly-nullable Tests: improve PHP 8.4 deprecation work-around
- 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