File manager - Edit - /var/www/payraty/helpdesk/vendor/rector/rector/vendor/symplify/astral/src/PhpDocParser/SimplePhpDocParser.php
Back
<?php declare (strict_types=1); namespace RectorPrefix202208\Symplify\Astral\PhpDocParser; use PhpParser\Comment\Doc; use PhpParser\Node; use PHPStan\PhpDocParser\Lexer\Lexer; use PHPStan\PhpDocParser\Parser\PhpDocParser; use PHPStan\PhpDocParser\Parser\TokenIterator; use RectorPrefix202208\Symplify\Astral\PhpDocParser\ValueObject\Ast\PhpDoc\SimplePhpDocNode; /** * @see \Symplify\Astral\Tests\PhpDocParser\SimplePhpDocParser\SimplePhpDocParserTest */ final class SimplePhpDocParser { /** * @var \PHPStan\PhpDocParser\Parser\PhpDocParser */ private $phpDocParser; /** * @var \PHPStan\PhpDocParser\Lexer\Lexer */ private $lexer; public function __construct(PhpDocParser $phpDocParser, Lexer $lexer) { $this->phpDocParser = $phpDocParser; $this->lexer = $lexer; } public function parseNode(Node $node) : ?SimplePhpDocNode { $docComment = $node->getDocComment(); if (!$docComment instanceof Doc) { return null; } return $this->parseDocBlock($docComment->getText()); } public function parseDocBlock(string $docBlock) : SimplePhpDocNode { $tokens = $this->lexer->tokenize($docBlock); $tokenIterator = new TokenIterator($tokens); $phpDocNode = $this->phpDocParser->parse($tokenIterator); return new SimplePhpDocNode($phpDocNode->children); } }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0 |
proxy
|
phpinfo
|
Settings