mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
+2
-2
@@ -133,7 +133,7 @@ final class DocBlock
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTags()
|
||||
public function getTags(): array
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ final class DocBlock
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTagsByName(string $name)
|
||||
public function getTagsByName(string $name): array
|
||||
{
|
||||
$result = [];
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class Description
|
||||
*
|
||||
* @return Tag[]
|
||||
*/
|
||||
public function getTags()
|
||||
public function getTags(): array
|
||||
{
|
||||
return $this->tags;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ class DescriptionFactory
|
||||
*
|
||||
* @return string[] A series of tokens of which the description text is composed.
|
||||
*/
|
||||
private function lex(string $contents)
|
||||
private function lex(string $contents): array
|
||||
{
|
||||
$contents = $this->removeSuperfluousStartingWhitespace($contents);
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
private function extractTagParts(string $tagLine)
|
||||
private function extractTagParts(string $tagLine): array
|
||||
{
|
||||
$matches = [];
|
||||
if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) {
|
||||
@@ -222,7 +222,7 @@ final class StandardTagFactory implements TagFactory
|
||||
* @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters
|
||||
* is provided with this method.
|
||||
*/
|
||||
private function getArgumentsForParametersFromWiring($parameters, $locator)
|
||||
private function getArgumentsForParametersFromWiring($parameters, $locator): array
|
||||
{
|
||||
$arguments = [];
|
||||
foreach ($parameters as $index => $parameter) {
|
||||
@@ -251,7 +251,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @return \ReflectionParameter[]
|
||||
*/
|
||||
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName)
|
||||
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array
|
||||
{
|
||||
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
||||
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
|
||||
@@ -271,7 +271,7 @@ final class StandardTagFactory implements TagFactory
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody)
|
||||
private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody): array
|
||||
{
|
||||
$locator = array_merge(
|
||||
$this->serviceLocator,
|
||||
|
||||
@@ -47,7 +47,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?FqsenResolver $resolver = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::notEmpty($body);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
@@ -59,7 +59,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod
|
||||
?string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
@@ -81,7 +80,7 @@ final class Example extends BaseTag
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function create(string $body)
|
||||
public static function create(string $body): ?Tag
|
||||
{
|
||||
// File component: File path in quotes or File URI / Source information
|
||||
if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) {
|
||||
|
||||
@@ -49,7 +49,7 @@ class Generic extends BaseTag implements Factory\StaticMethod
|
||||
string $name = '',
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($name);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getArguments()
|
||||
public function getArguments(): array
|
||||
{
|
||||
return $this->arguments;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
. ($this->description ? ' ' . $this->description->render() : ''));
|
||||
}
|
||||
|
||||
private function filterArguments($arguments)
|
||||
private function filterArguments(array $arguments = []): array
|
||||
{
|
||||
foreach ($arguments as &$argument) {
|
||||
if (is_string($argument)) {
|
||||
@@ -227,7 +227,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
return $arguments;
|
||||
}
|
||||
|
||||
private static function stripRestArg($argument)
|
||||
private static function stripRestArg(string $argument): string
|
||||
{
|
||||
if (strpos($argument, '...') === 0) {
|
||||
$argument = trim(substr($argument, 3));
|
||||
|
||||
@@ -53,7 +53,7 @@ final class Param extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class Property extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ final class Url implements Reference
|
||||
/**
|
||||
* Url constructor.
|
||||
*/
|
||||
public function __construct($uri)
|
||||
public function __construct(string $uri)
|
||||
{
|
||||
Assert::stringNotEmpty($uri);
|
||||
$this->uri = $uri;
|
||||
|
||||
@@ -44,7 +44,7 @@ final class Return_ extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
@@ -49,7 +49,7 @@ class See extends BaseTag implements Factory\StaticMethod
|
||||
?FqsenResolver $resolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
@@ -15,7 +15,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
|
||||
|
||||
use phpDocumentor\Reflection\DocBlock\Description;
|
||||
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
|
||||
use phpDocumentor\Reflection\DocBlock\Tag;
|
||||
use phpDocumentor\Reflection\Types\Context as TypeContext;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ final class Source extends BaseTag implements Factory\StaticMethod
|
||||
string $body,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ final class Throws extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
@@ -47,7 +47,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod
|
||||
?FqsenResolver $resolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::allNotNull([$resolver, $descriptionFactory]);
|
||||
|
||||
$parts = preg_split('/\s+/Su', $body, 2);
|
||||
|
||||
@@ -49,7 +49,7 @@ class Var_ extends BaseTag implements Factory\StaticMethod
|
||||
?TypeResolver $typeResolver = null,
|
||||
?DescriptionFactory $descriptionFactory = null,
|
||||
?TypeContext $context = null
|
||||
) {
|
||||
): self {
|
||||
Assert::stringNotEmpty($body);
|
||||
Assert::allNotNull([$typeResolver, $descriptionFactory]);
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
*
|
||||
* @return string[] containing the template marker (if any), summary, description and a string containing the tags.
|
||||
*/
|
||||
private function splitDocBlock(string $comment)
|
||||
private function splitDocBlock(string $comment): array
|
||||
{
|
||||
// Performance improvement cheat: if the first character is an @ then only tags are in this DocBlock. This
|
||||
// method does not split tags so we return this verbatim as the fourth result (tags). This saves us the
|
||||
@@ -227,7 +227,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
private function splitTagBlockIntoTagLines(string $tags)
|
||||
private function splitTagBlockIntoTagLines(string $tags): array
|
||||
{
|
||||
$result = [];
|
||||
foreach (explode("\n", $tags) as $tag_line) {
|
||||
|
||||
Reference in New Issue
Block a user