REDROOM
PHP 8.2.31
Path:
Logout
Edit File
Size: 2.13 KB
Close
//opt/cpanel/ea-wappspector/vendor/rector/rector/src/BetterPhpDocParser/PhpDocParser/ConstExprClassNameDecorator.php
Text
Base64
<?php declare (strict_types=1); namespace Rector\BetterPhpDocParser\PhpDocParser; use PhpParser\Node as PhpNode; use PHPStan\PhpDocParser\Ast\ConstExpr\ConstFetchNode; use PHPStan\PhpDocParser\Ast\Node; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocNode; use Rector\BetterPhpDocParser\Contract\PhpDocParser\PhpDocNodeDecoratorInterface; use Rector\BetterPhpDocParser\ValueObject\PhpDocAttributeKey; use Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser; use Rector\StaticTypeMapper\Naming\NameScopeFactory; /** * Decorate node with fully qualified class name for const epxr, * e.g. Direction::* */ final class ConstExprClassNameDecorator implements PhpDocNodeDecoratorInterface { /** * @readonly * @var \Rector\StaticTypeMapper\Naming\NameScopeFactory */ private $nameScopeFactory; /** * @readonly * @var \Rector\PhpDocParser\PhpDocParser\PhpDocNodeTraverser */ private $phpDocNodeTraverser; public function __construct(NameScopeFactory $nameScopeFactory, PhpDocNodeTraverser $phpDocNodeTraverser) { $this->nameScopeFactory = $nameScopeFactory; $this->phpDocNodeTraverser = $phpDocNodeTraverser; } public function decorate(PhpDocNode $phpDocNode, PhpNode $phpNode) : void { // iterating all phpdocs has big overhead. peek into the phpdoc to exit early if (\strpos($phpDocNode->__toString(), '::') === \false) { return; } $this->phpDocNodeTraverser->traverseWithCallable($phpDocNode, '', function (Node $node) use($phpNode) : ?\PHPStan\PhpDocParser\Ast\Node { if (!$node instanceof ConstFetchNode) { return null; } $className = $this->resolveFullyQualifiedClass($node, $phpNode); $node->setAttribute(PhpDocAttributeKey::RESOLVED_CLASS, $className); return $node; }); } private function resolveFullyQualifiedClass(ConstFetchNode $constFetchNode, PhpNode $phpNode) : string { $nameScope = $this->nameScopeFactory->createNameScopeFromNodeWithoutTemplateTypes($phpNode); return $nameScope->resolveStringName($constFetchNode->className); } }
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 1 × Files: 7
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
StaticDoctrineAnnotationParser
DIR
-
drwxr-xr-x
2024-11-08 13:59:10
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
ArrayItemClassNameDecorator.php
2.41 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
BetterPhpDocParser.php
7.01 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
BetterTypeParser.php
1.39 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
ClassAnnotationMatcher.php
3.74 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
ConstExprClassNameDecorator.php
2.13 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
DoctrineAnnotationDecorator.php
17.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
StaticDoctrineAnnotationParser.php
6.41 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).