Skip to content

Commit

Permalink
Fix PHP 8.4 deprecation: Implicitly marking parameter as nullable is …
Browse files Browse the repository at this point in the history
…deprecated, the explicit nullable type must be used instead
  • Loading branch information
nishant04412 committed Oct 24, 2024
1 parent ef43e6d commit 603f8d5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 8 deletions.
15 changes: 12 additions & 3 deletions test/Generator/AbstractGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ class AbstractGeneratorTest extends TestCase
{
public function testConstructor()
{
$generator = $this->getMockForAbstractClass(AbstractGenerator::class, [
$generator = $this->getMockForAbstractClass(
AbstractGenerator::class,
[
'indentation' => 'foo',
[
'indentation' => 'foo',
],
],
]);
'',
true,
true,
true,
[],
false
);

self::assertInstanceOf(GeneratorInterface::class, $generator);
self::assertSame('foo', $generator->getIndentation());
Expand Down
2 changes: 1 addition & 1 deletion test/Generator/TestAsset/TestSampleSingleClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function someMethod()
protected function withParamsAndReturnType(
$mixed,
array $array,
callable $callable = null,
?callable $callable = null,
?int $int = 0
): bool {
/* test test */
Expand Down
4 changes: 2 additions & 2 deletions test/Reflection/TestAsset/TestSampleClass5.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class TestSampleClass5
* which spans multiple lines
* @return mixed Some return descr
*/
public function doSomething($one, $two = 2, $three = 'three', array $array = array(), TestSampleClass $class = null)
public function doSomething($one, $two = 2, $three = 'three', array $array = array(), ?TestSampleClass $class = null)
{
return 'mixedValue';
}
Expand Down Expand Up @@ -63,7 +63,7 @@ public function doSomethingElse($one, $two = 2, $three = 'three')
public function methodWithNotAllParamsDeclared(
string $one,
$two = null,
int $three = null,
?int $three = null,
string $four = '',
$five = null
) {
Expand Down
2 changes: 1 addition & 1 deletion test/TestAsset/IterableHintsClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function nullableIterableParameter(?iterable $foo)
{
}

public function nullDefaultIterableParameter(iterable $foo = null)
public function nullDefaultIterableParameter(?iterable $foo = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion test/TestAsset/ObjectHintsClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function nullableObjectParameter(?object $foo)
{
}

public function nullDefaultObjectParameter(object $foo = null)
public function nullDefaultObjectParameter(?object $foo = null)
{
}

Expand Down

0 comments on commit 603f8d5

Please sign in to comment.