REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 1.83 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/vendor/rector/rector-downgrade-php/src/NodeFactory/DoctrineAnnotationFactory.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\NodeFactory; use PhpParser\Node\Arg; use PhpParser\Node\Attribute; use PhpParser\Node\Identifier; use PhpParser\Node\Scalar\String_; use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode; use Rector\BetterPhpDocParser\PhpDoc\DoctrineAnnotationTagValueNode; use Rector\NodeTypeResolver\Node\AttributeKey; use Rector\PhpParser\Printer\BetterStandardPrinter; final class DoctrineAnnotationFactory { /** * @readonly * @var \Rector\PhpParser\Printer\BetterStandardPrinter */ private $betterStandardPrinter; public function __construct(BetterStandardPrinter $betterStandardPrinter) { $this->betterStandardPrinter = $betterStandardPrinter; } /** * @api downgrade */ public function createFromAttribute(Attribute $attribute, string $className) : DoctrineAnnotationTagValueNode { $items = $this->createItemsFromArgs($attribute->args); $identifierTypeNode = new IdentifierTypeNode($className); return new DoctrineAnnotationTagValueNode($identifierTypeNode, null, $items); } /** * @param Arg[] $args * @return mixed[] */ private function createItemsFromArgs(array $args) : array { $items = []; foreach ($args as $arg) { if ($arg->value instanceof String_) { // standardize double quotes for annotations $arg->value->setAttribute(AttributeKey::KIND, String_::KIND_DOUBLE_QUOTED); } $itemValue = $this->betterStandardPrinter->print($arg->value); if ($arg->name instanceof Identifier) { $name = $this->betterStandardPrinter->print($arg->name); $items[$name] = $itemValue; } else { $items[] = $itemValue; } } return $items; } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 0 × Files: 3
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
ClassFromEnumFactory.php
1.86 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
DoctrineAnnotationFactory.php
1.83 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
NamedVariableFactory.php
802 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).