File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,6 +137,10 @@ parameters:
137137 message : ' #Function "var_dump\(\)" cannot be used/left in the code#'
138138 path : src/functions/node_helper.php
139139
140+ -
141+ message : ' #Function "class_exists\(\)" cannot be used/left in the code#'
142+ path : src/Configuration/OnlyRuleResolver.php
143+
140144 # lack of generic array in nikic/php-parser
141145 - '#Method (.*? ) should return array<PhpParser\\Node\\ (.*? )\> but returns array<PhpParser\\Node\> #'
142146
Original file line number Diff line number Diff line change 44
55namespace Rector \Configuration ;
66
7- use PHPStan \Reflection \ReflectionProvider ;
87use Rector \Contract \Rector \RectorInterface ;
98use Rector \Exception \Configuration \RectorRuleNameAmbiguousException ;
109use Rector \Exception \Configuration \RectorRuleNotFoundException ;
1918 */
2019 public function __construct (
2120 private array $ rectors ,
22- private ReflectionProvider $ reflectionProvider
2321 ) {
2422 }
2523
@@ -104,16 +102,16 @@ public function resolve(string $rule): string
104102 */
105103 private function isRectorRuleClass (string $ className ): bool
106104 {
107- if (! $ this -> reflectionProvider -> hasClass ($ className )) {
105+ if (! class_exists ($ className )) {
108106 return false ;
109107 }
110108
111- $ classReflection = $ this -> reflectionProvider -> getClass ($ className );
112- if ($ classReflection ->isAbstract ()) {
109+ $ reflectionClass = new \ ReflectionClass ($ className );
110+ if ($ reflectionClass ->isAbstract ()) {
113111 return false ;
114112 }
115113
116- return $ classReflection ->implementsInterface (RectorInterface::class);
114+ return $ reflectionClass ->implementsInterface (RectorInterface::class);
117115 }
118116
119117 private function createUnregisteredMessage (string $ ruleClass ): string
Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ protected function setUp(): void
2727
2828 $ this ->onlyRuleResolver = new OnlyRuleResolver (
2929 iterator_to_array ($ rectorConfig ->tagged (RectorInterface::class)),
30- $ this ->make (ReflectionProvider::class)
3130 );
3231 }
3332
You can’t perform that action at this time.
0 commit comments