REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.36 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/src/PhpAttribute/NodeFactory/AttributeNameFactory.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\PhpAttribute\NodeFactory; use PhpParser\Node\Name; use PhpParser\Node\Name\FullyQualified; use PhpParser\Node\Stmt\Use_; use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode; use Rector\Php80\Contract\ValueObject\AnnotationToAttributeInterface; use Rector\PhpAttribute\UseAliasNameMatcher; use Rector\PhpAttribute\ValueObject\UseAliasMetadata; final class AttributeNameFactory { /** * @readonly * @var \Rector\PhpAttribute\UseAliasNameMatcher */ private $useAliasNameMatcher; public function __construct(UseAliasNameMatcher $useAliasNameMatcher) { $this->useAliasNameMatcher = $useAliasNameMatcher; } /** * @param Use_[] $uses * @return \PhpParser\Node\Name\FullyQualified|\PhpParser\Node\Name */ public function create(AnnotationToAttributeInterface $annotationToAttribute, DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode, array $uses) { // A. attribute and class name are the same, so we re-use the short form to keep code compatible with previous one, // except start with \ if ($annotationToAttribute->getAttributeClass() === $annotationToAttribute->getTag()) { $attributeName = $doctrineAnnotationTagValueNode->identifierTypeNode->name; $attributeName = \ltrim($attributeName, '@'); if (\strncmp($attributeName, '\\', \strlen('\\')) === 0) { return new FullyQualified(\ltrim($attributeName, '\\')); } return new Name($attributeName); } // B. different name $useAliasMetadata = $this->useAliasNameMatcher->match($uses, $doctrineAnnotationTagValueNode->identifierTypeNode->name, $annotationToAttribute); if ($useAliasMetadata instanceof UseAliasMetadata) { $useUse = $useAliasMetadata->getUseUse(); // is same as name? $useImportName = $useAliasMetadata->getUseImportName(); if ($useUse->name->toString() !== $useImportName) { // no? rename $useUse->name = new Name($useImportName); } return new Name($useAliasMetadata->getShortAttributeName()); } // 3. the class is not aliased and is completely new... return the FQN version return new FullyQualified($annotationToAttribute->getAttributeClass()); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 5
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
AnnotationToAttributeIntegerValueCaster.php
3.37 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
AttributeNameFactory.php
2.36 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
NamedArgsFactory.php
2.51 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PhpAttributeGroupFactory.php
6.02 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
PhpNestedAttributeGroupFactory.php
10.65 KB
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).