5151use Symplify \RuleDocGenerator \ValueObject \CodeSample \ConfiguredCodeSample ;
5252use Symplify \RuleDocGenerator \ValueObject \RuleDefinition ;
5353use Webmozart \Assert \Assert ;
54- use function Guanguans \RectorRules \Support \is_classes_of ;
54+ use function Guanguans \RectorRules \Support \is_instance_of_any ;
5555
5656final class RenameToPsrNameRector extends AbstractRector implements ConfigurableRectorInterface
5757{
@@ -131,9 +131,9 @@ public function getNodeTypes(): array
131131 }
132132
133133 /**
134- * @noinspection PhpDocSignatureInspection
135- *
136134 * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
135+ *
136+ * @noinspection PhpDocSignatureInspection
137137 */
138138 public function refactor (Node $ node ): ?Node
139139 {
@@ -163,6 +163,8 @@ public function refactor(Node $node): ?Node
163163 }
164164
165165 /**
166+ * @see https://github.com/barryvdh/laravel-ide-helper/blob/master/resources/views/meta.php
167+ *
166168 * @throws \Symplify\RuleDocGenerator\Exception\PoorDocumentationException
167169 * @throws \Symplify\RuleDocGenerator\Exception\ShouldNotHappenException
168170 */
@@ -311,10 +313,10 @@ public function configure(array $configuration): void
311313 * @see https://github.com/rectorphp/rector/issues/7611
312314 * @see https://github.com/rectorphp/rector/blob/main/UPGRADING.md#1-abstractscopeawarerector-is-removed-use-abstractrector-instead
313315 *
316+ * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
317+ *
314318 * @noinspection PhpDocSignatureInspection
315319 * @noinspection PhpPossiblePolymorphicInvocationInspection
316- *
317- * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
318320 */
319321 private function rename (Node $ node , callable $ renamer ): ?Node
320322 {
@@ -338,7 +340,7 @@ private function rename(Node $node, callable $renamer): ?Node
338340 }
339341
340342 if (
341- is_classes_of ($ node , [
343+ is_instance_of_any ($ node , [
342344 Variable::class,
343345 Identifier::class,
344346 ])
@@ -416,9 +418,9 @@ private function rename(Node $node, callable $renamer): ?Node
416418 }
417419
418420 /**
419- * @noinspection PhpDocSignatureInspection
420- *
421421 * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
422+ *
423+ * @noinspection PhpDocSignatureInspection
422424 */
423425 private function shouldLowerSnakeName (Node $ node ): bool
424426 {
@@ -438,7 +440,7 @@ private function shouldLowerSnakeName(Node $node): bool
438440 && (
439441 $ parent instanceof FuncCall
440442 || (
441- is_classes_of ($ parent , [UseItem::class])
443+ is_instance_of_any ($ parent , [UseItem::class])
442444 && (
443445 (Use_::TYPE_UNKNOWN === $ grandfather ->type && Use_::TYPE_FUNCTION === $ parent ->type )
444446 || (Use_::TYPE_FUNCTION === $ grandfather ->type && Use_::TYPE_UNKNOWN === $ parent ->type )
@@ -462,9 +464,9 @@ private function shouldLowerSnakeName(Node $node): bool
462464 }
463465
464466 /**
465- * @noinspection PhpDocSignatureInspection
466- *
467467 * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
468+ *
469+ * @noinspection PhpDocSignatureInspection
468470 */
469471 private function shouldUcfirstCamelName (Node $ node ): bool
470472 {
@@ -475,7 +477,7 @@ private function shouldUcfirstCamelName(Node $node): bool
475477
476478 if (
477479 $ node instanceof Identifier
478- && is_classes_of ($ parent , [
480+ && is_instance_of_any ($ parent , [
479481 // interface InterfaceName{}
480482 Interface_::class,
481483 // class ClassName{}
@@ -496,13 +498,13 @@ private function shouldUcfirstCamelName(Node $node): bool
496498 // use ClassName;
497499 /** @noinspection PhpConditionAlreadyCheckedInspection */
498500 (
499- is_classes_of ($ parent , [UseItem::class])
501+ is_instance_of_any ($ parent , [UseItem::class])
500502 && (
501503 (Use_::TYPE_UNKNOWN === $ grandfather ->type && Use_::TYPE_NORMAL === $ parent ->type )
502504 || (Use_::TYPE_NORMAL === $ grandfather ->type && Use_::TYPE_UNKNOWN === $ parent ->type )
503505 )
504506 )
505- || is_classes_of ($ parent , [
507+ || is_instance_of_any ($ parent , [
506508 // #[\AttributeName]
507509 Attribute::class,
508510 // class Foo extends ClassName implements InterfaceName{}
@@ -573,9 +575,9 @@ private function shouldUcfirstCamelName(Node $node): bool
573575 }
574576
575577 /**
576- * @noinspection PhpDocSignatureInspection
577- *
578578 * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
579+ *
580+ * @noinspection PhpDocSignatureInspection
579581 */
580582 private function shouldUpperSnakeName (Node $ node ): bool
581583 {
@@ -585,7 +587,7 @@ private function shouldUpperSnakeName(Node $node): bool
585587 if (
586588 $ node instanceof Identifier
587589 && !$ this ->isName ($ node , 'class ' )
588- && is_classes_of ($ parent , [
590+ && is_instance_of_any ($ parent , [
589591 // class Foo{public const CONST_NAME = 'const';}
590592 Const_::class,
591593 // Foo::CONST_NAME;
@@ -617,7 +619,7 @@ private function shouldUpperSnakeName(Node $node): bool
617619 && (
618620 $ parent instanceof ConstFetch
619621 || (
620- is_classes_of ($ parent , [UseItem::class])
622+ is_instance_of_any ($ parent , [UseItem::class])
621623 && (
622624 (Use_::TYPE_UNKNOWN === $ grandfather ->type && Use_::TYPE_CONSTANT === $ parent ->type )
623625 || (Use_::TYPE_CONSTANT === $ grandfather ->type && Use_::TYPE_UNKNOWN === $ parent ->type )
@@ -627,9 +629,9 @@ private function shouldUpperSnakeName(Node $node): bool
627629 }
628630
629631 /**
630- * @noinspection PhpDocSignatureInspection
631- *
632632 * @param \PhpParser\Node\Expr\FuncCall|\PhpParser\Node\Expr\Variable|\PhpParser\Node\Identifier|\PhpParser\Node\Name $node
633+ *
634+ * @noinspection PhpDocSignatureInspection
633635 */
634636 private function shouldLcfirstCamelName (Node $ node ): bool
635637 {
@@ -640,7 +642,7 @@ private function shouldLcfirstCamelName(Node $node): bool
640642
641643 if (
642644 $ node instanceof Identifier
643- && is_classes_of ($ node ->getAttribute ('parent ' ), [
645+ && is_instance_of_any ($ node ->getAttribute ('parent ' ), [
644646 // class Foo{public $propertyName;}
645647 Property::class,
646648 // class Foo{public int $propertyName;}
0 commit comments