10
10
use PhpParser \Node \Stmt \ClassMethod ;
11
11
use PHPStan \Type \ObjectType ;
12
12
use Rector \Rector \AbstractRector ;
13
+ use Rector \Symfony \Enum \SymfonyClass ;
13
14
use Rector \Symfony \NodeAnalyzer \ClassAnalyzer ;
14
15
use Rector \Symfony \NodeFactory \GetSubscribedEventsClassMethodFactory ;
15
16
use Rector \Symfony \NodeFactory \OnSuccessLogoutClassMethodFactory ;
@@ -31,9 +32,7 @@ public function __construct(
31
32
private readonly GetSubscribedEventsClassMethodFactory $ getSubscribedEventsClassMethodFactory ,
32
33
private readonly ClassAnalyzer $ classAnalyzer ,
33
34
) {
34
- $ this ->successHandlerObjectType = new ObjectType (
35
- 'Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface '
36
- );
35
+ $ this ->successHandlerObjectType = new ObjectType (SymfonyClass::LOGOUT_SUCCESS_HANDLER );
37
36
}
38
37
39
38
public function getRuleDefinition (): RuleDefinition
@@ -120,16 +119,13 @@ public function refactor(Node $node): ?Node
120
119
return null ;
121
120
}
122
121
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 )) {
127
123
return null ;
128
124
}
129
125
130
126
$ this ->refactorImplements ($ node );
131
127
132
- $ node ->implements [] = new FullyQualified (' Symfony\Component\EventDispatcher\EventSubscriberInterface ' );
128
+ $ node ->implements [] = new FullyQualified (SymfonyClass:: EVENT_SUBSCRIBER_INTERFACE );
133
129
134
130
// 2. refactor logout() class method to onLogout()
135
131
$ onLogoutSuccessClassMethod = null ;
0 commit comments