1111use Rector \Configuration \ConfigurationRuleFilter ;
1212use Rector \Contract \Rector \RectorInterface ;
1313use Rector \VersionBonding \PhpVersionedFilter ;
14+ use Webmozart \Assert \Assert ;
1415
1516/**
1617 * @see \Rector\Tests\PhpParser\NodeTraverser\RectorNodeTraverserTest
@@ -68,10 +69,12 @@ public function refreshPhpRectors(array $rectors): void
6869 public function getVisitorsForNode (Node $ node ): array
6970 {
7071 $ nodeClass = $ node ::class;
72+
7173 if (! isset ($ this ->visitorsPerNodeClass [$ nodeClass ])) {
7274 $ this ->visitorsPerNodeClass [$ nodeClass ] = [];
7375 foreach ($ this ->visitors as $ visitor ) {
74- assert ($ visitor instanceof RectorInterface);
76+ // already checked in prepare visitors method
77+ /** @var RectorInterface $visitor */
7578 foreach ($ visitor ->getNodeTypes () as $ nodeType ) {
7679 if (is_a ($ nodeClass , $ nodeType , true )) {
7780 $ this ->visitorsPerNodeClass [$ nodeClass ][] = $ visitor ;
@@ -85,10 +88,9 @@ public function getVisitorsForNode(Node $node): array
8588 }
8689
8790 /**
88- * This must happen after $this->configuration is set after ProcessCommand::execute() is run,
89- * otherwise we get default false positives.
91+ * This must happen after $this->configuration is set after ProcessCommand::execute() is run, otherwise we get default false positives.
9092 *
91- * This hack should be removed after https://github.com/rectorphp/rector/issues/5584 is resolved
93+ * This should be removed after https://github.com/rectorphp/rector/issues/5584 is resolved
9294 */
9395 private function prepareNodeVisitors (): void
9496 {
0 commit comments