diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 1a519ec..9635709 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -47,13 +47,13 @@ use const PREG_SPLIT_DELIM_CAPTURE; */ class DescriptionFactory { - /** @var TagFactory */ + /** @var SimpleTagFactory */ private $tagFactory; /** * Initializes this factory with the means to construct (inline) tags. */ - public function __construct(TagFactory $tagFactory) + public function __construct(SimpleTagFactory $tagFactory) { $this->tagFactory = $tagFactory; } diff --git a/src/DocBlock/SimpleTagFactory.php b/src/DocBlock/SimpleTagFactory.php new file mode 100644 index 0000000..4f5c42f --- /dev/null +++ b/src/DocBlock/SimpleTagFactory.php @@ -0,0 +1,32 @@ +|TagFactory + * @return class-string|SimpleTagFactory */ private function findHandlerClassName(string $tagName, TypeContext $context) { @@ -297,7 +297,7 @@ final class StandardTagFactory implements TagFactory * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given * tag handler class name. * - * @param class-string|TagFactory $handler + * @param class-string|SimpleTagFactory $handler * * @return ReflectionParameter[] */ diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index c0868dc..f394a8a 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -16,7 +16,7 @@ namespace phpDocumentor\Reflection\DocBlock; use InvalidArgumentException; use phpDocumentor\Reflection\Types\Context as TypeContext; -interface TagFactory +interface TagFactory extends SimpleTagFactory { /** * Adds a parameter to the service locator that can be injected in a tag's factory method. @@ -40,17 +40,6 @@ interface TagFactory */ public function addParameter(string $name, $value): void; - /** - * Factory method responsible for instantiating the correct sub type. - * - * @param string $tagLine The text for this tag, including description. - * - * @return Tag A new tag object. - * - * @throws InvalidArgumentException If an invalid tag line was presented. - */ - public function create(string $tagLine, ?TypeContext $context = null): Tag; - /** * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. * diff --git a/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php b/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php index 4e4ae3c..d30df1c 100644 --- a/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php +++ b/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php @@ -13,6 +13,7 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; +use phpDocumentor\Reflection\DocBlock\SimpleTagFactory; use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; @@ -31,7 +32,7 @@ use PHPStan\PhpDocParser\Parser\TypeParser; * * @internal This class is not part of the BC promise of this library. */ -class AbstractPHPStanFactory implements TagFactory +class AbstractPHPStanFactory implements SimpleTagFactory { private PhpDocParser $parser; private Lexer $lexer; @@ -45,11 +46,6 @@ class AbstractPHPStanFactory implements TagFactory $this->factories = $factories; } - public function addParameter(string $name, $value): void - { - // TODO: Implement addParameter() method. - } - public function create(string $tagLine, ?TypeContext $context = null): Tag { $tokens = $this->lexer->tokenize($tagLine); @@ -66,14 +62,4 @@ class AbstractPHPStanFactory implements TagFactory (string) $ast->value ); } - - public function addService(object $service): void - { - // TODO: Implement addService() method. - } - - public function registerTagHandler(string $tagName, string $handler): void - { - // TODO: Implement registerTagHandler() method. - } } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 2a05ac7..84dca51 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -16,6 +16,7 @@ namespace phpDocumentor\Reflection; use InvalidArgumentException; use LogicException; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\DocBlock\SimpleTagFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; @@ -41,13 +42,13 @@ final class DocBlockFactory implements DocBlockFactoryInterface /** @var DocBlock\DescriptionFactory */ private $descriptionFactory; - /** @var DocBlock\TagFactory */ + /** @var DocBlock\SimpleTagFactory */ private $tagFactory; /** * Initializes this factory with the required subcontractors. */ - public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory) + public function __construct(DescriptionFactory $descriptionFactory, SimpleTagFactory $tagFactory) { $this->descriptionFactory = $descriptionFactory; $this->tagFactory = $tagFactory;