Skip to content

Commit 00954b1

Browse files
authored
Merge pull request #625 from skilld-labs/624-implicitly-nullable-8.4
Fix deprecated nullable areguments #624
2 parents f425512 + 89fb3d1 commit 00954b1

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

spec/Prophecy/Doubler/Generator/ClassCodeGeneratorSpec.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ function it_generates_proper_php_code_for_specific_ClassNode(
7575
$method5->getCode()->willReturn('return;');
7676

7777
$argument11->getName()->willReturn('fullname');
78-
$argument11->isOptional()->willReturn(true);
79-
$argument11->getDefault()->willReturn(null);
78+
$argument11->isOptional()->willReturn(false);
8079
$argument11->isPassedByReference()->willReturn(false);
8180
$argument11->isVariadic()->willReturn(false);
8281
$argument11->getTypeNode()->willReturn(new ArgumentTypeNode('array'));
@@ -116,7 +115,7 @@ class CustomClass extends \RuntimeException implements \Prophecy\Doubler\Generat
116115
public $name;
117116
private $email;
118117
119-
public static function getName(array $fullname = NULL, \ReflectionClass $class, object $instance): ?string {
118+
public static function getName(array $fullname, \ReflectionClass $class, object $instance): ?string {
120119
return $this->name;
121120
}
122121
protected function getEmail(?string $default = '[email protected]') {
@@ -265,14 +264,14 @@ function it_overrides_properly_methods_with_args_passed_by_reference(
265264
$argument->getDefault()->willReturn(null);
266265
$argument->isPassedByReference()->willReturn(true);
267266
$argument->isVariadic()->willReturn(false);
268-
$argument->getTypeNode()->willReturn(new ArgumentTypeNode('array'));
267+
$argument->getTypeNode()->willReturn(new ArgumentTypeNode('array', 'null'));
269268

270269
$code = $this->generate('CustomClass', $class);
271270
$expected = <<<'PHP'
272271
namespace {
273272
class CustomClass extends \RuntimeException implements \Prophecy\Doubler\Generator\MirroredInterface {
274273
275-
public function getName(array &$fullname = NULL) {
274+
public function getName(?array &$fullname = NULL) {
276275
return $this->name;
277276
}
278277

0 commit comments

Comments
 (0)