File tree Expand file tree Collapse file tree 2 files changed +3
-4
lines changed
tests/PHPStan/Rules/Functions Expand file tree Collapse file tree 2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change 1010use PhpParser \Node \Identifier ;
1111use PhpParser \Node \IntersectionType ;
1212use PhpParser \Node \Name ;
13- use PhpParser \Node \Name \FullyQualified ;
1413use PhpParser \Node \NullableType ;
1514use PhpParser \Node \Param ;
1615use PhpParser \Node \Stmt \ClassMethod ;
@@ -203,7 +202,7 @@ public function checkAnonymousFunction(
203202 if ($ returnTypeNode === null ) {
204203 return $ errors ;
205204 }
206- if ($ returnTypeNode instanceof FullyQualified && $ returnTypeNode ->name === 'void ' ) {
205+ if ($ returnTypeNode instanceof Identifier && $ returnTypeNode ->name === 'void ' ) {
207206 foreach ($ attribGroups as $ attribGroup ) {
208207 foreach ($ attribGroup ->attrs as $ attrib ) {
209208 if (strtolower ($ attrib ->name ->name ) === 'nodiscard ' ) {
@@ -497,7 +496,7 @@ private function checkParametersAcceptor(
497496 }
498497 if ($ parametersAcceptor ->hasNoDiscardAttribute ()->yes ()) {
499498 $ returnType = $ functionNode ->getReturnType ();
500- if ($ returnType instanceof FullyQualified
499+ if ($ returnType instanceof Identifier
501500 && $ returnType ->name === 'void '
502501 ) {
503502 $ errors [] = RuleErrorBuilder::message ($ noDiscardVoidReturnMessage )
Original file line number Diff line number Diff line change @@ -358,7 +358,7 @@ public function testNoDiscardVoid(): void
358358 $ this ->analyse ([__DIR__ . '/data/closure-typehints-nodiscard.php ' ], [
359359 [
360360 'Attribute NoDiscard cannot be used on void anonymous function. ' ,
361- 17 ,
361+ 5 ,
362362 ],
363363 ]);
364364 }
You can’t perform that action at this time.
0 commit comments