@@ -305,15 +305,19 @@ public function enterNode(Node $node): null
305305 if ('self ' === $ node ->name ) {
306306 $ reflectionMethod = new \ReflectionMethod ($ this ->mockClassBuilder , 'replaceSelfWithOriginalClassInType ' );
307307
308- $ node ->name = $ reflectionMethod ->invoke ($ this ->mockClassBuilder , $ this ->reflectionClasses , $ this ->methodName , 'self ' );
308+ /** @var non-empty-string */
309+ $ name = $ reflectionMethod ->invoke ($ this ->mockClassBuilder , $ this ->reflectionClasses , $ this ->methodName , 'self ' );
310+ $ node ->name = $ name ;
309311
310312 return null ;
311313 }
312314
313315 if ('parent ' === $ node ->name ) {
314316 $ reflectionMethod = new \ReflectionMethod ($ this ->mockClassBuilder , 'replaceSelfWithOriginalClassInType ' );
315317
316- $ node ->name = $ reflectionMethod ->invoke ($ this ->mockClassBuilder , $ this ->reflectionClasses , $ this ->methodName , 'parent ' );
318+ /** @var non-empty-string */
319+ $ name = $ reflectionMethod ->invoke ($ this ->mockClassBuilder , $ this ->reflectionClasses , $ this ->methodName , 'parent ' );
320+ $ node ->name = $ name ;
317321
318322 return null ;
319323 }
@@ -402,9 +406,12 @@ private function resolveOriginalClassConst(
402406 if (\is_string ($ value )) {
403407 $ matches = [];
404408 if (preg_match ('/^ ' .$ this ->originalClassConstPattern ($ reflectionClass ).'$/ ' , $ value , $ matches )) {
409+ /** @var null|bool|float|int|string */
410+ $ constantValue = $ reflectionClass ->getConstant ($ matches [1 ]);
411+
405412 return $ this ->resolveOriginalClassConst (
406413 $ reflectionClass ,
407- $ reflectionClass -> getConstant ( $ matches [ 1 ])
414+ $ constantValue
408415 );
409416 }
410417
0 commit comments