Skip to content

Commit c02c065

Browse files
committed
Factory: parameters 'int $foo = null' are parsed as '?int'
1 parent 08ab9bf commit c02c065

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

src/PhpGenerator/Factory.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
218218
} else {
219219
$param->setDefaultValue($from->getDefaultValue());
220220
}
221-
222-
$param->setNullable($param->isNullable() && $param->getDefaultValue() !== null);
223221
}
224222

225223
$param->setAttributes($this->getAttributes($from));

tests/PhpGenerator/expected/ClassType.from.bodies.expect

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ abstract class Class7
3838
}
3939

4040

41-
public function resolving($a = Abc\a\FOO, self $b = null, $c = self::FOO)
41+
public function resolving($a = Abc\a\FOO, ?self $b = null, $c = self::FOO)
4242
{
4343
// constants
4444
echo FOO;

tests/PhpGenerator/expected/ClassType.from.expect

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Class2 extends Class1 implements Interface2
5555
}
5656

5757

58-
private function func4(array $a = [], Class2 $b = null, $c = Unknown::ABC)
58+
private function func4(array $a = [], ?Class2 $b = null, $c = Unknown::ABC)
5959
{
6060
}
6161

@@ -77,7 +77,7 @@ class Class4
7777

7878
class Class5
7979
{
80-
public function func1(\A $a, ?\B $b, \C $c = null, \D $d = null, ?int $i = 1, ?array $arr = [])
80+
public function func1(\A $a, ?\B $b, ?\C $c = null, ?\D $d = null, ?int $i = 1, ?array $arr = [])
8181
{
8282
}
8383

0 commit comments

Comments
 (0)