Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/DocBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function isTemplateEnd(): bool
*
* @return Tag[]
*/
public function getTags()
public function getTags(): array
{
return $this->tags;
}
Expand All @@ -146,7 +146,7 @@ public function getTags()
*
* @return Tag[]
*/
public function getTagsByName(string $name)
public function getTagsByName(string $name): array
{
$result = [];

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Description.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(string $bodyTemplate, array $tags = [])
*
* @return Tag[]
*/
public function getTags()
public function getTags(): array
{
return $this->tags;
}
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/DescriptionFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function create(string $contents, ?TypeContext $context = null): Descript
*
* @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);

Expand Down
8 changes: 4 additions & 4 deletions src/DocBlock/StandardTagFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public function registerTagHandler(string $tagName, string $handler): void
*
* @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)) {
Expand Down Expand Up @@ -222,7 +222,7 @@ private function findHandlerClassName(string $tagName, TypeContext $context): st
* @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) {
Expand Down Expand Up @@ -251,7 +251,7 @@ private function getArgumentsForParametersFromWiring($parameters, $locator)
*
* @return \ReflectionParameter[]
*/
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName)
private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array
{
if (! isset($this->tagHandlerParameterCache[$handlerClassName])) {
$methodReflection = new \ReflectionMethod($handlerClassName, 'create');
Expand All @@ -271,7 +271,7 @@ private function fetchParametersForHandlerFactoryMethod(string $handlerClassName
*
* @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,
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Covers.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function create(
?DescriptionFactory $descriptionFactory = null,
?FqsenResolver $resolver = null,
?TypeContext $context = null
) {
): self {
Assert::notEmpty($body);

$parts = preg_split('/\s+/Su', $body, 2);
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Deprecated.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static function create(
?string $body,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
if (empty($body)) {
return new static();
}
Expand Down
3 changes: 1 addition & 2 deletions src/DocBlock/Tags/Example.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace phpDocumentor\Reflection\DocBlock\Tags;

use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\Tag;
use Webmozart\Assert\Assert;

Expand Down Expand Up @@ -81,7 +80,7 @@ public function getContent()
/**
* {@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)) {
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
string $name = '',
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($name);
Assert::notNull($descriptionFactory);

Expand Down
10 changes: 5 additions & 5 deletions src/DocBlock/Tags/Method.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ public static function create(
)?
# Return type
(?:
(
(
(?:[\w\|_\\\\]*\$this[\w\|_\\\\]*)
|
(?:
(?:[\w\|_\\\\]+)
# array notation
# array notation
(?:\[\])*
)*
)
Expand Down Expand Up @@ -170,7 +170,7 @@ public function getMethodName(): string
/**
* @return string[]
*/
public function getArguments()
public function getArguments(): array
{
return $this->arguments;
}
Expand Down Expand Up @@ -204,7 +204,7 @@ public function __toString(): string
. ($this->description ? ' ' . $this->description->render() : ''));
}

private function filterArguments($arguments)
private function filterArguments(array $arguments = []): array
{
foreach ($arguments as &$argument) {
if (is_string($argument)) {
Expand All @@ -227,7 +227,7 @@ private function filterArguments($arguments)
return $arguments;
}

private static function stripRestArg($argument)
private static function stripRestArg(string $argument): string
{
if (strpos($argument, '...') === 0) {
$argument = trim(substr($argument, 3));
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Param.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/PropertyRead.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/PropertyWrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Reference/Url.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Return_.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::allNotNull([$typeResolver, $descriptionFactory]);

$parts = preg_split('/\s+/Su', $body, 2);
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/See.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
?FqsenResolver $resolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::allNotNull([$resolver, $descriptionFactory]);

$parts = preg_split('/\s+/Su', $body, 2);
Expand Down
1 change: 0 additions & 1 deletion src/DocBlock/Tags/Since.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

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;

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Source.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
string $body,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($body);
Assert::notNull($descriptionFactory);

Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Throws.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::allNotNull([$typeResolver, $descriptionFactory]);

$parts = preg_split('/\s+/Su', $body, 2);
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Uses.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function create(
?FqsenResolver $resolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::allNotNull([$resolver, $descriptionFactory]);

$parts = preg_split('/\s+/Su', $body, 2);
Expand Down
2 changes: 1 addition & 1 deletion src/DocBlock/Tags/Var_.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static function create(
?TypeResolver $typeResolver = null,
?DescriptionFactory $descriptionFactory = null,
?TypeContext $context = null
) {
): self {
Assert::stringNotEmpty($body);
Assert::allNotNull([$typeResolver, $descriptionFactory]);

Expand Down
4 changes: 2 additions & 2 deletions src/DocBlockFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private function stripDocComment(string $comment): string
*
* @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
Expand Down Expand Up @@ -227,7 +227,7 @@ private function parseTagBlock(string $tags, Types\Context $context): array
/**
* @return string[]
*/
private function splitTagBlockIntoTagLines(string $tags)
private function splitTagBlockIntoTagLines(string $tags): array
{
$result = [];
foreach (explode("\n", $tags) as $tag_line) {
Expand Down