1010use PhpParser \Node \Stmt \ClassMethod ;
1111use PHPStan \Type \ObjectType ;
1212use Rector \Rector \AbstractRector ;
13+ use Rector \Symfony \Enum \SymfonyClass ;
1314use Rector \Symfony \NodeAnalyzer \ClassAnalyzer ;
1415use Rector \Symfony \NodeFactory \GetSubscribedEventsClassMethodFactory ;
1516use Rector \Symfony \NodeFactory \OnSuccessLogoutClassMethodFactory ;
@@ -31,9 +32,7 @@ public function __construct(
3132 private readonly GetSubscribedEventsClassMethodFactory $ getSubscribedEventsClassMethodFactory ,
3233 private readonly ClassAnalyzer $ classAnalyzer ,
3334 ) {
34- $ this ->successHandlerObjectType = new ObjectType (
35- 'Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface '
36- );
35+ $ this ->successHandlerObjectType = new ObjectType (SymfonyClass::LOGOUT_SUCCESS_HANDLER );
3736 }
3837
3938 public function getRuleDefinition (): RuleDefinition
@@ -120,16 +119,13 @@ public function refactor(Node $node): ?Node
120119 return null ;
121120 }
122121
123- if (! $ this ->classAnalyzer ->hasImplements (
124- $ node ,
125- 'Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface '
126- )) {
122+ if (! $ this ->classAnalyzer ->hasImplements ($ node , SymfonyClass::LOGOUT_SUCCESS_HANDLER )) {
127123 return null ;
128124 }
129125
130126 $ this ->refactorImplements ($ node );
131127
132- $ node ->implements [] = new FullyQualified (' Symfony\Component\EventDispatcher\EventSubscriberInterface ' );
128+ $ node ->implements [] = new FullyQualified (SymfonyClass:: EVENT_SUBSCRIBER_INTERFACE );
133129
134130 // 2. refactor logout() class method to onLogout()
135131 $ onLogoutSuccessClassMethod = null ;
0 commit comments