From c6f6e2d52328b0c8f5979c6ca5bc4df4d463bd2c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 28 Oct 2022 14:39:55 +0200 Subject: [PATCH] Improve naming for tag factory --- src/DocBlock/DescriptionFactory.php | 5 +++-- src/DocBlock/StandardTagFactory.php | 5 +++-- src/DocBlock/TagFactory.php | 3 ++- .../Tags/Factory/AbstractPHPStanFactory.php | 4 ++-- .../Factory/Factory.php} | 14 ++++++++++++-- src/DocBlockFactory.php | 6 +++--- 6 files changed, 25 insertions(+), 12 deletions(-) rename src/DocBlock/{SimpleTagFactory.php => Tags/Factory/Factory.php} (68%) diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 9635709..d018018 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -13,6 +13,7 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Utils; @@ -47,13 +48,13 @@ use const PREG_SPLIT_DELIM_CAPTURE; */ class DescriptionFactory { - /** @var SimpleTagFactory */ + /** @var Factory */ private $tagFactory; /** * Initializes this factory with the means to construct (inline) tags. */ - public function __construct(SimpleTagFactory $tagFactory) + public function __construct(Factory $tagFactory) { $this->tagFactory = $tagFactory; } diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 5bb0ac9..b728d58 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -17,6 +17,7 @@ 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; @@ -233,7 +234,7 @@ final class StandardTagFactory implements TagFactory /** * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). * - * @return class-string|SimpleTagFactory + * @return class-string|Factory */ private function findHandlerClassName(string $tagName, TypeContext $context) { @@ -297,7 +298,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|SimpleTagFactory $handler + * @param class-string|Factory $handler * * @return ReflectionParameter[] */ diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index f394a8a..9dec799 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -14,9 +14,10 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock; use InvalidArgumentException; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; use phpDocumentor\Reflection\Types\Context as TypeContext; -interface TagFactory extends SimpleTagFactory +interface TagFactory extends Factory { /** * Adds a parameter to the service locator that can be injected in a tag's factory method. diff --git a/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php b/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php index d30df1c..281cbbc 100644 --- a/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php +++ b/src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php @@ -13,7 +13,7 @@ declare(strict_types=1); namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; -use phpDocumentor\Reflection\DocBlock\SimpleTagFactory; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory; use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; @@ -32,7 +32,7 @@ use PHPStan\PhpDocParser\Parser\TypeParser; * * @internal This class is not part of the BC promise of this library. */ -class AbstractPHPStanFactory implements SimpleTagFactory +class AbstractPHPStanFactory implements Factory { private PhpDocParser $parser; private Lexer $lexer; diff --git a/src/DocBlock/SimpleTagFactory.php b/src/DocBlock/Tags/Factory/Factory.php similarity index 68% rename from src/DocBlock/SimpleTagFactory.php rename to src/DocBlock/Tags/Factory/Factory.php index 4f5c42f..a8c94b6 100644 --- a/src/DocBlock/SimpleTagFactory.php +++ b/src/DocBlock/Tags/Factory/Factory.php @@ -1,4 +1,13 @@ descriptionFactory = $descriptionFactory; $this->tagFactory = $tagFactory;