![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/rector/rector/rules/Php80/NodeFactory/ |
<?php declare (strict_types=1); namespace Rector\Php80\NodeFactory; use PhpParser\Node\AttributeGroup; use PhpParser\Node\Stmt\Use_; use Rector\Php80\ValueObject\NestedDoctrineTagAndAnnotationToAttribute; use Rector\PhpAttribute\NodeFactory\PhpNestedAttributeGroupFactory; final class NestedAttrGroupsFactory { /** * @readonly * @var \Rector\PhpAttribute\NodeFactory\PhpNestedAttributeGroupFactory */ private $phpNestedAttributeGroupFactory; public function __construct(PhpNestedAttributeGroupFactory $phpNestedAttributeGroupFactory) { $this->phpNestedAttributeGroupFactory = $phpNestedAttributeGroupFactory; } /** * @param NestedDoctrineTagAndAnnotationToAttribute[] $nestedDoctrineTagAndAnnotationToAttributes * @param Use_[] $uses * @return AttributeGroup[] */ public function create(array $nestedDoctrineTagAndAnnotationToAttributes, array $uses) : array { $attributeGroups = []; foreach ($nestedDoctrineTagAndAnnotationToAttributes as $nestedDoctrineTagAndAnnotationToAttribute) { $doctrineAnnotationTagValueNode = $nestedDoctrineTagAndAnnotationToAttribute->getDoctrineAnnotationTagValueNode(); $nestedAnnotationToAttribute = $nestedDoctrineTagAndAnnotationToAttribute->getNestedAnnotationToAttribute(); // do not create alternative for the annotation, only unwrap if (!$nestedAnnotationToAttribute->shouldRemoveOriginal()) { // add attributes $attributeGroups[] = $this->phpNestedAttributeGroupFactory->create($doctrineAnnotationTagValueNode, $nestedDoctrineTagAndAnnotationToAttribute->getNestedAnnotationToAttribute(), $uses); } $nestedAttributeGroups = $this->phpNestedAttributeGroupFactory->createNested($doctrineAnnotationTagValueNode, $nestedDoctrineTagAndAnnotationToAttribute->getNestedAnnotationToAttribute()); $attributeGroups = \array_merge($attributeGroups, $nestedAttributeGroups); } return $attributeGroups; } }