Skip to content

Commit 51a358c

Browse files
committed
cs
1 parent c052ff5 commit 51a358c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Rules/Symfony/NoListenerWithoutContractRule.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Symplify\PHPStanRules\Rules\Symfony;
66

7+
use PhpParser\Node\Name;
78
use PhpParser\Node;
89
use PhpParser\Node\Stmt\Class_;
910
use PHPStan\Analyser\Scope;
@@ -134,11 +135,9 @@ private function isFormEventsListener(Class_ $class): bool
134135
}
135136

136137
foreach ($classMethod->params as $param) {
137-
if ($param->type instanceof Node\Name) {
138+
if ($param->type instanceof Name && str_starts_with($param->type->toString(), 'Symfony\Component\Form\Event\\')) {
138139

139-
if (str_starts_with($param->type->toString(), 'Symfony\Component\Form\Event\\')) {
140-
return true;
141-
}
140+
return true;
142141
}
143142
}
144143
}
@@ -148,7 +147,7 @@ private function isFormEventsListener(Class_ $class): bool
148147

149148
private function isSecurityListener(Class_ $class): bool
150149
{
151-
if (! $class->extends instanceof Node\Name) {
150+
if (! $class->extends instanceof Name) {
152151
return false;
153152
}
154153

0 commit comments

Comments
 (0)