Skip to content

Commit 30eeae8

Browse files
committed
Fix PHP 8.4 deprecation.
1 parent a66cd4c commit 30eeae8

File tree

11 files changed

+15
-15
lines changed

11 files changed

+15
-15
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"minimum-stability": "stable",
1212
"require": {
1313
"php": ">=7.1",
14-
"phpunit/phpunit": "7.5 - 11.4",
14+
"phpunit/phpunit": "7.5 - 9.6",
1515
"antecedent/patchwork": "^2.2.0",
1616
"lucatume/args": "^1.0.1"
1717
},

src/functions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* @see \Patchwork\configure()
1515
*
1616
*/
17-
function init(array $options = null) {
17+
function init(?array $options = null) {
1818
FunctionMocker::init($options);
1919
}
2020

src/tad/FunctionMocker/Call/Logger/LoggerInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@
55
interface LoggerInterface
66
{
77

8-
public function called(array $args = null);
8+
public function called(?array $args = null);
99
}

src/tad/FunctionMocker/Call/Logger/SpyCallLogger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ public function __construct()
2222
: '\\PHPUnit\\Framework\\Constraint\\Constraint';
2323
}
2424

25-
public function called(array $args = null)
25+
public function called(?array $args = null)
2626
{
2727
$this->calls[] = CallTrace::fromArguments($args);
2828
}
2929

30-
public function getCallTimes(array $args = null)
30+
public function getCallTimes(?array $args = null)
3131
{
3232
$calls = $this->calls;
3333
if ($args) {

src/tad/FunctionMocker/Call/Verifier/InstanceMethodCallVerifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private function realWasCalledTimes( $times ) {
4343
*
4444
* @return array
4545
*/
46-
protected function getCallTimesWithArgs( $methodName, array $args = null ) {
46+
protected function getCallTimesWithArgs( $methodName, ?array $args = null ) {
4747
$invocations = $this->getInvocations();
4848
$callTimes = 0;
4949
array_map( function ( $invocation ) use ( &$callTimes, $args, $methodName ) {

src/tad/FunctionMocker/CallTrace.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class CallTrace
77

88
protected $args;
99

10-
public static function fromArguments(array $args = null)
10+
public static function fromArguments(?array $args = null)
1111
{
1212
$instance = new self;
1313
$instance->args = $args ? $args : array();

src/tad/FunctionMocker/FunctionMocker.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static function setUp() {
5454
*
5555
* @see \Patchwork\configure()
5656
*/
57-
public static function init(array $options = null, $forceReinit = false) {
57+
public static function init(?array $options = null, $forceReinit = false) {
5858
if (!$forceReinit && self::$didInit) {
5959
return;
6060
}
@@ -300,7 +300,7 @@ private static function getIndexedReplacements($return) {
300300
*
301301
* @return mixed
302302
*/
303-
public static function callOriginal(array $args = null) {
303+
public static function callOriginal(?array $args = null) {
304304
return \Patchwork\relay($args);
305305
}
306306

@@ -367,7 +367,7 @@ public static function forge($class) {
367367
*
368368
* @throws \RuntimeException If the Patchwork configuration file or the checksum file could not be written.
369369
*/
370-
public static function writePatchworkConfig(array $options = null, $destinationFolder) {
370+
public static function writePatchworkConfig(?array $options = null, $destinationFolder) {
371371
$options = self::getPatchworkConfiguration($options, $destinationFolder);
372372

373373
$configFileContents = json_encode($options);

src/tad/FunctionMocker/Method/Verifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function __construct()
2727
{
2828
}
2929

30-
public function __call($name, array $args = null)
30+
public function __call($name, ?array $args = null)
3131
{
3232
return InstanceMethodCallVerifier::from($this->returnValue, $this->callLogger);
3333
}

src/tad/FunctionMocker/MockWrapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class MockWrapper
3434
*/
3535
private $methodCode;
3636

37-
public function __construct($originalClassName = '', ClassTemplateInterface $classTemplate = null, MethodCodeInterface $methodCode = null)
37+
public function __construct($originalClassName = '', ?ClassTemplateInterface $classTemplate = null, ?MethodCodeInterface $methodCode = null)
3838
{
3939
$this->originalClassName = $originalClassName;
4040
$this->classTemplate = $classTemplate ?: new ClassTemplate();
@@ -71,7 +71,7 @@ public function wrap($mockObject, $invokedRecorder, ReplacementRequest $request)
7171
* @throws \Exception
7272
*
7373
*/
74-
protected function getWrappedInstance($object, ExtenderInterface $extender, $invokedRecorder = null, ReplacementRequest $request = null)
74+
protected function getWrappedInstance($object, ExtenderInterface $extender, $invokedRecorder = null, ?ReplacementRequest $request = null)
7575
{
7676
$mockClassName = get_class($object);
7777
$extendClassName = sprintf('%s_%s', uniqid('Extended_'), $mockClassName);

src/tad/FunctionMocker/PHPUnitFrameworkAssertWrapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static function getTestCase()
3232
* @param array $args
3333
* @return mixed
3434
*/
35-
public static function __callStatic($name, array $args = null)
35+
public static function __callStatic($name, ?array $args = null)
3636
{
3737
return call_user_func_array([self::getTestCase(), $name], $args);
3838
}

0 commit comments

Comments
 (0)