mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 18:13:13 +00:00
Fix some php8+ issues
This commit is contained in:
+1
-4
@@ -10,13 +10,10 @@
|
|||||||
|
|
||||||
<!-- Set the minimum PHP version for PHPCompatibility.
|
<!-- Set the minimum PHP version for PHPCompatibility.
|
||||||
This should be kept in sync with the requirements in the composer.json file. -->
|
This should be kept in sync with the requirements in the composer.json file. -->
|
||||||
<config name="testVersion" value="7.2-"/>
|
<config name="testVersion" value="7.4-"/>
|
||||||
|
|
||||||
<rule ref="phpDocumentor">
|
<rule ref="phpDocumentor">
|
||||||
<exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException" />
|
<exclude name="SlevomatCodingStandard.Exceptions.ReferenceThrowableOnly.ReferencedGeneralException" />
|
||||||
|
|
||||||
<!-- Property type declarations are a PHP 7.4 feature. -->
|
|
||||||
<exclude name="SlevomatCodingStandard.TypeHints.PropertyTypeHint.MissingNativeTypeHint"/>
|
|
||||||
</rule>
|
</rule>
|
||||||
|
|
||||||
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
|
<rule ref="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming.SuperfluousPrefix">
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ use ReflectionNamedType;
|
|||||||
use ReflectionParameter;
|
use ReflectionParameter;
|
||||||
use Webmozart\Assert\Assert;
|
use Webmozart\Assert\Assert;
|
||||||
|
|
||||||
|
use function array_key_exists;
|
||||||
use function array_merge;
|
use function array_merge;
|
||||||
use function array_slice;
|
use function array_slice;
|
||||||
use function call_user_func_array;
|
use function call_user_func_array;
|
||||||
@@ -48,6 +49,7 @@ use function count;
|
|||||||
use function get_class;
|
use function get_class;
|
||||||
use function is_object;
|
use function is_object;
|
||||||
use function preg_match;
|
use function preg_match;
|
||||||
|
use function sprintf;
|
||||||
use function strpos;
|
use function strpos;
|
||||||
use function trim;
|
use function trim;
|
||||||
|
|
||||||
@@ -164,6 +166,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
$this->serviceLocator[$alias ?: get_class($service)] = $service;
|
$this->serviceLocator[$alias ?: get_class($service)] = $service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** {@inheritDoc} */
|
||||||
public function registerTagHandler(string $tagName, $handler): void
|
public function registerTagHandler(string $tagName, $handler): void
|
||||||
{
|
{
|
||||||
Assert::stringNotEmpty($tagName);
|
Assert::stringNotEmpty($tagName);
|
||||||
@@ -176,6 +179,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
if (is_object($handler)) {
|
if (is_object($handler)) {
|
||||||
Assert::implementsInterface($handler, TagFactory::class);
|
Assert::implementsInterface($handler, TagFactory::class);
|
||||||
$this->tagHandlerMappings[$tagName] = $handler;
|
$this->tagHandlerMappings[$tagName] = $handler;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,7 +221,9 @@ final class StandardTagFactory implements TagFactory
|
|||||||
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
|
$this->getServiceLocatorWithDynamicParameters($context, $name, $body)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (array_key_exists('tagLine', $arguments)) {
|
||||||
$arguments['tagLine'] = sprintf('@%s %s', $name, $body);
|
$arguments['tagLine'] = sprintf('@%s %s', $name, $body);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$callable = [$handlerClassName, 'create'];
|
$callable = [$handlerClassName, 'create'];
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ namespace phpDocumentor\Reflection\DocBlock;
|
|||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
|
||||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
|
||||||
|
|
||||||
interface TagFactory extends Factory
|
interface TagFactory extends Factory
|
||||||
{
|
{
|
||||||
@@ -61,7 +60,7 @@ interface TagFactory extends Factory
|
|||||||
*
|
*
|
||||||
* @param string $tagName Name of tag to register a handler for. When registering a namespaced
|
* @param string $tagName Name of tag to register a handler for. When registering a namespaced
|
||||||
* tag, the full name, along with a prefixing slash MUST be provided.
|
* tag, the full name, along with a prefixing slash MUST be provided.
|
||||||
* @param class-string<Tag> $handler FQCN of handler.
|
* @param class-string<Tag>|Factory $handler FQCN of handler.
|
||||||
*
|
*
|
||||||
* @throws InvalidArgumentException If the tag name is not a string.
|
* @throws InvalidArgumentException If the tag name is not a string.
|
||||||
* @throws InvalidArgumentException If the tag name is namespaced (contains backslashes) but
|
* @throws InvalidArgumentException If the tag name is namespaced (contains backslashes) but
|
||||||
@@ -70,5 +69,5 @@ interface TagFactory extends Factory
|
|||||||
* @throws InvalidArgumentException If the handler is not an existing class.
|
* @throws InvalidArgumentException If the handler is not an existing class.
|
||||||
* @throws InvalidArgumentException If the handler does not implement the {@see Tag} interface.
|
* @throws InvalidArgumentException If the handler does not implement the {@see Tag} interface.
|
||||||
*/
|
*/
|
||||||
public function registerTagHandler(string $tagName, string $handler): void;
|
public function registerTagHandler(string $tagName, $handler): void;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
|
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
|
||||||
|
|
||||||
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\Tags\InvalidTag;
|
use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag;
|
||||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||||
use PHPStan\PhpDocParser\Lexer\Lexer;
|
use PHPStan\PhpDocParser\Lexer\Lexer;
|
||||||
@@ -36,6 +34,7 @@ class AbstractPHPStanFactory implements Factory
|
|||||||
{
|
{
|
||||||
private PhpDocParser $parser;
|
private PhpDocParser $parser;
|
||||||
private Lexer $lexer;
|
private Lexer $lexer;
|
||||||
|
/** @var PHPStanFactory[] */
|
||||||
private array $factories;
|
private array $factories;
|
||||||
|
|
||||||
public function __construct(PHPStanFactory ...$factories)
|
public function __construct(PHPStanFactory ...$factories)
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ use phpDocumentor\Reflection\Types\Context as TypeContext;
|
|||||||
|
|
||||||
interface Factory
|
interface Factory
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Factory method responsible for instantiating the correct sub type.
|
* Factory method responsible for instantiating the correct sub type.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ 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\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;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\AbstractPHPStanFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\AbstractPHPStanFactory;
|
||||||
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\ParamFactory;
|
||||||
use phpDocumentor\Reflection\DocBlock\Tags\Factory\TypeFactory;
|
use phpDocumentor\Reflection\DocBlock\Tags\Factory\TypeFactory;
|
||||||
use Webmozart\Assert\Assert;
|
use Webmozart\Assert\Assert;
|
||||||
@@ -42,7 +42,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
|||||||
/** @var DocBlock\DescriptionFactory */
|
/** @var DocBlock\DescriptionFactory */
|
||||||
private $descriptionFactory;
|
private $descriptionFactory;
|
||||||
|
|
||||||
/** @var \phpDocumentor\Reflection\DocBlock\Tags\Factory\Factory */
|
/** @var Factory */
|
||||||
private $tagFactory;
|
private $tagFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user