From 771a21db91a9d666f0eb07c0520f733d56f20e2a Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Sat, 11 Nov 2017 10:19:24 +0100 Subject: [PATCH] [cs] use short arrays, order imports --- src/DocBlock.php | 4 ++-- src/DocBlock/ExampleFinder.php | 2 +- src/DocBlock/StandardTagFactory.php | 2 +- src/DocBlock/Tags/Covers.php | 4 ++-- src/DocBlock/Tags/Deprecated.php | 2 +- src/DocBlock/Tags/See.php | 3 +-- src/DocBlock/Tags/Since.php | 2 +- src/DocBlock/Tags/Version.php | 2 +- src/DocBlockFactory.php | 6 +++--- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 8ed3120..779fcf0 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -24,7 +24,7 @@ final class DocBlock private $description = null; /** @var Tag[] An array containing all the tags in this docblock; except inline. */ - private $tags = array(); + private $tags = []; /** @var Types\Context Information about the context of this DocBlock. */ private $context = null; @@ -171,7 +171,7 @@ final class DocBlock { Assert::string($name); - $result = array(); + $result = []; /** @var Tag $tag */ foreach ($this->getTags() as $tag) { diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index ea79f7c..571ed74 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -23,7 +23,7 @@ class ExampleFinder private $sourceDirectory = ''; /** @var string[] */ - private $exampleDirectories = array(); + private $exampleDirectories = []; /** * Attempts to find the example contents for the given descriptor. diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 8efd84e..5fc1f0a 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -166,7 +166,7 @@ final class StandardTagFactory implements TagFactory */ private function extractTagParts($tagLine) { - $matches = array(); + $matches = []; if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { throw new \InvalidArgumentException( 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 31b4f82..e540bfb 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -12,11 +12,11 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; +use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Fqsen; -use phpDocumentor\Reflection\DocBlock\Description; -use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; /** diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 7c1039f..822c305 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -12,9 +12,9 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; /** diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 3774b49..9e9e723 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -12,14 +12,13 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; +use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url; -use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; -use phpDocumentor\Reflection\DocBlock\Description; use Webmozart\Assert\Assert; /** diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 3d002ed..835fb0d 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -12,9 +12,9 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; /** diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 3e0e5be..7bb0420 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -12,9 +12,9 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; +use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; /** diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 9ec2455..4683fb4 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -124,7 +124,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface $comment = trim(substr($comment, 0, -2)); } - return str_replace(array("\r\n", "\r"), "\n", $comment); + return str_replace(["\r\n", "\r"], "\n", $comment); } /** @@ -143,7 +143,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface // method does not split tags so we return this verbatim as the fourth result (tags). This saves us the // performance impact of running a regular expression if (strpos($comment, '@') === 0) { - return array('', '', '', $comment); + return ['', '', '', $comment]; } // clears all extra horizontal whitespace from the line endings to prevent parsing issues @@ -241,7 +241,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface */ private function splitTagBlockIntoTagLines($tags) { - $result = array(); + $result = []; foreach (explode("\n", $tags) as $tag_line) { if (isset($tag_line[0]) && ($tag_line[0] === '@')) { $result[] = $tag_line;