Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! Add test case for #3222
Browse files Browse the repository at this point in the history
  • Loading branch information
rector-bot committed May 4, 2020
1 parent acf4d1b commit 4ebadc4
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions packages/better-php-doc-parser/src/PhpDocInfo/PhpDocInfoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,18 @@

final class PhpDocInfoFactory
{
// create empty node

/**
* @var string
*/
private const CONTENT = '';

/**
* @var mixed[]
*/
private const TOKENS = [];

/**
* @var PhpDocParser
*/
Expand Down Expand Up @@ -56,15 +68,6 @@ final class PhpDocInfoFactory
* @var ParamPhpDocNodeFactory
*/
private $paramPhpDocNodeFactory;
// create empty node
/**
* @var string
*/
private const CONTENT = '';
/**
* @var mixed[]
*/
private const TOKENS = [];

public function __construct(
PhpDocParser $phpDocParser,
Expand All @@ -91,12 +94,12 @@ public function createFromNode(Node $node): ?PhpDocInfo

if ($node->getDocComment() === null) {
return null;
} else {
$content = $node->getDocComment()->getText();
$tokens = $this->lexer->tokenize($content);
$phpDocNode = $this->parseTokensToPhpDocNode($tokens);
$this->setPositionOfLastToken($phpDocNode);
}
$content = $node->getDocComment()->getText();
$tokens = $this->lexer->tokenize($content);
$phpDocNode = $this->parseTokensToPhpDocNode($tokens);
$this->setPositionOfLastToken($phpDocNode);


return $this->createFromPhpDocNode($phpDocNode, $content, $tokens, $node);
}
Expand Down Expand Up @@ -145,7 +148,10 @@ private function createFromPhpDocNode(
Node $node
): PhpDocInfo {
/** @var AttributeAwarePhpDocNode $phpDocNode */
$attributeAwarePhpDocNode = $this->attributeAwareNodeFactory->createFromNode($attributeAwarePhpDocNode, $content);
$attributeAwarePhpDocNode = $this->attributeAwareNodeFactory->createFromNode(
$attributeAwarePhpDocNode,
$content
);

$phpDocInfo = new PhpDocInfo(
$attributeAwarePhpDocNode,
Expand Down

0 comments on commit 4ebadc4

Please sign in to comment.