diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index ecafe74..e9537a5 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -13,47 +13,47 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock; -use function trim; -use function count; -use function strpos; -use function sprintf; +use InvalidArgumentException; +use phpDocumentor\Reflection\DocBlock\Tags\Author; +use phpDocumentor\Reflection\DocBlock\Tags\Covers; +use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; +use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; +use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; +use phpDocumentor\Reflection\DocBlock\Tags\Method; +use phpDocumentor\Reflection\DocBlock\Tags\Mixin; +use phpDocumentor\Reflection\DocBlock\Tags\Param; +use phpDocumentor\Reflection\DocBlock\Tags\Property; +use phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; +use phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; +use phpDocumentor\Reflection\DocBlock\Tags\Return_; +use phpDocumentor\Reflection\DocBlock\Tags\See as SeeTag; +use phpDocumentor\Reflection\DocBlock\Tags\Since; +use phpDocumentor\Reflection\DocBlock\Tags\Source; +use phpDocumentor\Reflection\DocBlock\Tags\TemplateCovariant; +use phpDocumentor\Reflection\DocBlock\Tags\Throws; +use phpDocumentor\Reflection\DocBlock\Tags\Uses; +use phpDocumentor\Reflection\DocBlock\Tags\Var_; +use phpDocumentor\Reflection\DocBlock\Tags\Version; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; use ReflectionMethod; +use ReflectionNamedType; +use ReflectionParameter; +use Webmozart\Assert\Assert; + +use function array_key_exists; +use function array_merge; +use function array_slice; +use function call_user_func_array; +use function count; use function get_class; use function is_object; use function preg_match; -use ReflectionNamedType; -use ReflectionParameter; -use function array_merge; -use function array_slice; -use Webmozart\Assert\Assert; -use InvalidArgumentException; -use function array_key_exists; -use function call_user_func_array; -use phpDocumentor\Reflection\FqsenResolver; -use phpDocumentor\Reflection\DocBlock\Tags\Uses; -use phpDocumentor\Reflection\DocBlock\Tags\Var_; -use phpDocumentor\Reflection\DocBlock\Tags\Mixin; -use phpDocumentor\Reflection\DocBlock\Tags\Param; -use phpDocumentor\Reflection\DocBlock\Tags\Since; -use phpDocumentor\Reflection\DocBlock\Tags\Author; -use phpDocumentor\Reflection\DocBlock\Tags\Covers; -use phpDocumentor\Reflection\DocBlock\Tags\Method; -use phpDocumentor\Reflection\DocBlock\Tags\Source; -use phpDocumentor\Reflection\DocBlock\Tags\Throws; -use phpDocumentor\Reflection\DocBlock\Tags\Generic; - -use phpDocumentor\Reflection\DocBlock\Tags\Return_; -use phpDocumentor\Reflection\DocBlock\Tags\Version; -use phpDocumentor\Reflection\DocBlock\Tags\Property; -use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; -use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; -use phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; -use phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; -use phpDocumentor\Reflection\DocBlock\Tags\See as SeeTag; -use phpDocumentor\Reflection\Types\Context as TypeContext; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; -use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; -use phpDocumentor\Reflection\DocBlock\Tags\TemplateCovariant; +use function sprintf; +use function strpos; +use function trim; /** * Creates a Tag object given the contents of a tag. diff --git a/src/DocBlock/Tags/Extends_.php b/src/DocBlock/Tags/Extends_.php index 7d54a88..831af03 100644 --- a/src/DocBlock/Tags/Extends_.php +++ b/src/DocBlock/Tags/Extends_.php @@ -14,14 +14,14 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags; use Doctrine\Deprecations\Deprecation; -use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\DocBlock\Description; -use phpDocumentor\Reflection\DocBlock\Tags\TagWithType; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\Type; /** * Reflection class for a {@}extends tag in a Docblock. */ -class Extends_ extends TagWithType +class Extends_ extends TagWithType { public function __construct(Type $type, ?Description $description = null) { @@ -34,7 +34,7 @@ class Extends_ extends TagWithType * @deprecated Create using static factory is deprecated, * this method should not be called directly by library consumers */ - public static function create(string $body) + public static function create(string $body): ?Tag { Deprecation::trigger( 'phpdocumentor/reflection-docblock', @@ -42,6 +42,7 @@ class Extends_ extends TagWithType 'Create using static factory is deprecated, this method should not be called directly by library consumers', ); + return null; } } diff --git a/src/DocBlock/Tags/Factory/AbstractExtendsFactory.php b/src/DocBlock/Tags/Factory/AbstractExtendsFactory.php deleted file mode 100644 index 3325f2f..0000000 --- a/src/DocBlock/Tags/Factory/AbstractExtendsFactory.php +++ /dev/null @@ -1,32 +0,0 @@ -descriptionFactory = $descriptionFactory; - $this->typeResolver = $typeResolver; - } - - public function supports(PhpDocTagNode $node, Context $context): bool - { - return $node->value instanceof ExtendsTagValueNode && $node->name === $this->tagName; - } -} diff --git a/src/DocBlock/Tags/Factory/AbstractImplementsFactory.php b/src/DocBlock/Tags/Factory/AbstractImplementsFactory.php index 45341cf..7c70de8 100644 --- a/src/DocBlock/Tags/Factory/AbstractImplementsFactory.php +++ b/src/DocBlock/Tags/Factory/AbstractImplementsFactory.php @@ -4,29 +4,16 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; -use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; /** * @internal This class is not part of the BC promise of this library. */ abstract class AbstractImplementsFactory implements PHPStanFactory { - private DescriptionFactory $descriptionFactory; - private TypeResolver $typeResolver; - protected string $tagName; - public function __construct(TypeResolver $typeResolver, DescriptionFactory $descriptionFactory) - { - $this->descriptionFactory = $descriptionFactory; - $this->typeResolver = $typeResolver; - } - - public function supports(PhpDocTagNode $node, Context $context): bool - { - return $node->value instanceof ImplementsTagValueNode && $node->name === $this->tagName; - } } diff --git a/src/DocBlock/Tags/Factory/ExtendsFactory.php b/src/DocBlock/Tags/Factory/ExtendsFactory.php index 37d36b0..9a5528d 100644 --- a/src/DocBlock/Tags/Factory/ExtendsFactory.php +++ b/src/DocBlock/Tags/Factory/ExtendsFactory.php @@ -4,24 +4,34 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; -use Webmozart\Assert\Assert; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Extends_; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; -use phpDocumentor\Reflection\DocBlock\Tags\Extends_; use PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode; -use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use Webmozart\Assert\Assert; + +use function is_string; /** * @internal This class is not part of the BC promise of this library. */ -final class ExtendsFactory extends AbstractExtendsFactory +final class ExtendsFactory implements PHPStanFactory { + private DescriptionFactory $descriptionFactory; + private TypeResolver $typeResolver; + public function __construct(TypeResolver $typeResolver, DescriptionFactory $descriptionFactory) { - parent::__construct($typeResolver, $descriptionFactory); - $this->tagName = '@extends'; + $this->descriptionFactory = $descriptionFactory; + $this->typeResolver = $typeResolver; + } + + public function supports(PhpDocTagNode $node, Context $context): bool + { + return $node->value instanceof ExtendsTagValueNode && $node->name === '@extends'; } public function create(PhpDocTagNode $node, Context $context): Tag @@ -36,7 +46,7 @@ final class ExtendsFactory extends AbstractExtendsFactory return new Extends_( $this->typeResolver->createType($tagValue->type, $context), - $this->descriptionFactory->create($description, $context) + $this->descriptionFactory->create($description, $context) ); } } diff --git a/src/DocBlock/Tags/Factory/ImplementsFactory.php b/src/DocBlock/Tags/Factory/ImplementsFactory.php index e6266a2..70b72a1 100644 --- a/src/DocBlock/Tags/Factory/ImplementsFactory.php +++ b/src/DocBlock/Tags/Factory/ImplementsFactory.php @@ -4,24 +4,34 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; -use Webmozart\Assert\Assert; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Implements_; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; -use phpDocumentor\Reflection\DocBlock\Tags\Implements_; -use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use Webmozart\Assert\Assert; + +use function is_string; /** * @internal This class is not part of the BC promise of this library. */ final class ImplementsFactory extends AbstractImplementsFactory { + private DescriptionFactory $descriptionFactory; + private TypeResolver $typeResolver; + public function __construct(TypeResolver $typeResolver, DescriptionFactory $descriptionFactory) { - parent::__construct($typeResolver, $descriptionFactory); - $this->tagName = '@implements'; + $this->descriptionFactory = $descriptionFactory; + $this->typeResolver = $typeResolver; + } + + public function supports(PhpDocTagNode $node, Context $context): bool + { + return $node->value instanceof ImplementsTagValueNode && $node->name === '@implements'; } public function create(PhpDocTagNode $node, Context $context): Tag @@ -36,7 +46,7 @@ final class ImplementsFactory extends AbstractImplementsFactory return new Implements_( $this->typeResolver->createType($tagValue->type, $context), - $this->descriptionFactory->create($description, $context) + $this->descriptionFactory->create($description, $context) ); } } diff --git a/src/DocBlock/Tags/Factory/TemplateExtendsFactory.php b/src/DocBlock/Tags/Factory/TemplateExtendsFactory.php index 97475f7..e23444a 100644 --- a/src/DocBlock/Tags/Factory/TemplateExtendsFactory.php +++ b/src/DocBlock/Tags/Factory/TemplateExtendsFactory.php @@ -4,24 +4,34 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; -use Webmozart\Assert\Assert; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\TemplateExtends; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; use PHPStan\PhpDocParser\Ast\PhpDoc\ExtendsTagValueNode; -use phpDocumentor\Reflection\DocBlock\DescriptionFactory; -use phpDocumentor\Reflection\DocBlock\Tags\TemplateExtends; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use Webmozart\Assert\Assert; + +use function is_string; /** * @internal This class is not part of the BC promise of this library. */ -final class TemplateExtendsFactory extends AbstractExtendsFactory +final class TemplateExtendsFactory implements PHPStanFactory { + private DescriptionFactory $descriptionFactory; + private TypeResolver $typeResolver; + public function __construct(TypeResolver $typeResolver, DescriptionFactory $descriptionFactory) { - parent::__construct($typeResolver, $descriptionFactory); - $this->tagName = '@template-extends'; + $this->descriptionFactory = $descriptionFactory; + $this->typeResolver = $typeResolver; + } + + public function supports(PhpDocTagNode $node, Context $context): bool + { + return $node->value instanceof ExtendsTagValueNode && $node->name === '@template-extends'; } public function create(PhpDocTagNode $node, Context $context): Tag @@ -36,7 +46,7 @@ final class TemplateExtendsFactory extends AbstractExtendsFactory return new TemplateExtends( $this->typeResolver->createType($tagValue->type, $context), - $this->descriptionFactory->create($description, $context) + $this->descriptionFactory->create($description, $context) ); } } diff --git a/src/DocBlock/Tags/Factory/TemplateFactory.php b/src/DocBlock/Tags/Factory/TemplateFactory.php index 3c1aafd..d2a4e94 100644 --- a/src/DocBlock/Tags/Factory/TemplateFactory.php +++ b/src/DocBlock/Tags/Factory/TemplateFactory.php @@ -4,14 +4,16 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; -use Webmozart\Assert\Assert; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\Template; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; -use phpDocumentor\Reflection\DocBlock\Tags\Template; -use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use PHPStan\PhpDocParser\Ast\PhpDoc\TemplateTagValueNode; +use Webmozart\Assert\Assert; + +use function is_string; /** * @internal This class is not part of the BC promise of this library. @@ -30,7 +32,12 @@ final class TemplateFactory implements PHPStanFactory public function create(PhpDocTagNode $node, Context $context): Tag { $tagValue = $node->value; + Assert::isInstanceOf($tagValue, TemplateTagValueNode::class); + $name = $tagValue->name; + if ($name === '') { + throw new \InvalidArgumentException('Template name cannot be empty'); + } $description = $tagValue->getAttribute('description'); if (is_string($description) === false) { @@ -38,10 +45,10 @@ final class TemplateFactory implements PHPStanFactory } return new Template( - $tagValue->name, + $name, $this->typeResolver->createType($tagValue->bound, $context), $this->typeResolver->createType($tagValue->default, $context), - $this->descriptionFactory->create($description, $context) + $this->descriptionFactory->create($description, $context) ); } diff --git a/src/DocBlock/Tags/Factory/TemplateImplementsFactory.php b/src/DocBlock/Tags/Factory/TemplateImplementsFactory.php index 0f69981..b01fd90 100644 --- a/src/DocBlock/Tags/Factory/TemplateImplementsFactory.php +++ b/src/DocBlock/Tags/Factory/TemplateImplementsFactory.php @@ -4,24 +4,34 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; -use Webmozart\Assert\Assert; +use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\Tags\TemplateImplements; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context; -use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; -use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use PHPStan\PhpDocParser\Ast\PhpDoc\ImplementsTagValueNode; -use phpDocumentor\Reflection\DocBlock\Tags\TemplateImplements; +use PHPStan\PhpDocParser\Ast\PhpDoc\PhpDocTagNode; +use Webmozart\Assert\Assert; + +use function is_string; /** * @internal This class is not part of the BC promise of this library. */ final class TemplateImplementsFactory extends AbstractImplementsFactory { + private DescriptionFactory $descriptionFactory; + private TypeResolver $typeResolver; + public function __construct(TypeResolver $typeResolver, DescriptionFactory $descriptionFactory) { - parent::__construct($typeResolver, $descriptionFactory); - $this->tagName = '@template-implements'; + $this->descriptionFactory = $descriptionFactory; + $this->typeResolver = $typeResolver; + } + + public function supports(PhpDocTagNode $node, Context $context): bool + { + return $node->value instanceof ImplementsTagValueNode && $node->name === '@template-implements'; } public function create(PhpDocTagNode $node, Context $context): Tag @@ -36,7 +46,7 @@ final class TemplateImplementsFactory extends AbstractImplementsFactory return new TemplateImplements( $this->typeResolver->createType($tagValue->type, $context), - $this->descriptionFactory->create($description, $context) + $this->descriptionFactory->create($description, $context) ); } } diff --git a/src/DocBlock/Tags/Implements_.php b/src/DocBlock/Tags/Implements_.php index a871d43..2070828 100644 --- a/src/DocBlock/Tags/Implements_.php +++ b/src/DocBlock/Tags/Implements_.php @@ -14,14 +14,14 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags; use Doctrine\Deprecations\Deprecation; -use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\DocBlock\Description; -use phpDocumentor\Reflection\DocBlock\Tags\TagWithType; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\Type; /** * Reflection class for a {@}implements tag in a Docblock. */ -class Implements_ extends TagWithType +class Implements_ extends TagWithType { public function __construct(Type $type, ?Description $description = null) { @@ -34,7 +34,7 @@ class Implements_ extends TagWithType * @deprecated Create using static factory is deprecated, * this method should not be called directly by library consumers */ - public static function create(string $body) + public static function create(string $body): ?Tag { Deprecation::trigger( 'phpdocumentor/reflection-docblock', @@ -42,6 +42,7 @@ class Implements_ extends TagWithType 'Create using static factory is deprecated, this method should not be called directly by library consumers', ); + return null; } } diff --git a/src/DocBlock/Tags/Template.php b/src/DocBlock/Tags/Template.php index b5c7bc5..e6d9a7e 100644 --- a/src/DocBlock/Tags/Template.php +++ b/src/DocBlock/Tags/Template.php @@ -14,38 +14,42 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags; use Doctrine\Deprecations\Deprecation; -use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\DocBlock\Description; -use phpDocumentor\Reflection\DocBlock\Tags\TagWithType; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\Type; /** * Reflection class for a {@}template tag in a Docblock. */ -final class Template extends TagWithType +final class Template extends TagWithType { - /** @var non-empty-string */ - private $templateName; + /** @var non-empty-string */ + private string $templateName; - /** @var ?Type The real type */ - private $bound; + /** @var ?Type The real type */ + private ?Type $bound; - /** @var ?Type */ - private $default; + private ?Type $default; - public function __construct(string $templateName, ?Type $bound = null, ?Type $default = null, ?Description $description = null) - { - $this->name = 'template'; + /** @param non-empty-string $templateName */ + public function __construct( + string $templateName, + ?Type $bound = null, + ?Type $default = null, + ?Description $description = null + ) { + $this->name = 'template'; $this->templateName = $templateName; - $this->bound = $bound; - $this->default = $default; - $this->description = $description; + $this->bound = $bound; + $this->default = $default; + $this->description = $description; } /** * @deprecated Create using static factory is deprecated, * this method should not be called directly by library consumers */ - public static function create(string $body) + public static function create(string $body): ?Tag { Deprecation::trigger( 'phpdocumentor/reflection-docblock', @@ -53,6 +57,7 @@ final class Template extends TagWithType 'Create using static factory is deprecated, this method should not be called directly by library consumers', ); + return null; } @@ -73,8 +78,8 @@ final class Template extends TagWithType public function __toString(): string { - $bound = $this->bound !== null ? " of {$this->bound}" : ''; - $default = $this->default !== null ? " = {$this->default}" : ''; + $bound = $this->bound !== null ? ' of ' . $this->bound : ''; + $default = $this->default !== null ? ' = ' . $this->default : ''; if ($this->description) { $description = $this->description->render(); diff --git a/src/DocBlock/Tags/TemplateExtends.php b/src/DocBlock/Tags/TemplateExtends.php index 4c9b257..8de4681 100644 --- a/src/DocBlock/Tags/TemplateExtends.php +++ b/src/DocBlock/Tags/TemplateExtends.php @@ -13,13 +13,13 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\Type; /** * Reflection class for a {@}template-extends tag in a Docblock. */ -final class TemplateExtends extends Extends_ +final class TemplateExtends extends Extends_ { public function __construct(Type $type, ?Description $description = null) { diff --git a/src/DocBlock/Tags/TemplateImplements.php b/src/DocBlock/Tags/TemplateImplements.php index d6cd689..1fb073d 100644 --- a/src/DocBlock/Tags/TemplateImplements.php +++ b/src/DocBlock/Tags/TemplateImplements.php @@ -13,13 +13,13 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\DocBlock\Description; +use phpDocumentor\Reflection\Type; /** * Reflection class for a {@}template-implements tag in a Docblock. */ -final class TemplateImplements extends Implements_ +final class TemplateImplements extends Implements_ { public function __construct(Type $type, ?Description $description = null) { diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 408fbc3..ca33fbb 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -13,39 +13,39 @@ declare(strict_types=1); namespace phpDocumentor\Reflection; -use LogicException; use InvalidArgumentException; -use Webmozart\Assert\Assert; -use phpDocumentor\Reflection\DocBlock\Tag; -use phpDocumentor\Reflection\DocBlock\TagFactory; +use LogicException; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\VarFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\ReturnFactory; +use phpDocumentor\Reflection\DocBlock\Tag; +use phpDocumentor\Reflection\DocBlock\TagFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\AbstractPHPStanFactory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\ExtendsFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\ImplementsFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyFactory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyReadFactory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\PropertyWriteFactory; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\AbstractPHPStanFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\ReturnFactory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateExtendsFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateFactory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\TemplateImplementsFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\VarFactory; +use Webmozart\Assert\Assert; -use function trim; +use function array_shift; use function count; -use function strpos; -use function substr; use function explode; use function is_object; -use function preg_match; -use function array_shift; -use function str_replace; -use function preg_replace; use function method_exists; +use function preg_match; +use function preg_replace; +use function str_replace; +use function strpos; +use function substr; +use function trim; final class DocBlockFactory implements DocBlockFactoryInterface {