REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.85 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/src/PhpAttribute/AnnotationToAttributeMapper/DoctrineAnnotationAnnotationToAttributeMapper.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\PhpAttribute\AnnotationToAttributeMapper; use PhpParser\Node\Expr\Array_; use PhpParser\Node\Expr\New_; use PhpParser\Node\Name; use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode; use Rector\Exception\ShouldNotHappenException; use Rector\Php\PhpVersionProvider; use Rector\PhpAttribute\AnnotationToAttributeMapper; use Rector\PhpAttribute\AttributeArrayNameInliner; use Rector\PhpAttribute\Contract\AnnotationToAttributeMapperInterface; use Rector\ValueObject\PhpVersionFeature; /** * @implements AnnotationToAttributeMapperInterface<DoctrineAnnotationTagValueNode> */ final class DoctrineAnnotationAnnotationToAttributeMapper implements AnnotationToAttributeMapperInterface { /** * @readonly * @var \Rector\Php\PhpVersionProvider */ private $phpVersionProvider; /** * @readonly * @var \Rector\PhpAttribute\AttributeArrayNameInliner */ private $attributeArrayNameInliner; /** * @var \Rector\PhpAttribute\AnnotationToAttributeMapper */ private $annotationToAttributeMapper; public function __construct(PhpVersionProvider $phpVersionProvider, AttributeArrayNameInliner $attributeArrayNameInliner) { $this->phpVersionProvider = $phpVersionProvider; $this->attributeArrayNameInliner = $attributeArrayNameInliner; } /** * Avoid circular reference */ public function autowire(AnnotationToAttributeMapper $annotationToAttributeMapper) : void { $this->annotationToAttributeMapper = $annotationToAttributeMapper; } /** * @param mixed $value */ public function isCandidate($value) : bool { if (!$value instanceof DoctrineAnnotationTagValueNode) { return \false; } return $this->phpVersionProvider->isAtLeastPhpVersion(PhpVersionFeature::NEW_INITIALIZERS); } /** * @param DoctrineAnnotationTagValueNode $value */ public function map($value) : \PhpParser\Node\Expr { $annotationShortName = $this->resolveAnnotationName($value); $values = $value->getValues(); if ($values !== []) { $argValues = $this->annotationToAttributeMapper->map($value->getValues()); if ($argValues instanceof Array_) { // create named args $args = $this->attributeArrayNameInliner->inlineArrayToArgs($argValues); } else { throw new ShouldNotHappenException(); } } else { $args = []; } return new New_(new Name($annotationShortName), $args); } private function resolveAnnotationName(DoctrineAnnotationTagValueNode $doctrineAnnotationTagValueNode) : string { $annotationShortName = $doctrineAnnotationTagValueNode->identifierTypeNode->name; return \ltrim($annotationShortName, '@'); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 8
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ArrayAnnotationToAttributeMapper.php
3.18 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
ArrayItemNodeAnnotationToAttributeMapper.php
2.95 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
ClassConstFetchAnnotationToAttributeMapper.php
982 B
lrw-r--r--
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ConstExprNodeAnnotationToAttributeMapper.php
1.58 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
CurlyListNodeAnnotationToAttributeMapper.php
2.16 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
DoctrineAnnotationAnnotationToAttributeMapper.php
2.85 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
StringAnnotationToAttributeMapper.php
1.67 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
StringNodeAnnotationToAttributeMapper.php
849 B
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).