Skip to content

Commit cb4901f

Browse files
committed
Fix PHP 8.4 deprecation: Implicitly marking parameter as nullable is deprecated, the explicit nullable type must be used instead
1 parent ef43e6d commit cb4901f

File tree

6 files changed

+19
-10
lines changed

6 files changed

+19
-10
lines changed

test/Generator/AbstractGeneratorTest.php

+12-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,20 @@ class AbstractGeneratorTest extends TestCase
1414
{
1515
public function testConstructor()
1616
{
17-
$generator = $this->getMockForAbstractClass(AbstractGenerator::class, [
17+
$generator = $this->getMockForAbstractClass(
18+
AbstractGenerator::class,
1819
[
19-
'indentation' => 'foo',
20+
[
21+
'indentation' => 'foo',
22+
],
2023
],
21-
]);
24+
'',
25+
true,
26+
true,
27+
true,
28+
[],
29+
false
30+
);
2231

2332
self::assertInstanceOf(GeneratorInterface::class, $generator);
2433
self::assertSame('foo', $generator->getIndentation());

test/Generator/TestAsset/ParameterClass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function defaultConstant($con = self::FOO)
7575

7676
}
7777

78-
public function defaultObjectEqualsNullAndNotOptional(\stdClass $a = null, $b)
78+
public function defaultObjectEqualsNullAndNotOptional(?\stdClass $a = null, $b)
7979
{
8080

8181
}

test/Generator/TestAsset/TestSampleSingleClass.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ public function someMethod()
3232
protected function withParamsAndReturnType(
3333
$mixed,
3434
array $array,
35-
callable $callable = null,
35+
?callable $callable = null,
3636
?int $int = 0
3737
): bool {
38-
/* test test */
38+
/* test */
3939
return true;
4040
}
4141

test/Reflection/TestAsset/TestSampleClass5.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class TestSampleClass5
3434
* which spans multiple lines
3535
* @return mixed Some return descr
3636
*/
37-
public function doSomething($one, $two = 2, $three = 'three', array $array = array(), TestSampleClass $class = null)
37+
public function doSomething($one, $two = 2, $three = 'three', array $array = array(), ?TestSampleClass $class = null)
3838
{
3939
return 'mixedValue';
4040
}
@@ -63,7 +63,7 @@ public function doSomethingElse($one, $two = 2, $three = 'three')
6363
public function methodWithNotAllParamsDeclared(
6464
string $one,
6565
$two = null,
66-
int $three = null,
66+
?int $three = null,
6767
string $four = '',
6868
$five = null
6969
) {

test/TestAsset/IterableHintsClass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function nullableIterableParameter(?iterable $foo)
1212
{
1313
}
1414

15-
public function nullDefaultIterableParameter(iterable $foo = null)
15+
public function nullDefaultIterableParameter(?iterable $foo = null)
1616
{
1717
}
1818

test/TestAsset/ObjectHintsClass.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function nullableObjectParameter(?object $foo)
1212
{
1313
}
1414

15-
public function nullDefaultObjectParameter(object $foo = null)
15+
public function nullDefaultObjectParameter(?object $foo = null)
1616
{
1717
}
1818

0 commit comments

Comments
 (0)