Skip to content

Commit

Permalink
PHP 8.4 | Fix implicitly nullable parameter
Browse files Browse the repository at this point in the history
PHP 8.4 deprecates implicitly nullable parameters, i.e. typed parameter with a `null` default value, which are not explicitly declared as nullable.

This commit fixes the one instance found in this codebase.

Includes updating the documentation to match.

Note: while this is not a `final` class an the change is effectively a change to the method signature, this is not a BC break as (overloaded) constructors are exempt from signature checks.

Ref: https://wiki.php.net/rfc/deprecate-implicitly-nullable-types
  • Loading branch information
jrfnl committed Aug 27, 2024
1 parent 560355d commit 530e911
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Expectation/Expectation.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ class Expectation
/**
* @param \Mockery\ExpectationInterface $expectation
* @param \Brain\Monkey\Expectation\ExpectationTarget $target
* @param \ArrayAccess $return_expectations
* @param \ArrayAccess|null $return_expectations
*/
public function __construct(
ExpectationInterface $expectation,
ExpectationTarget $target,
\ArrayAccess $return_expectations = null
$return_expectations = null
) {
$this->expectation = $expectation;
$this->target = $target;
$this->return_expectations = $return_expectations ? : new \ArrayObject();
$this->return_expectations = ($return_expectations instanceof \ArrayAccess) ? $return_expectations : new \ArrayObject();
}

/**
Expand Down

0 comments on commit 530e911

Please sign in to comment.