mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
add missing typehints and return types;
This commit is contained in:
+2
-2
@@ -133,7 +133,7 @@ final class DocBlock
|
|||||||
*
|
*
|
||||||
* @return Tag[]
|
* @return Tag[]
|
||||||
*/
|
*/
|
||||||
public function getTags()
|
public function getTags(): array
|
||||||
{
|
{
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ final class DocBlock
|
|||||||
*
|
*
|
||||||
* @return Tag[]
|
* @return Tag[]
|
||||||
*/
|
*/
|
||||||
public function getTagsByName(string $name)
|
public function getTagsByName(string $name): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ class Description
|
|||||||
*
|
*
|
||||||
* @return Tag[]
|
* @return Tag[]
|
||||||
*/
|
*/
|
||||||
public function getTags()
|
public function getTags(): array
|
||||||
{
|
{
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class DescriptionFactory
|
|||||||
*
|
*
|
||||||
* @return string[] A series of tokens of which the description text is composed.
|
* @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);
|
$contents = $this->removeSuperfluousStartingWhitespace($contents);
|
||||||
|
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function extractTagParts(string $tagLine)
|
private function extractTagParts(string $tagLine): array
|
||||||
{
|
{
|
||||||
$matches = [];
|
$matches = [];
|
||||||
if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $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
|
* @return mixed[] A series of values that can be passed to the Factory Method of the tag whose parameters
|
||||||
* is provided with this method.
|
* is provided with this method.
|
||||||
*/
|
*/
|
||||||
private function getArgumentsForParametersFromWiring($parameters, $locator)
|
private function getArgumentsForParametersFromWiring($parameters, $locator): array
|
||||||
{
|
{
|
||||||
$arguments = [];
|
$arguments = [];
|
||||||
foreach ($parameters as $index => $parameter) {
|
foreach ($parameters as $index => $parameter) {
|
||||||
@@ -251,7 +251,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
*
|
*
|
||||||
* @return \ReflectionParameter[]
|
* @return \ReflectionParameter[]
|
||||||
*/
|
*/
|
||||||
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName)
|
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array
|
||||||
{
|
{
|
||||||
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
|
||||||
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
|
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
|
||||||
@@ -271,7 +271,7 @@ final class StandardTagFactory implements TagFactory
|
|||||||
*
|
*
|
||||||
* @return mixed[]
|
* @return mixed[]
|
||||||
*/
|
*/
|
||||||
private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody)
|
private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody): array
|
||||||
{
|
{
|
||||||
$locator = array_merge(
|
$locator = array_merge(
|
||||||
$this->serviceLocator,
|
$this->serviceLocator,
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ final class Example extends BaseTag
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@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
|
// File component: File path in quotes or File URI / Source information
|
||||||
if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) {
|
if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) {
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
/**
|
/**
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getArguments()
|
public function getArguments(): array
|
||||||
{
|
{
|
||||||
return $this->arguments;
|
return $this->arguments;
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
. ($this->description ? ' ' . $this->description->render() : ''));
|
. ($this->description ? ' ' . $this->description->render() : ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function filterArguments($arguments)
|
private function filterArguments(array $arguments = []): array
|
||||||
{
|
{
|
||||||
foreach ($arguments as &$argument) {
|
foreach ($arguments as &$argument) {
|
||||||
if (is_string($argument)) {
|
if (is_string($argument)) {
|
||||||
@@ -227,7 +227,7 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
|||||||
return $arguments;
|
return $arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static function stripRestArg($argument)
|
private static function stripRestArg(string $argument): string
|
||||||
{
|
{
|
||||||
if (strpos($argument, '...') === 0) {
|
if (strpos($argument, '...') === 0) {
|
||||||
$argument = trim(substr($argument, 3));
|
$argument = trim(substr($argument, 3));
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ final class Url implements Reference
|
|||||||
/**
|
/**
|
||||||
* Url constructor.
|
* Url constructor.
|
||||||
*/
|
*/
|
||||||
public function __construct($uri)
|
public function __construct(string $uri)
|
||||||
{
|
{
|
||||||
Assert::stringNotEmpty($uri);
|
Assert::stringNotEmpty($uri);
|
||||||
$this->uri = $uri;
|
$this->uri = $uri;
|
||||||
|
|||||||
@@ -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.
|
* @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
|
// 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
|
// 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[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
private function splitTagBlockIntoTagLines(string $tags)
|
private function splitTagBlockIntoTagLines(string $tags): array
|
||||||
{
|
{
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach (explode("\n", $tags) as $tag_line) {
|
foreach (explode("\n", $tags) as $tag_line) {
|
||||||
|
|||||||
Reference in New Issue
Block a user