@@ -75,7 +75,7 @@ public function fromMethodReflection(\ReflectionMethod $from): Method
75
75
$ method ->setReturnReference ($ from ->returnsReference ());
76
76
$ method ->setVariadic ($ from ->isVariadic ());
77
77
$ method ->setComment (Helpers::unformatDocComment ((string ) $ from ->getDocComment ()));
78
- if ($ from ->hasReturnType () ) {
78
+ if ($ from ->getReturnType () instanceof \ReflectionNamedType ) {
79
79
$ method ->setReturnType ($ from ->getReturnType ()->getName ());
80
80
$ method ->setReturnNullable ($ from ->getReturnType ()->allowsNull ());
81
81
}
@@ -93,7 +93,7 @@ public function fromFunctionReflection(\ReflectionFunction $from)
93
93
if (!$ from ->isClosure ()) {
94
94
$ function ->setComment (Helpers::unformatDocComment ((string ) $ from ->getDocComment ()));
95
95
}
96
- if ($ from ->hasReturnType () ) {
96
+ if ($ from ->getReturnType () instanceof \ReflectionNamedType ) {
97
97
$ function ->setReturnType ($ from ->getReturnType ()->getName ());
98
98
$ function ->setReturnNullable ($ from ->getReturnType ()->allowsNull ());
99
99
}
@@ -105,7 +105,7 @@ public function fromParameterReflection(\ReflectionParameter $from): Parameter
105
105
{
106
106
$ param = new Parameter ($ from ->getName ());
107
107
$ param ->setReference ($ from ->isPassedByReference ());
108
- $ param ->setType ($ from ->hasType () ? $ from ->getType ()->getName () : null );
108
+ $ param ->setType ($ from ->getType () instanceof \ReflectionNamedType ? $ from ->getType ()->getName () : null );
109
109
$ param ->setNullable ($ from ->hasType () && $ from ->getType ()->allowsNull ());
110
110
if ($ from ->isDefaultValueAvailable ()) {
111
111
$ param ->setDefaultValue ($ from ->isDefaultValueConstant ()
@@ -127,9 +127,9 @@ public function fromPropertyReflection(\ReflectionProperty $from): Property
127
127
? ClassType::VISIBILITY_PRIVATE
128
128
: ($ from ->isProtected () ? ClassType::VISIBILITY_PROTECTED : ClassType::VISIBILITY_PUBLIC )
129
129
);
130
- if (PHP_VERSION_ID >= 70400 && ($ type = $ from ->getType ())) {
131
- $ prop ->setType ($ type ->getName ());
132
- $ prop ->setNullable ($ type ->allowsNull ());
130
+ if (PHP_VERSION_ID >= 70400 && ($ from ->getType () instanceof \ReflectionNamedType )) {
131
+ $ prop ->setType ($ from -> getType () ->getName ());
132
+ $ prop ->setNullable ($ from -> getType () ->allowsNull ());
133
133
$ prop ->setInitialized (array_key_exists ($ prop ->getName (), $ defaults ));
134
134
}
135
135
$ prop ->setComment (Helpers::unformatDocComment ((string ) $ from ->getDocComment ()));
0 commit comments