Improve naming for tag factory

This commit is contained in:
Jaapio
2022-10-28 14:39:55 +02:00
parent ece4f5ab18
commit c6f6e2d523
6 changed files with 25 additions and 12 deletions
+3 -2
View File
@@ -13,6 +13,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock; namespace phpDocumentor\Reflection\DocBlock;
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\Utils; use phpDocumentor\Reflection\Utils;
@@ -47,13 +48,13 @@ use const PREG_SPLIT_DELIM_CAPTURE;
*/ */
class DescriptionFactory class DescriptionFactory
{ {
/** @var SimpleTagFactory */ /** @var Factory */
private $tagFactory; private $tagFactory;
/** /**
* Initializes this factory with the means to construct (inline) tags. * Initializes this factory with the means to construct (inline) tags.
*/ */
public function __construct(SimpleTagFactory $tagFactory) public function __construct(Factory $tagFactory)
{ {
$this->tagFactory = $tagFactory; $this->tagFactory = $tagFactory;
} }
+3 -2
View File
@@ -17,6 +17,7 @@ use InvalidArgumentException;
use phpDocumentor\Reflection\DocBlock\Tags\Author; use phpDocumentor\Reflection\DocBlock\Tags\Author;
use phpDocumentor\Reflection\DocBlock\Tags\Covers; use phpDocumentor\Reflection\DocBlock\Tags\Covers;
use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; use phpDocumentor\Reflection\DocBlock\Tags\Deprecated;
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
use phpDocumentor\Reflection\DocBlock\Tags\Generic; use phpDocumentor\Reflection\DocBlock\Tags\Generic;
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; 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`). * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`).
* *
* @return class-string<Tag>|SimpleTagFactory * @return class-string<Tag>|Factory
*/ */
private function findHandlerClassName(string $tagName, TypeContext $context) 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 * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given
* tag handler class name. * tag handler class name.
* *
* @param class-string|SimpleTagFactory $handler * @param class-string|Factory $handler
* *
* @return ReflectionParameter[] * @return ReflectionParameter[]
*/ */
+2 -1
View File
@@ -14,9 +14,10 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock; namespace phpDocumentor\Reflection\DocBlock;
use InvalidArgumentException; use InvalidArgumentException;
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
use phpDocumentor\Reflection\Types\Context as TypeContext; 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. * Adds a parameter to the service locator that can be injected in a tag's factory method.
@@ -13,7 +13,7 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; 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\Tag;
use phpDocumentor\Reflection\DocBlock\TagFactory; use phpDocumentor\Reflection\DocBlock\TagFactory;
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; 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. * @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 PhpDocParser $parser;
private Lexer $lexer; private Lexer $lexer;
@@ -1,4 +1,13 @@
<?php <?php
/*
* This file is part of phpDocumentor.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @link http://phpdoc.org
*
*/
declare(strict_types=1); declare(strict_types=1);
@@ -11,12 +20,13 @@ declare(strict_types=1);
* @link http://phpdoc.org * @link http://phpdoc.org
*/ */
namespace phpDocumentor\Reflection\DocBlock; namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
use InvalidArgumentException; use InvalidArgumentException;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
interface SimpleTagFactory interface Factory
{ {
/** /**
+3 -3
View File
@@ -16,7 +16,7 @@ namespace phpDocumentor\Reflection;
use InvalidArgumentException; use InvalidArgumentException;
use LogicException; use LogicException;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\DocBlock\SimpleTagFactory; use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory;
use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\TagFactory; use phpDocumentor\Reflection\DocBlock\TagFactory;
@@ -42,13 +42,13 @@ final class DocBlockFactory implements DocBlockFactoryInterface
/** @var DocBlock\DescriptionFactory */ /** @var DocBlock\DescriptionFactory */
private $descriptionFactory; private $descriptionFactory;
/** @var DocBlock\SimpleTagFactory */ /** @var \phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory */
private $tagFactory; private $tagFactory;
/** /**
* Initializes this factory with the required subcontractors. * Initializes this factory with the required subcontractors.
*/ */
public function __construct(DescriptionFactory $descriptionFactory, SimpleTagFactory $tagFactory) public function __construct(DescriptionFactory $descriptionFactory, Factory $tagFactory)
{ {
$this->descriptionFactory = $descriptionFactory; $this->descriptionFactory = $descriptionFactory;
$this->tagFactory = $tagFactory; $this->tagFactory = $tagFactory;