[cs] use short arrays, order imports

This commit is contained in:
TomasVotruba
2017-11-12 21:23:54 +01:00
committed by Jaap van Otterdijk
parent 87c6ecc5f4
commit 771a21db91
9 changed files with 13 additions and 14 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ final class DocBlock
private $description = null; private $description = null;
/** @var Tag[] An array containing all the tags in this docblock; except inline. */ /** @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. */ /** @var Types\Context Information about the context of this DocBlock. */
private $context = null; private $context = null;
@@ -171,7 +171,7 @@ final class DocBlock
{ {
Assert::string($name); Assert::string($name);
$result = array(); $result = [];
/** @var Tag $tag */ /** @var Tag $tag */
foreach ($this->getTags() as $tag) { foreach ($this->getTags() as $tag) {
+1 -1
View File
@@ -23,7 +23,7 @@ class ExampleFinder
private $sourceDirectory = ''; private $sourceDirectory = '';
/** @var string[] */ /** @var string[] */
private $exampleDirectories = array(); private $exampleDirectories = [];
/** /**
* Attempts to find the example contents for the given descriptor. * Attempts to find the example contents for the given descriptor.
+1 -1
View File
@@ -166,7 +166,7 @@ final class StandardTagFactory implements TagFactory
*/ */
private function extractTagParts($tagLine) private function extractTagParts($tagLine)
{ {
$matches = array(); $matches = [];
if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) {
throw new \InvalidArgumentException( throw new \InvalidArgumentException(
'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors'
+2 -2
View File
@@ -12,11 +12,11 @@
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Fqsen; use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
/** /**
+1 -1
View File
@@ -12,9 +12,9 @@
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
/** /**
+1 -2
View File
@@ -12,14 +12,13 @@
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen as FqsenRef;
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Reference;
use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url; use phpDocumentor\Reflection\DocBlock\Tags\Reference\Url;
use phpDocumentor\Reflection\Fqsen;
use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\FqsenResolver;
use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
/** /**
+1 -1
View File
@@ -12,9 +12,9 @@
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
/** /**
+1 -1
View File
@@ -12,9 +12,9 @@
namespace phpDocumentor\Reflection\DocBlock\Tags; namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Description;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\Types\Context as TypeContext;
use Webmozart\Assert\Assert; use Webmozart\Assert\Assert;
/** /**
+3 -3
View File
@@ -124,7 +124,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface
$comment = trim(substr($comment, 0, -2)); $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 // 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 // performance impact of running a regular expression
if (strpos($comment, '@') === 0) { if (strpos($comment, '@') === 0) {
return array('', '', '', $comment); return ['', '', '', $comment];
} }
// clears all extra horizontal whitespace from the line endings to prevent parsing issues // 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) private function splitTagBlockIntoTagLines($tags)
{ {
$result = array(); $result = [];
foreach (explode("\n", $tags) as $tag_line) { foreach (explode("\n", $tags) as $tag_line) {
if (isset($tag_line[0]) && ($tag_line[0] === '@')) { if (isset($tag_line[0]) && ($tag_line[0] === '@')) {
$result[] = $tag_line; $result[] = $tag_line;