Skip to content

Commit 530e911

Browse files
committed
PHP 8.4 | Fix implicitly nullable parameter
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
1 parent 560355d commit 530e911

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Expectation/Expectation.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ class Expectation
9696
/**
9797
* @param \Mockery\ExpectationInterface $expectation
9898
* @param \Brain\Monkey\Expectation\ExpectationTarget $target
99-
* @param \ArrayAccess $return_expectations
99+
* @param \ArrayAccess|null $return_expectations
100100
*/
101101
public function __construct(
102102
ExpectationInterface $expectation,
103103
ExpectationTarget $target,
104-
\ArrayAccess $return_expectations = null
104+
$return_expectations = null
105105
) {
106106
$this->expectation = $expectation;
107107
$this->target = $target;
108-
$this->return_expectations = $return_expectations ? : new \ArrayObject();
108+
$this->return_expectations = ($return_expectations instanceof \ArrayAccess) ? $return_expectations : new \ArrayObject();
109109
}
110110

111111
/**

0 commit comments

Comments
 (0)