diff --git a/src/PhpGenerator/Factory.php b/src/PhpGenerator/Factory.php index 9ab18d92..9509e763 100644 --- a/src/PhpGenerator/Factory.php +++ b/src/PhpGenerator/Factory.php @@ -218,8 +218,6 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter } else { $param->setDefaultValue($from->getDefaultValue()); } - - $param->setNullable($param->isNullable() && $param->getDefaultValue() !== null); } $param->setAttributes($this->getAttributes($from)); diff --git a/tests/PhpGenerator/expected/ClassType.from.bodies.expect b/tests/PhpGenerator/expected/ClassType.from.bodies.expect index 1a593c65..c33ef3d5 100644 --- a/tests/PhpGenerator/expected/ClassType.from.bodies.expect +++ b/tests/PhpGenerator/expected/ClassType.from.bodies.expect @@ -38,7 +38,7 @@ abstract class Class7 } - public function resolving($a = Abc\a\FOO, self $b = null, $c = self::FOO) + public function resolving($a = Abc\a\FOO, ?self $b = null, $c = self::FOO) { // constants echo FOO; diff --git a/tests/PhpGenerator/expected/ClassType.from.expect b/tests/PhpGenerator/expected/ClassType.from.expect index a6f42d2a..2ed08063 100644 --- a/tests/PhpGenerator/expected/ClassType.from.expect +++ b/tests/PhpGenerator/expected/ClassType.from.expect @@ -55,7 +55,7 @@ class Class2 extends Class1 implements Interface2 } - private function func4(array $a = [], Class2 $b = null, $c = Unknown::ABC) + private function func4(array $a = [], ?Class2 $b = null, $c = Unknown::ABC) { } @@ -77,7 +77,7 @@ class Class4 class Class5 { - public function func1(\A $a, ?\B $b, \C $c = null, \D $d = null, ?int $i = 1, ?array $arr = []) + public function func1(\A $a, ?\B $b, ?\C $c = null, ?\D $d = null, ?int $i = 1, ?array $arr = []) { }