Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/voku/SimplePhpParser/Model/PHPClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace voku\SimplePhpParser\Model;

use phpDocumentor\Reflection\DocBlockFactory;
use PhpParser\Comment\Doc;
use PhpParser\Node\Stmt\Class_;
use ReflectionClass;
Expand Down Expand Up @@ -385,7 +386,7 @@ private function readPhpDocProperties($doc): void
}

try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment);
$phpDoc = DocBlockFactory::createInstance()->create($docComment);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Consider using DocFactoryProvider::getDocFactory() instead to leverage the cached factory instance for better performance.

            $phpDoc = DocFactoryProvider::getDocFactory()->create($docComment);


$parsedPropertyTags = $phpDoc->getTagsByName('property')
+ $phpDoc->getTagsByName('property-read')
Expand Down
4 changes: 2 additions & 2 deletions src/voku/SimplePhpParser/Model/PHPFunction.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function readObjectFromPhpNode($node, $dummy = null): self
$docComment = $node->getDocComment();
if ($docComment) {
try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment->getText());
$phpDoc = DocBlockFactory::createInstance()->create($docComment->getText());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Use DocFactoryProvider::getDocFactory() to utilize the cached factory instance, improving performance.

                $phpDoc = DocFactoryProvider::getDocFactory()->create($docComment->getText());

$this->summary = $phpDoc->getSummary();
$this->description = (string) $phpDoc->getDescription();
} catch (\Exception $e) {
Expand Down Expand Up @@ -229,7 +229,7 @@ protected function readPhpDoc($doc): void
}

try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment);
$phpDoc = DocBlockFactory::createInstance()->create($docComment);

$parsedReturnTag = $phpDoc->getTagsByName('return');

Expand Down
2 changes: 1 addition & 1 deletion src/voku/SimplePhpParser/Model/PHPMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function readObjectFromPhpNode($node, $classStr = null): PHPFunction
$docComment = $node->getDocComment();
if ($docComment) {
try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment->getText());
$phpDoc = DocBlockFactory::createInstance()->create($docComment->getText());
$this->summary = $phpDoc->getSummary();
$this->description = (string) $phpDoc->getDescription();
} catch (\Exception $e) {
Expand Down
2 changes: 1 addition & 1 deletion src/voku/SimplePhpParser/Model/PHPParameter.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ private function readPhpDoc($doc, string $parameterName): void
}

try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment);
$phpDoc = DocBlockFactory::createInstance()->create($docComment);

$parsedParamTags = $phpDoc->getTagsByName('param');

Expand Down
2 changes: 1 addition & 1 deletion src/voku/SimplePhpParser/Model/PHPProperty.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ private function readPhpDoc($doc): void
}

try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment);
$phpDoc = DocBlockFactory::createInstance()->create($docComment);

$parsedParamTags = $phpDoc->getTagsByName('var');

Expand Down
2 changes: 1 addition & 1 deletion src/voku/SimplePhpParser/Model/PHPTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private function readPhpDocProperties($doc): void
}

try {
$phpDoc = Utils::createDocBlockInstance()->create($docComment);
$phpDoc = DocBlockFactory::createInstance()->create($docComment);

$parsedPropertyTags = $phpDoc->getTagsByName('property')
+ $phpDoc->getTagsByName('property-read')
Expand Down