@@ -132,14 +132,15 @@ class_uses($name),
132132 }
133133 foreach ($ class ->getMethods (ReflectionMethod::IS_PUBLIC ) as $ method ) {
134134 if ($ method ->getDeclaringClass () == $ class ) { // intentionally ==
135+ $ type = $ method ->getReturnType ();
135136 $ hash [] = [
136137 $ name ,
137138 $ method ->name ,
138139 $ method ->getDocComment (),
139140 self ::hashParameters ($ method ),
140- $ method -> hasReturnType ()
141- ? [ $ method -> getReturnType ()-> getName (), $ method -> getReturnType ()-> allowsNull ()]
142- : null ,
141+ PHP_VERSION_ID < 80000
142+ ? ( $ type ? [ $ type -> getName (), $ type -> allowsNull ()] : null )
143+ : ( string ) $ type ,
143144 ];
144145 }
145146 }
@@ -158,14 +159,15 @@ class_uses($name),
158159 $ method = new \ReflectionFunction ($ name );
159160 $ uses = null ;
160161 }
162+ $ type = $ method ->getReturnType ();
161163 $ hash [] = [
162164 $ name ,
163165 $ uses ,
164166 $ method ->getDocComment (),
165167 self ::hashParameters ($ method ),
166- $ method -> hasReturnType ()
167- ? [ $ method -> getReturnType ()-> getName (), $ method -> getReturnType ()-> allowsNull ()]
168- : null ,
168+ PHP_VERSION_ID < 80000
169+ ? ( $ type ? [ $ type -> getName (), $ type -> allowsNull ()] : null )
170+ : ( string ) $ type ,
169171 ];
170172 }
171173
@@ -179,8 +181,9 @@ private static function hashParameters(\ReflectionFunctionAbstract $method): arr
179181 foreach ($ method ->getParameters () as $ param ) {
180182 $ res [] = [
181183 $ param ->name ,
182- Reflection::getParameterType ($ param ),
183- $ param ->allowsNull (),
184+ PHP_VERSION_ID < 80000
185+ ? [Reflection::getParameterType ($ param ), $ param ->allowsNull ()]
186+ : (string ) $ param ->getType (),
184187 $ param ->isVariadic (),
185188 $ param ->isDefaultValueAvailable ()
186189 ? [Reflection::getParameterDefaultValue ($ param )]
0 commit comments