From d874c4d14ae558dbefa9609b7e37dfa9dc90b0dc Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:02:27 +0100 Subject: [PATCH 001/126] add strict_types and typehints --- src/DocBlock.php | 28 +++++++++---------- src/DocBlock/Description.php | 12 ++++---- src/DocBlock/DescriptionFactory.php | 14 ++++------ src/DocBlock/ExampleFinder.php | 19 ++++++------- src/DocBlock/Serializer.php | 13 ++++----- src/DocBlock/StandardTagFactory.php | 24 ++++++++-------- src/DocBlock/Tag.php | 5 ++-- src/DocBlock/TagFactory.php | 10 +++---- src/DocBlock/Tags/Author.php | 13 +++++---- src/DocBlock/Tags/BaseTag.php | 5 ++-- src/DocBlock/Tags/Covers.php | 12 ++++---- src/DocBlock/Tags/Deprecated.php | 16 +++++++---- src/DocBlock/Tags/Example.php | 20 ++++++------- src/DocBlock/Tags/Factory/StaticMethod.php | 5 ++-- src/DocBlock/Tags/Factory/Strategy.php | 3 +- src/DocBlock/Tags/Formatter.php | 6 ++-- .../Tags/Formatter/AlignFormatter.php | 6 ++-- .../Tags/Formatter/PassthroughFormatter.php | 6 ++-- src/DocBlock/Tags/Generic.php | 15 +++++----- src/DocBlock/Tags/Link.php | 12 ++++---- src/DocBlock/Tags/Method.php | 11 ++++---- src/DocBlock/Tags/Param.php | 14 +++++----- src/DocBlock/Tags/Property.php | 12 ++++---- src/DocBlock/Tags/PropertyRead.php | 12 ++++---- src/DocBlock/Tags/PropertyWrite.php | 12 ++++---- src/DocBlock/Tags/Reference/Fqsen.php | 5 ++-- src/DocBlock/Tags/Reference/Reference.php | 3 +- src/DocBlock/Tags/Reference/Url.php | 3 +- src/DocBlock/Tags/Return_.php | 11 ++++---- src/DocBlock/Tags/See.php | 10 +++---- src/DocBlock/Tags/Since.php | 16 +++++++---- src/DocBlock/Tags/Source.php | 12 +++++--- src/DocBlock/Tags/Throws.php | 11 ++++---- src/DocBlock/Tags/Uses.php | 12 ++++---- src/DocBlock/Tags/Var_.php | 12 ++++---- src/DocBlock/Tags/Version.php | 16 +++++++---- src/DocBlockFactory.php | 19 ++++++------- src/DocBlockFactoryInterface.php | 10 +++---- 38 files changed, 230 insertions(+), 215 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 46605b78..7d38a4f1 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -1,4 +1,5 @@ -summary; } @@ -85,7 +85,7 @@ public function getSummary() /** * @return DocBlock\Description */ - public function getDescription() + public function getDescription(): DocBlock\Description { return $this->description; } @@ -95,7 +95,7 @@ public function getDescription() * * @return Types\Context */ - public function getContext() + public function getContext(): Types\Context { return $this->context; } @@ -105,7 +105,7 @@ public function getContext() * * @return Location */ - public function getLocation() + public function getLocation(): Location { return $this->location; } @@ -131,7 +131,7 @@ public function getLocation() * * @return boolean */ - public function isTemplateStart() + public function isTemplateStart(): bool { return $this->isTemplateStart; } @@ -143,7 +143,7 @@ public function isTemplateStart() * * @return boolean */ - public function isTemplateEnd() + public function isTemplateEnd(): bool { return $this->isTemplateEnd; } @@ -166,7 +166,7 @@ public function getTags() * * @return Tag[] */ - public function getTagsByName($name) + public function getTagsByName(string $name) { Assert::string($name); @@ -191,7 +191,7 @@ public function getTagsByName($name) * * @return bool */ - public function hasTag($name) + public function hasTag(string $name): bool { Assert::string($name); @@ -210,7 +210,6 @@ public function hasTag($name) * * @param Tag $tag The tag to remove. * - * @return void */ public function removeTag(Tag $tagToRemove) { @@ -227,7 +226,6 @@ public function removeTag(Tag $tagToRemove) * * @param Tag $tag The tag to add. * - * @return void */ private function addTag(Tag $tag) { diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index 25a79e00..811a0f70 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -1,4 +1,5 @@ -bodyTemplate = $bodyTemplate; $this->tags = $tags; } @@ -84,11 +83,10 @@ public function getTags() * Renders this description as a string where the provided formatter will format the tags in the expected string * format. * - * @param Formatter|null $formatter * * @return string */ - public function render(Formatter $formatter = null) + public function render(Formatter $formatter = null): string { if ($formatter === null) { $formatter = new PassthroughFormatter(); @@ -107,7 +105,7 @@ public function render(Formatter $formatter = null) * * @return string */ - public function __toString() + public function __toString(): string { return $this->render(); } diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 48f9c219..54453f68 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -1,4 +1,5 @@ -parse($this->lex($contents), $context); @@ -68,7 +67,7 @@ public function create($contents, TypeContext $context = null) * * @return string[] A series of tokens of which the description text is composed. */ - private function lex($contents) + private function lex(string $contents) { $contents = $this->removeSuperfluousStartingWhitespace($contents); @@ -103,7 +102,7 @@ private function lex($contents) ) \}/Sux', $contents, - null, + 0, PREG_SPLIT_DELIM_CAPTURE ); } @@ -112,7 +111,6 @@ private function lex($contents) * Parses the stream of tokens in to a new set of tokens containing Tags. * * @param string[] $tokens - * @param TypeContext $context * * @return string[]|Tag[] */ @@ -156,7 +154,7 @@ private function parse($tokens, TypeContext $context) * * @return string */ - private function removeSuperfluousStartingWhitespace($contents) + private function removeSuperfluousStartingWhitespace(string $contents): string { $lines = explode("\n", $contents); diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 571ed749..8b77160f 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -1,4 +1,5 @@ -getFilePath(); @@ -49,9 +49,8 @@ public function find(Example $example) * * @param string $directory * - * @return void */ - public function setSourceDirectory($directory = '') + public function setSourceDirectory(string $directory = '') { $this->sourceDirectory = $directory; } @@ -61,7 +60,7 @@ public function setSourceDirectory($directory = '') * * @return string */ - public function getSourceDirectory() + public function getSourceDirectory(): string { return $this->sourceDirectory; } @@ -101,7 +100,7 @@ public function getExampleDirectories() * * @return string|null */ - private function getExampleFileContents($filename) + private function getExampleFileContents(string $filename) { $normalizedPath = null; @@ -133,7 +132,7 @@ private function getExampleFileContents($filename) * * @return string */ - private function getExamplePathFromExampleDirectory($file) + private function getExamplePathFromExampleDirectory(string $file): string { return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; } @@ -146,7 +145,7 @@ private function getExamplePathFromExampleDirectory($file) * * @return string */ - private function constructExamplePath($directory, $file) + private function constructExamplePath(string $directory, string $file): string { return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; } @@ -158,7 +157,7 @@ private function constructExamplePath($directory, $file) * * @return string */ - private function getExamplePathFromSource($file) + private function getExamplePathFromSource(string $file): string { return sprintf( '%s%s%s', diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 0f355f58..1ed4a2cf 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -1,4 +1,5 @@ -indentString, $this->indent); $firstIndent = $this->isFirstLineIndented ? $indent : ''; @@ -114,11 +115,10 @@ private function addAsterisksForEachLine($indent, $text) } /** - * @param DocBlock $docblock * @param $wrapLength * @return string */ - private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength) + private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string { $text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription() : ''); @@ -131,13 +131,12 @@ private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLeng } /** - * @param DocBlock $docblock * @param $wrapLength * @param $indent * @param $comment * @return string */ - private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment) + private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment): string { foreach ($docblock->getTags() as $tag) { $tagText = $this->tagFormatter->format($tag); diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 5a8143cf..736afe59 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -1,4 +1,5 @@ -serviceLocator[$name] = $value; } @@ -141,7 +141,7 @@ public function addService($service, $alias = null) /** * {@inheritDoc} */ - public function registerTagHandler($tagName, $handler) + public function registerTagHandler(string $tagName, string $handler) { Assert::stringNotEmpty($tagName); Assert::stringNotEmpty($handler); @@ -164,7 +164,7 @@ public function registerTagHandler($tagName, $handler) * * @return string[] */ - private function extractTagParts($tagLine) + private function extractTagParts(string $tagLine) { $matches = []; if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { @@ -186,11 +186,10 @@ private function extractTagParts($tagLine) * * @param string $body * @param string $name - * @param TypeContext $context * * @return Tag|null */ - private function createTag($body, $name, TypeContext $context) + private function createTag(string $body, string $name, TypeContext $context) { $handlerClassName = $this->findHandlerClassName($name, $context); $arguments = $this->getArgumentsForParametersFromWiring( @@ -205,11 +204,10 @@ private function createTag($body, $name, TypeContext $context) * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). * * @param string $tagName - * @param TypeContext $context * * @return string */ - private function findHandlerClassName($tagName, TypeContext $context) + private function findHandlerClassName(string $tagName, TypeContext $context): string { $handlerClassName = Generic::class; if (isset($this->tagHandlerMappings[$tagName])) { @@ -264,7 +262,7 @@ private function getArgumentsForParametersFromWiring($parameters, $locator) * * @return \ReflectionParameter[] */ - private function fetchParametersForHandlerFactoryMethod($handlerClassName) + private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) { if (! isset($this->tagHandlerParameterCache[$handlerClassName])) { $methodReflection = new \ReflectionMethod($handlerClassName, 'create'); @@ -284,7 +282,7 @@ private function fetchParametersForHandlerFactoryMethod($handlerClassName) * * @return mixed[] */ - private function getServiceLocatorWithDynamicParameters(TypeContext $context, $tagName, $tagBody) + private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody) { $locator = array_merge( $this->serviceLocator, @@ -307,7 +305,7 @@ private function getServiceLocatorWithDynamicParameters(TypeContext $context, $t * * @return bool */ - private function isAnnotation($tagContent) + private function isAnnotation(string $tagContent): bool { // 1. Contains a namespace separator // 2. Contains parenthesis diff --git a/src/DocBlock/Tag.php b/src/DocBlock/Tag.php index e7653678..e6d4b88c 100644 --- a/src/DocBlock/Tag.php +++ b/src/DocBlock/Tag.php @@ -1,4 +1,5 @@ -authorName; } @@ -61,7 +62,7 @@ public function getAuthorName() * * @return string The author's email. */ - public function getEmail() + public function getEmail(): string { return $this->authorEmail; } @@ -71,7 +72,7 @@ public function getEmail() * * @return string */ - public function __toString() + public function __toString(): string { return $this->authorName . (strlen($this->authorEmail) ? ' <' . $this->authorEmail . '>' : ''); } @@ -83,7 +84,7 @@ public function __toString() * * @return static */ - public static function create($body) + public static function create(string $body) { Assert::string($body); diff --git a/src/DocBlock/Tags/BaseTag.php b/src/DocBlock/Tags/BaseTag.php index 14bb7177..2fbe5583 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -1,4 +1,5 @@ -name; } diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 8d65403f..e7e5b732 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -1,4 +1,5 @@ -resolve($parts[0], $context), - $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context) + $descriptionFactory->create($parts[1] ?? '', $context) ); } @@ -66,7 +66,7 @@ public static function create( * * @return Fqsen */ - public function getReference() + public function getReference(): Fqsen { return $this->refers; } @@ -76,7 +76,7 @@ public function getReference() * * @return string */ - public function __toString() + public function __toString(): string { return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 822c3050..4ce0224b 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -1,4 +1,5 @@ -create(isset($matches[2]) ? $matches[2] : '', $context) + $descriptionFactory->create($matches[2] ?? '', $context) ); } @@ -80,7 +84,7 @@ public static function create($body, DescriptionFactory $descriptionFactory = nu * * @return string */ - public function getVersion() + public function getVersion(): string { return $this->version; } @@ -90,7 +94,7 @@ public function getVersion() * * @return string */ - public function __toString() + public function __toString(): string { return $this->version . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index ecb199b4..8c923559 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -1,4 +1,5 @@ -filePath = $filePath; @@ -53,7 +53,7 @@ public function __construct($filePath, $isURI, $startingLine, $lineCount, $descr $this->lineCount = $lineCount; $this->name = 'example'; if ($description !== null) { - $this->description = trim($description); + $this->description = trim((string) $description); } $this->isURI = $isURI; @@ -81,7 +81,7 @@ public function getContent() /** * {@inheritdoc} */ - public static function create($body) + public static function create(string $body) { // File component: File path in quotes or File URI / Source information if (! preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { @@ -131,7 +131,7 @@ public static function create($body) * @return string Path to a file to use as an example. * May also be an absolute URI. */ - public function getFilePath() + public function getFilePath(): string { return $this->filePath; } @@ -141,7 +141,7 @@ public function getFilePath() * * @return string */ - public function __toString() + public function __toString(): string { return $this->filePath . ($this->description ? ' ' . $this->description : ''); } @@ -153,7 +153,7 @@ public function __toString() * * @return bool */ - private function isUriRelative($uri) + private function isUriRelative(string $uri): bool { return false === strpos($uri, ':'); } @@ -161,7 +161,7 @@ private function isUriRelative($uri) /** * @return int */ - public function getStartingLine() + public function getStartingLine(): int { return $this->startingLine; } @@ -169,7 +169,7 @@ public function getStartingLine() /** * @return int */ - public function getLineCount() + public function getLineCount(): int { return $this->lineCount; } diff --git a/src/DocBlock/Tags/Factory/StaticMethod.php b/src/DocBlock/Tags/Factory/StaticMethod.php index 98aea455..b0673bd0 100644 --- a/src/DocBlock/Tags/Factory/StaticMethod.php +++ b/src/DocBlock/Tags/Factory/StaticMethod.php @@ -1,4 +1,5 @@ -getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string)$tag; } diff --git a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php index 4e2c5762..18d672d6 100644 --- a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php +++ b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -1,4 +1,5 @@ -getName() . ' ' . (string)$tag); } diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index e4c53e00..c94c196e 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -1,4 +1,5 @@ -validateTagName($name); @@ -42,14 +43,13 @@ public function __construct($name, Description $description = null) * * @param string $body * @param string $name - * @param DescriptionFactory $descriptionFactory * @param TypeContext $context * * @return static */ public static function create( - $body, - $name = '', + string $body, + string $name = '', DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { @@ -67,7 +67,7 @@ public static function create( * * @return string */ - public function __toString() + public function __toString(): string { return ($this->description ? $this->description->render() : ''); } @@ -77,9 +77,8 @@ public function __toString() * * @param string $name * - * @return void */ - private function validateTagName($name) + private function validateTagName(string $name) { if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { throw new \InvalidArgumentException( diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 9c0e367e..b246bff4 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -1,4 +1,5 @@ -link; } @@ -70,7 +70,7 @@ public function getLink() * * @return string */ - public function __toString() + public function __toString(): string { return $this->link . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 75225299..65ceb448 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -1,4 +1,5 @@ -methodName; } @@ -181,7 +182,7 @@ public function getArguments() * * @return bool TRUE if the method declaration is for a static method, FALSE otherwise. */ - public function isStatic() + public function isStatic(): bool { return $this->isStatic; } @@ -189,7 +190,7 @@ public function isStatic() /** * @return Type */ - public function getReturnType() + public function getReturnType(): Type { return $this->returnType; } diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 7d699d88..73d31cef 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -1,4 +1,5 @@ -variableName; } @@ -121,7 +121,7 @@ public function getType() * * @return boolean */ - public function isVariadic() + public function isVariadic(): bool { return $this->isVariadic; } @@ -131,7 +131,7 @@ public function isVariadic() * * @return string */ - public function __toString() + public function __toString(): string { return ($this->type ? $this->type . ' ' : '') . ($this->isVariadic() ? '...' : '') diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index f0ef7c07..6f9f4ac1 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -1,4 +1,5 @@ -variableName; } @@ -109,7 +109,7 @@ public function getType() * * @return string */ - public function __toString() + public function __toString(): string { return ($this->type ? $this->type . ' ' : '') . '$' . $this->variableName diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index e41c0c1c..27572138 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -1,4 +1,5 @@ -variableName; } @@ -109,7 +109,7 @@ public function getType() * * @return string */ - public function __toString() + public function __toString(): string { return ($this->type ? $this->type . ' ' : '') . '$' . $this->variableName diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index cfdb0ed0..68131e8d 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -1,4 +1,5 @@ -variableName; } @@ -109,7 +109,7 @@ public function getType() * * @return string */ - public function __toString() + public function __toString(): string { return ($this->type ? $this->type . ' ' : '') . '$' . $this->variableName diff --git a/src/DocBlock/Tags/Reference/Fqsen.php b/src/DocBlock/Tags/Reference/Fqsen.php index dc7b8b6d..3ba076bc 100644 --- a/src/DocBlock/Tags/Reference/Fqsen.php +++ b/src/DocBlock/Tags/Reference/Fqsen.php @@ -1,4 +1,5 @@ -fqsen; } diff --git a/src/DocBlock/Tags/Reference/Reference.php b/src/DocBlock/Tags/Reference/Reference.php index a3ffd24c..c02e7f00 100644 --- a/src/DocBlock/Tags/Reference/Reference.php +++ b/src/DocBlock/Tags/Reference/Reference.php @@ -1,4 +1,5 @@ -resolve(isset($parts[0]) ? $parts[0] : '', $context); - $description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context); + $type = $typeResolver->resolve($parts[0] ?? '', $context); + $description = $descriptionFactory->create($parts[1] ?? '', $context); return new static($type, $description); } @@ -60,7 +61,7 @@ public static function create( * * @return Type */ - public function getType() + public function getType(): Type { return $this->type; } diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 9e9e723b..dab2ce0c 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -1,4 +1,5 @@ -refers; } @@ -81,7 +81,7 @@ public function getReference() * * @return string */ - public function __toString() + public function __toString(): string { return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 835fb0dc..a40d61fe 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -1,4 +1,5 @@ -create(isset($matches[2]) ? $matches[2] : '', $context) + $descriptionFactory->create($matches[2] ?? '', $context) ); } @@ -77,7 +81,7 @@ public static function create($body, DescriptionFactory $descriptionFactory = nu * * @return string */ - public function getVersion() + public function getVersion(): string { return $this->version; } @@ -87,7 +91,7 @@ public function getVersion() * * @return string */ - public function __toString() + public function __toString(): string { return $this->version . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index 247b1b3b..1fc9e965 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -1,4 +1,5 @@ -startingLine; } diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 349e773b..5051c4e3 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -1,4 +1,5 @@ -resolve(isset($parts[0]) ? $parts[0] : '', $context); - $description = $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context); + $type = $typeResolver->resolve($parts[0] ?? '', $context); + $description = $descriptionFactory->create($parts[1] ?? '', $context); return new static($type, $description); } @@ -60,7 +61,7 @@ public static function create( * * @return Type */ - public function getType() + public function getType(): Type { return $this->type; } diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 00dc3e3b..34d129e9 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -1,4 +1,5 @@ -resolve($parts[0], $context), - $descriptionFactory->create(isset($parts[1]) ? $parts[1] : '', $context) + $descriptionFactory->create($parts[1] ?? '', $context) ); } @@ -66,7 +66,7 @@ public static function create( * * @return Fqsen */ - public function getReference() + public function getReference(): Fqsen { return $this->refers; } @@ -76,7 +76,7 @@ public function getReference() * * @return string */ - public function __toString() + public function __toString(): string { return $this->refers . ' ' . $this->description->render(); } diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 8907c951..6e49dab9 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -1,4 +1,5 @@ -variableName; } @@ -109,7 +109,7 @@ public function getType() * * @return string */ - public function __toString() + public function __toString(): string { return ($this->type ? $this->type . ' ' : '') . (empty($this->variableName) ? null : ('$' . $this->variableName)) diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 7bb04207..7aa193ad 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -1,4 +1,5 @@ -create(isset($matches[2]) ? $matches[2] : '', $context) + $descriptionFactory->create($matches[2] ?? '', $context) ); } @@ -77,7 +81,7 @@ public static function create($body, DescriptionFactory $descriptionFactory = nu * * @return string */ - public function getVersion() + public function getVersion(): string { return $this->version; } @@ -87,7 +91,7 @@ public function getVersion() * * @return string */ - public function __toString() + public function __toString(): string { return $this->version . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 1bdb8f4d..e1d84679 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -1,4 +1,5 @@ -filterTagBlock($tags); if (!$tags) { @@ -239,7 +238,7 @@ private function parseTagBlock($tags, Types\Context $context) * * @return string[] */ - private function splitTagBlockIntoTagLines($tags) + private function splitTagBlockIntoTagLines(string $tags) { $result = []; foreach (explode("\n", $tags) as $tag_line) { @@ -257,7 +256,7 @@ private function splitTagBlockIntoTagLines($tags) * @param $tags * @return string */ - private function filterTagBlock($tags) + private function filterTagBlock($tags): string { $tags = trim($tags); if (!$tags) { diff --git a/src/DocBlockFactoryInterface.php b/src/DocBlockFactoryInterface.php index b3533429..151134f9 100644 --- a/src/DocBlockFactoryInterface.php +++ b/src/DocBlockFactoryInterface.php @@ -1,4 +1,5 @@ - Date: Mon, 27 Nov 2017 00:03:04 +0100 Subject: [PATCH 002/126] tests: add strict_types and typehints, remove tests that are now covered by typehints --- .../DocblocksWithAnnotationsTest.php | 3 +- .../integration/InterpretingDocBlocksTest.php | 3 +- .../ReconstitutingADocBlockTest.php | 3 +- tests/integration/UsingTagsTest.php | 3 +- .../unit/DocBlock/DescriptionFactoryTest.php | 3 +- tests/unit/DocBlock/DescriptionTest.php | 12 +----- tests/unit/DocBlock/ExampleFinderTest.php | 2 +- tests/unit/DocBlock/SerializerTest.php | 39 +------------------ .../unit/DocBlock/StandardTagFactoryTest.php | 3 +- tests/unit/DocBlock/Tags/AuthorTest.php | 3 +- tests/unit/DocBlock/Tags/CoversTest.php | 3 +- tests/unit/DocBlock/Tags/DeprecatedTest.php | 3 +- tests/unit/DocBlock/Tags/ExampleTest.php | 2 +- .../Tags/Formatter/AlignFormatterTest.php | 3 +- .../Formatter/PassthroughFormatterTest.php | 3 +- tests/unit/DocBlock/Tags/GenericTest.php | 3 +- tests/unit/DocBlock/Tags/LinkTest.php | 3 +- tests/unit/DocBlock/Tags/MethodTest.php | 11 +++--- tests/unit/DocBlock/Tags/ParamTest.php | 3 +- tests/unit/DocBlock/Tags/PropertyReadTest.php | 3 +- tests/unit/DocBlock/Tags/PropertyTest.php | 3 +- .../unit/DocBlock/Tags/PropertyWriteTest.php | 3 +- tests/unit/DocBlock/Tags/ReturnTest.php | 3 +- tests/unit/DocBlock/Tags/SeeTest.php | 3 +- tests/unit/DocBlock/Tags/SinceTest.php | 3 +- tests/unit/DocBlock/Tags/SourceTest.php | 3 +- tests/unit/DocBlock/Tags/ThrowsTest.php | 3 +- tests/unit/DocBlock/Tags/UsesTest.php | 3 +- tests/unit/DocBlock/Tags/VarTest.php | 3 +- tests/unit/DocBlock/Tags/VersionTest.php | 3 +- tests/unit/DocBlockFactoryTest.php | 3 +- tests/unit/DocBlockTest.php | 3 +- 32 files changed, 66 insertions(+), 81 deletions(-) diff --git a/tests/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php index 98646438..ffd9c42d 100644 --- a/tests/integration/DocblocksWithAnnotationsTest.php +++ b/tests/integration/DocblocksWithAnnotationsTest.php @@ -1,4 +1,5 @@ -assertSame($expected, (string)$fixture); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testBodyTemplateMustBeAString() - { - new Description([]); - } } diff --git a/tests/unit/DocBlock/ExampleFinderTest.php b/tests/unit/DocBlock/ExampleFinderTest.php index 7c306fa8..78e81df4 100644 --- a/tests/unit/DocBlock/ExampleFinderTest.php +++ b/tests/unit/DocBlock/ExampleFinderTest.php @@ -1,4 +1,4 @@ -removeTag($genericTag); $this->assertSame($expectedAfterRemove, $fixture->getDocComment($docBlock)); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testInitializationFailsIfIndentIsNotAnInteger() - { - new Serializer([]); - } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testInitializationFailsIfIndentStringIsNotAString() - { - new Serializer(0, []); - } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testInitializationFailsIfIndentFirstLineIsNotABoolean() - { - new Serializer(0, '', []); - } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testInitializationFailsIfLineLengthIsNotNullNorAnInteger() - { - new Serializer(0, '', false, []); - } } diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 13d60e97..a181e65b 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -1,4 +1,5 @@ - Date: Mon, 27 Nov 2017 00:03:15 +0100 Subject: [PATCH 003/126] update composer.lock --- composer.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.lock b/composer.lock index 4589e702..dc23bcdc 100644 --- a/composer.lock +++ b/composer.lock @@ -475,16 +475,16 @@ }, { "name": "phpspec/prophecy", - "version": "v1.7.2", + "version": "1.7.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6" + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", - "reference": "c9b8c6088acd19d769d4cc0ffa60a9fe34344bd6", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", + "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", "shasum": "" }, "require": { @@ -496,7 +496,7 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8 || ^5.6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7" }, "type": "library", "extra": { @@ -534,7 +534,7 @@ "spy", "stub" ], - "time": "2017-09-04T11:05:03+00:00" + "time": "2017-11-24T13:59:53+00:00" }, { "name": "phpunit/php-code-coverage", @@ -602,16 +602,16 @@ }, { "name": "phpunit/php-file-iterator", - "version": "1.4.2", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5" + "reference": "8ebba84e5bd74fc5fdeb916b38749016c7232f93" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/3cc8f69b3028d0f96a9078e6295d86e9bf019be5", - "reference": "3cc8f69b3028d0f96a9078e6295d86e9bf019be5", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/8ebba84e5bd74fc5fdeb916b38749016c7232f93", + "reference": "8ebba84e5bd74fc5fdeb916b38749016c7232f93", "shasum": "" }, "require": { @@ -645,7 +645,7 @@ "filesystem", "iterator" ], - "time": "2016-10-03T07:40:28+00:00" + "time": "2017-11-24T15:00:59+00:00" }, { "name": "phpunit/php-text-template", From 76b771c23edd828a4e7812495eba36009b121950 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:03:50 +0100 Subject: [PATCH 004/126] examples: apply typehints --- examples/04-adding-your-own-tag.php | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/04-adding-your-own-tag.php b/examples/04-adding-your-own-tag.php index 026d6069..2215a469 100644 --- a/examples/04-adding-your-own-tag.php +++ b/examples/04-adding-your-own-tag.php @@ -83,10 +83,8 @@ public function __construct(Description $description = null) * * @see Tag for the interface declaration of the `create` method. * @see Tag::create() for more information on this method's workings. - * - * @return MyTag */ - public static function create($body, DescriptionFactory $descriptionFactory = null, Context $context = null) + public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag { Assert::string($body); Assert::notNull($descriptionFactory); @@ -99,10 +97,8 @@ public static function create($body, DescriptionFactory $descriptionFactory = nu * * This method is used to reconstitute a DocBlock into its original form by the {@see Serializer}. It should * feature all parts of the tag so that the serializer can put it back together. - * - * @return string */ - public function __toString() + public function __toString(): string { return (string)$this->description; } From 193731a153b9d75df5cdeb1fccb552d94250af29 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:21:11 +0100 Subject: [PATCH 005/126] remove tests and validation that are now covered by typehints --- src/DocBlock.php | 4 +- src/DocBlock/Tags/Author.php | 2 - src/DocBlock/Tags/Covers.php | 1 - src/DocBlock/Tags/Deprecated.php | 9 +- src/DocBlock/Tags/Generic.php | 1 - src/DocBlock/Tags/Link.php | 1 - src/DocBlock/Tags/Param.php | 3 - src/DocBlock/Tags/Property.php | 2 - src/DocBlock/Tags/PropertyRead.php | 2 - src/DocBlock/Tags/PropertyWrite.php | 2 - src/DocBlock/Tags/Return_.php | 1 - src/DocBlock/Tags/See.php | 1 - src/DocBlock/Tags/Since.php | 6 +- src/DocBlock/Tags/Throws.php | 1 - src/DocBlock/Tags/Uses.php | 1 - src/DocBlock/Tags/Var_.php | 2 - src/DocBlock/Tags/Version.php | 7 +- src/DocBlockFactory.php | 10 +- .../unit/DocBlock/StandardTagFactoryTest.php | 42 ----- tests/unit/DocBlock/Tags/AuthorTest.php | 19 --- tests/unit/DocBlock/Tags/CoversTest.php | 9 -- tests/unit/DocBlock/Tags/DeprecatedTest.php | 144 +++++++++--------- tests/unit/DocBlock/Tags/GenericTest.php | 9 -- tests/unit/DocBlock/Tags/LinkTest.php | 9 -- tests/unit/DocBlock/Tags/MethodTest.php | 9 -- tests/unit/DocBlock/Tags/ParamTest.php | 27 ---- tests/unit/DocBlock/Tags/PropertyReadTest.php | 18 --- tests/unit/DocBlock/Tags/PropertyTest.php | 18 --- .../unit/DocBlock/Tags/PropertyWriteTest.php | 18 --- tests/unit/DocBlock/Tags/ReturnTest.php | 9 -- tests/unit/DocBlock/Tags/SeeTest.php | 9 -- tests/unit/DocBlock/Tags/SinceTest.php | 9 -- tests/unit/DocBlock/Tags/SourceTest.php | 9 -- tests/unit/DocBlock/Tags/ThrowsTest.php | 9 -- tests/unit/DocBlock/Tags/UsesTest.php | 9 -- tests/unit/DocBlock/Tags/VarTest.php | 18 --- tests/unit/DocBlock/Tags/VersionTest.php | 9 -- 37 files changed, 79 insertions(+), 380 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 7d38a4f1..b94525d3 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -102,10 +102,8 @@ public function getContext(): Types\Context /** * Returns the current location. - * - * @return Location */ - public function getLocation(): Location + public function getLocation(): ?Location { return $this->location; } diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index e33c131c..212cc49f 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -37,8 +37,6 @@ final class Author extends BaseTag implements Factory\StaticMethod */ public function __construct(string $authorName, string $authorEmail) { - Assert::string($authorName); - Assert::string($authorEmail); if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) { throw new \InvalidArgumentException('The author tag does not have a valid e-mail address'); } diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index e7e5b732..2784289d 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -50,7 +50,6 @@ public static function create( FqsenResolver $resolver = null, TypeContext $context = null ) { - Assert::string($body); Assert::notEmpty($body); $parts = preg_split('/\s+/Su', $body, 2); diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 4ce0224b..85f9f5e2 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -56,11 +56,10 @@ public function __construct($version = null, Description $description = null) * @return static */ public static function create( - string $body, + ?string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::nullOrString($body); if (empty($body)) { return new static(); } @@ -82,17 +81,15 @@ public static function create( /** * Gets the version section of the tag. * - * @return string + * @return string|null */ - public function getVersion(): string + public function getVersion() { return $this->version; } /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index c94c196e..6ad1c8eb 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -53,7 +53,6 @@ public static function create( DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::string($body); Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index b246bff4..5b1cb39c 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -46,7 +46,6 @@ public function __construct(string $link, Description $description = null) */ public static function create(string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) { - Assert::string($body); Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 73d31cef..249f777a 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -44,9 +44,6 @@ final class Param extends BaseTag implements Factory\StaticMethod */ public function __construct(string $variableName, Type $type = null, bool $isVariadic = false, Description $description = null) { - Assert::string($variableName); - Assert::boolean($isVariadic); - $this->variableName = $variableName; $this->type = $type; $this->isVariadic = $isVariadic; diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 6f9f4ac1..23618b13 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -40,8 +40,6 @@ class Property extends BaseTag implements Factory\StaticMethod */ public function __construct(string $variableName, Type $type = null, Description $description = null) { - Assert::string($variableName); - $this->variableName = $variableName; $this->type = $type; $this->description = $description; diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 27572138..c210fac1 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -40,8 +40,6 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod */ public function __construct(string $variableName, Type $type = null, Description $description = null) { - Assert::string($variableName); - $this->variableName = $variableName; $this->type = $type; $this->description = $description; diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 68131e8d..1bba03eb 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -40,8 +40,6 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod */ public function __construct(string $variableName, Type $type = null, Description $description = null) { - Assert::string($variableName); - $this->variableName = $variableName; $this->type = $type; $this->description = $description; diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 738a4483..68aa913d 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -45,7 +45,6 @@ public static function create( DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::string($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index dab2ce0c..64a45042 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -52,7 +52,6 @@ public static function create( DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::string($body); Assert::allNotNull([$resolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index a40d61fe..03cb44ed 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -56,7 +56,7 @@ public function __construct($version = null, Description $description = null) * @return static */ public static function create( - string $body, + ?string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { @@ -78,10 +78,8 @@ public static function create( /** * Gets the version section of the tag. - * - * @return string */ - public function getVersion(): string + public function getVersion(): ?string { return $this->version; } diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 5051c4e3..19b6f9d0 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -45,7 +45,6 @@ public static function create( DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::string($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 34d129e9..d9412e4b 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -50,7 +50,6 @@ public static function create( DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::string($body); Assert::allNotNull([$resolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 6e49dab9..3f3c91d3 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -40,8 +40,6 @@ class Var_ extends BaseTag implements Factory\StaticMethod */ public function __construct(string $variableName, Type $type = null, Description $description = null) { - Assert::string($variableName); - $this->variableName = $variableName; $this->type = $type; $this->description = $description; diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 7aa193ad..1f0fc53f 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -56,11 +56,10 @@ public function __construct($version = null, Description $description = null) * @return static */ public static function create( - string $body, + ?string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::nullOrString($body); if (empty($body)) { return new static(); } @@ -78,10 +77,8 @@ public static function create( /** * Gets the version section of the tag. - * - * @return string */ - public function getVersion(): string + public function getVersion(): ?string { return $this->version; } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index e1d84679..246b74bb 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -87,7 +87,7 @@ public function create($docblock, Types\Context $context = null, Location $locat } $parts = $this->splitDocBlock($this->stripDocComment($docblock)); - list($templateMarker, $summary, $description, $tags) = $parts; + [$templateMarker, $summary, $description, $tags] = $parts; return new DocBlock( $summary, @@ -218,7 +218,7 @@ private function splitDocBlock(string $comment) * * @return DocBlock\Tag[] */ - private function parseTagBlock(string $tags, Types\Context $context) + private function parseTagBlock(string $tags, Types\Context $context): array { $tags = $this->filterTagBlock($tags); if (!$tags) { @@ -252,11 +252,7 @@ private function splitTagBlockIntoTagLines(string $tags) return $result; } - /** - * @param $tags - * @return string - */ - private function filterTagBlock($tags): string + private function filterTagBlock($tags): ?string { $tags = trim($tags); if (!$tags) { diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index a181e65b..6f0e548e 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -231,34 +231,6 @@ public function testRegisteringAHandlerForANewTag() $this->assertInstanceOf(Author::class, $tag); } - /** - * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException - */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNotAString() - { - $resolver = m::mock(FqsenResolver::class); - $tagFactory = new StandardTagFactory($resolver); - - $tagFactory->registerTagHandler([], Author::class); - } - - /** - * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException - */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsEmpty() - { - $resolver = m::mock(FqsenResolver::class); - $tagFactory = new StandardTagFactory($resolver); - - $tagFactory->registerTagHandler('', Author::class); - } - /** * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct @@ -273,20 +245,6 @@ public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFu $tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class); } - /** - * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException - */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAString() - { - $resolver = m::mock(FqsenResolver::class); - $tagFactory = new StandardTagFactory($resolver); - - $tagFactory->registerTagHandler('my-tag', []); - } - /** * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 0d43bb98..61b90ca1 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -81,16 +81,6 @@ public function testHasTheAuthorName() $this->assertSame($expected, $fixture->getAuthorName()); } - /** - * @covers ::__construct - * @covers ::getAuthorName - * @expectedException \InvalidArgumentException - */ - public function testInitializationFailsIfAuthorNameIsNotAString() - { - new Author([], 'mike@phpdoc.org'); - } - /** * @covers ::__construct * @covers ::getEmail @@ -104,15 +94,6 @@ public function testHasTheAuthorMailAddress() $this->assertSame($expected, $fixture->getEmail()); } - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testInitializationFailsIfEmailIsNotAString() - { - new Author('Mike van Riel', []); - } - /** * @covers ::__construct * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index 101157b3..48d288aa 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -146,15 +146,6 @@ public function testFactoryMethod() $this->assertSame($description, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - $this->assertNull(Covers::create([])); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index 2e7ef922..7313d376 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -74,70 +74,71 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() $this->assertSame('Rendered output', $fixture->render($formatter)); } - - /** - * @covers ::__construct - * @covers ::getVersion - */ - public function testHasVersionNumber() - { - $expected = '1.0'; - - $fixture = new Deprecated($expected); - - $this->assertSame($expected, $fixture->getVersion()); - } - - /** - * @covers ::__construct - * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description - */ - public function testHasDescription() - { - $expected = new Description('Description'); - - $fixture = new Deprecated('1.0', $expected); - - $this->assertSame($expected, $fixture->getDescription()); - } - - /** - * @covers ::__construct - * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description - */ - public function testStringRepresentationIsReturned() - { - $fixture = new Deprecated('1.0', new Description('Description')); - - $this->assertSame('1.0 Description', (string)$fixture); - } - - /** - * @covers ::create - * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: - * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses \phpDocumentor\Reflection\DocBlock\Description - * @uses \phpDocumentor\Reflection\Types\Context - */ - public function testFactoryMethod() - { - $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); - - $version = '1.0'; - $description = new Description('My Description'); - - $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); - - $fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context); - - $this->assertSame('1.0 My Description', (string)$fixture); - $this->assertSame($version, $fixture->getVersion()); - $this->assertSame($description, $fixture->getDescription()); - } - +// +// /** +// * @covers ::__construct +// * @covers ::getVersion +// */ +// public function testHasVersionNumber() +// { +// $expected = '1.0'; +// +// $fixture = new Deprecated($expected); +// +// $this->assertSame($expected, $fixture->getVersion()); +// } +// +// /** +// * @covers ::__construct +// * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription +// * @uses \phpDocumentor\Reflection\DocBlock\Description +// */ +// public function testHasDescription() +// { +// $expected = new Description('Description'); +// +// $fixture = new Deprecated('1.0', $expected); +// +// $this->assertSame($expected, $fixture->getDescription()); +// } +// +// /** +// * @covers ::__construct +// * @covers ::__toString +// * @uses \phpDocumentor\Reflection\DocBlock\Description +// */ +// public function testStringRepresentationIsReturned() +// { +// $fixture = new Deprecated('1.0', new Description('Description')); +// +// $this->assertSame('1.0 Description', (string)$fixture); +// } +// +// /** +// * @covers ::create +// * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: +// * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory +// * @uses \phpDocumentor\Reflection\DocBlock\Description +// * @uses \phpDocumentor\Reflection\Types\Context +// */ +// public function testFactoryMethod() +// { +// $descriptionFactory = m::mock(DescriptionFactory::class); +// $context = new Context(''); +// +// $version = '1.0'; +// $description = new Description('My Description'); +// +// $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); +// +// $fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context); +// +// $this->assertSame('1.0 My Description', (string)$fixture); +// $this->assertSame($version, $fixture->getVersion()); +// $this->assertSame($description, $fixture->getDescription()); +// } + +// /** * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: @@ -152,18 +153,9 @@ public function testFactoryMethodCreatesEmptyDeprecatedTag() $fixture = Deprecated::create('', $descriptionFactory, new Context('')); - $this->assertSame('', (string)$fixture); - $this->assertSame(null, $fixture->getVersion()); - $this->assertSame(null, $fixture->getDescription()); - } - - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfVersionIsNotString() - { - $this->assertNull(Deprecated::create([])); + $this->assertSame('', (string) $fixture); + $this->assertNull($fixture->getVersion()); + $this->assertNull($fixture->getDescription()); } /** diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index fbfd64b5..b59aee5d 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -125,15 +125,6 @@ public function testFactoryMethod() $this->assertSame($description, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfNameIsNotString() - { - Generic::create('', []); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/LinkTest.php b/tests/unit/DocBlock/Tags/LinkTest.php index c6d1cb61..829c6ef8 100644 --- a/tests/unit/DocBlock/Tags/LinkTest.php +++ b/tests/unit/DocBlock/Tags/LinkTest.php @@ -156,13 +156,4 @@ public function testFactoryMethodCreatesEmptyLinkTag() $this->assertSame('', $fixture->getLink()); $this->assertSame(null, $fixture->getDescription()); } - - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfVersionIsNotString() - { - $this->assertNull(Link::create([])); - } } diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index d9d31a19..b6d1b017 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -367,15 +367,6 @@ public function testCollectionReturnTypes( } } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - Method::create([]); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index d1ee0e52..95e4c8a6 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -190,15 +190,6 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() Param::create('', new TypeResolver(), $descriptionFactory); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - Param::create([]); - } - /** * @covers ::create * @expectedException \InvalidArgumentException @@ -217,22 +208,4 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() { Param::create('body', new TypeResolver()); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfVariableNameIsNotString() - { - new Param([]); - } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfVariadicIsNotBoolean() - { - new Param('', null, []); - } } diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index c14543d9..7e8794a1 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -176,15 +176,6 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() PropertyRead::create('', new TypeResolver(), $descriptionFactory); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - PropertyRead::create([]); - } - /** * @covers ::create * @expectedException \InvalidArgumentException @@ -203,13 +194,4 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() { PropertyRead::create('body', new TypeResolver()); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfVariableNameIsNotString() - { - new PropertyRead([]); - } } diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index 3ad6cca1..53a99ccb 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -171,15 +171,6 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() Property::create('', new TypeResolver(), $descriptionFactory); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - Property::create([]); - } - /** * @covers ::create * @expectedException \InvalidArgumentException @@ -198,13 +189,4 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() { Property::create('body', new TypeResolver()); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfVariableNameIsNotString() - { - new Property([]); - } } diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index 7051d791..79c28413 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -176,15 +176,6 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() PropertyWrite::create('', new TypeResolver(), $descriptionFactory); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - PropertyWrite::create([]); - } - /** * @covers ::create * @expectedException \InvalidArgumentException @@ -203,13 +194,4 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() { PropertyWrite::create('body', new TypeResolver()); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfVariableNameIsNotString() - { - new PropertyWrite([]); - } } diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 0a978299..53fe992e 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -142,15 +142,6 @@ public function testFactoryMethod() $this->assertSame($description, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - $this->assertNull(Return_::create([])); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index 9f3c21ef..6de4eadc 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -190,15 +190,6 @@ public function testFactoryMethodWithUrl() $this->assertSame($description, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - $this->assertNull(See::create([])); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/SinceTest.php b/tests/unit/DocBlock/Tags/SinceTest.php index 985b3252..6e39ad8c 100644 --- a/tests/unit/DocBlock/Tags/SinceTest.php +++ b/tests/unit/DocBlock/Tags/SinceTest.php @@ -158,15 +158,6 @@ public function testFactoryMethodCreatesEmptySinceTag() $this->assertSame(null, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfSinceIsNotString() - { - $this->assertNull(Since::create([])); - } - /** * @covers ::create */ diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index 289b7572..632bcd91 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -168,15 +168,6 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() Source::create('', $descriptionFactory); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - Source::create([]); - } - /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 3adf2bb7..6e4dec3e 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -142,15 +142,6 @@ public function testFactoryMethod() $this->assertSame($description, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - $this->assertNull(Throws::create([])); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index 30c27cb2..e8fcb14f 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -145,15 +145,6 @@ public function testFactoryMethod() $this->assertSame($description, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - $this->assertNull(Uses::create([])); - } - /** * @covers ::create * @expectedException \InvalidArgumentException diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 57de21e5..3b994c51 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -182,15 +182,6 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() Var_::create('', new TypeResolver(), $descriptionFactory); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfBodyIsNotString() - { - Var_::create([]); - } - /** * @covers ::create * @expectedException \InvalidArgumentException @@ -209,13 +200,4 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() { Var_::create('body', new TypeResolver()); } - - /** - * @covers ::__construct - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfVariableNameIsNotString() - { - new Var_([]); - } } diff --git a/tests/unit/DocBlock/Tags/VersionTest.php b/tests/unit/DocBlock/Tags/VersionTest.php index 562d315c..2e5837d0 100644 --- a/tests/unit/DocBlock/Tags/VersionTest.php +++ b/tests/unit/DocBlock/Tags/VersionTest.php @@ -157,15 +157,6 @@ public function testFactoryMethodCreatesEmptyVersionTag() $this->assertSame(null, $fixture->getDescription()); } - /** - * @covers ::create - * @expectedException \InvalidArgumentException - */ - public function testFactoryMethodFailsIfVersionIsNotString() - { - $this->assertNull(Version::create([])); - } - /** * @covers ::create */ From 5e1bad36287330a089da7c20c9129e2d14c06123 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:24:51 +0100 Subject: [PATCH 006/126] drop asserts where not needed --- examples/04-adding-your-own-tag.php | 1 - src/DocBlock.php | 7 ------- src/DocBlock/Serializer.php | 8 +------- src/DocBlock/Tags/Author.php | 2 -- src/DocBlock/Tags/Link.php | 2 -- src/DocBlock/Tags/Since.php | 1 - 6 files changed, 1 insertion(+), 20 deletions(-) diff --git a/examples/04-adding-your-own-tag.php b/examples/04-adding-your-own-tag.php index 2215a469..e3c5ee6f 100644 --- a/examples/04-adding-your-own-tag.php +++ b/examples/04-adding-your-own-tag.php @@ -86,7 +86,6 @@ public function __construct(Description $description = null) */ public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag { - Assert::string($body); Assert::notNull($descriptionFactory); return new static($descriptionFactory->create($body, $context)); diff --git a/src/DocBlock.php b/src/DocBlock.php index b94525d3..22637322 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -56,9 +56,6 @@ public function __construct( bool $isTemplateStart = false, bool $isTemplateEnd = false ) { - Assert::string($summary); - Assert::boolean($isTemplateStart); - Assert::boolean($isTemplateEnd); Assert::allIsInstanceOf($tags, Tag::class); $this->summary = $summary; @@ -166,8 +163,6 @@ public function getTags() */ public function getTagsByName(string $name) { - Assert::string($name); - $result = []; /** @var Tag $tag */ @@ -191,8 +186,6 @@ public function getTagsByName(string $name) */ public function hasTag(string $name): bool { - Assert::string($name); - /** @var Tag $tag */ foreach ($this->getTags() as $tag) { if ($tag->getName() === $name) { diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 1ed4a2cf..8c15dfef 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -45,14 +45,8 @@ class Serializer * @param int|null $lineLength The max length of a line or NULL to disable line wrapping. * @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. */ - public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, int $lineLength = null, DocBlock\Tags\Formatter $tagFormatter = null) + public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, ?int $lineLength = null, ?DocBlock\Tags\Formatter $tagFormatter = null) { - Assert::integer($indent); - Assert::string($indentString); - Assert::boolean($indentFirstLine); - Assert::nullOrInteger($lineLength); - Assert::nullOrIsInstanceOf($tagFormatter, 'phpDocumentor\Reflection\DocBlock\Tags\Formatter'); - $this->indent = $indent; $this->indentString = $indentString; $this->isFirstLineIndented = $indentFirstLine; diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index 212cc49f..38cf5804 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -84,8 +84,6 @@ public function __toString(): string */ public static function create(string $body) { - Assert::string($body); - $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); if (!$splitTagContent) { return null; diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 5b1cb39c..69cf5cfd 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -35,8 +35,6 @@ final class Link extends BaseTag implements Factory\StaticMethod */ public function __construct(string $link, Description $description = null) { - Assert::string($link); - $this->link = $link; $this->description = $description; } diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 03cb44ed..b403cda1 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -60,7 +60,6 @@ public static function create( DescriptionFactory $descriptionFactory = null, TypeContext $context = null ) { - Assert::nullOrString($body); if (empty($body)) { return new static(); } From b2e816c8ad32c32257e3a3d83dc53f94548109b7 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:27:17 +0100 Subject: [PATCH 007/126] fix tests --- src/DocBlock/TagFactory.php | 2 +- tests/unit/DocBlockFactoryTest.php | 2 ++ tests/unit/DocBlockTest.php | 54 ------------------------------ 3 files changed, 3 insertions(+), 55 deletions(-) diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 9f7a63a0..1ed808fe 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -67,7 +67,7 @@ public function addService($service); * * @return Tag A new tag object. */ - public function create(string $tagLine, TypeContext $context = null): Tag; + public function create(string $tagLine, TypeContext $context = null): ?Tag; /** * Registers a handler for tags. diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 85be2a1e..7822e554 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -263,6 +263,8 @@ public function testTagsWithContextNamespace() $tagFactoryMock->shouldReceive('create')->with(m::any(), $context)->andReturn(new Param('param')); $docblock = $fixture->create('/** @param MyType $param */', $context); + + $this->assertInstanceOf(DocBlock::class, $docblock); } /** diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 3ea7e235..0bf2a0f7 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -48,36 +48,6 @@ public function testDocBlockCanHaveASummary() $this->assertSame($summary, $fixture->getSummary()); } - /** - * @covers ::__construct - * - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfSummaryIsNotAString() - { - new DocBlock([]); - } - - /** - * @covers ::__construct - * - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfTemplateStartIsNotABoolean() - { - new DocBlock('', null, [], null, null, ['is not boolean']); - } - - /** - * @covers ::__construct - * - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfTemplateEndIsNotABoolean() - { - new DocBlock('', null, [], null, null, false, ['is not boolean']); - } - /** * @covers ::__construct * @covers ::getDescription @@ -154,18 +124,6 @@ public function testFindTagsInDocBlockByName() $this->assertSame([], $fixture->getTagsByName('Ebcd')); } - /** - * @covers ::__construct - * @covers ::getTagsByName - * @uses \phpDocumentor\Reflection\DocBlock\Description - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfNameForTagsIsNotString() - { - $fixture = new DocBlock(); - $fixture->getTagsByName([]); - } - /** * @covers ::__construct * @covers ::hasTag @@ -191,18 +149,6 @@ public function testCheckIfThereAreTagsWithAGivenName() $this->assertFalse($fixture->hasTag('Ebcd')); } - /** - * @covers ::__construct - * @covers ::hasTag - * @uses \phpDocumentor\Reflection\DocBlock\Description - * @expectedException \InvalidArgumentException - */ - public function testExceptionIsThrownIfNameForCheckingTagsIsNotString() - { - $fixture = new DocBlock(); - $fixture->hasTag([]); - } - /** * @covers ::__construct * @covers ::getContext From 154c85b680690f6b140a87f22ad493f2fd866da4 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:29:36 +0100 Subject: [PATCH 008/126] remove unused namespaces --- src/DocBlock/Description.php | 1 - src/DocBlock/Serializer.php | 1 - src/DocBlock/Tags/Author.php | 1 - src/DocBlock/Tags/Generic.php | 2 +- tests/unit/DocBlock/Tags/AuthorTest.php | 1 + 5 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index 811a0f70..d4bc1126 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -15,7 +15,6 @@ use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; -use Webmozart\Assert\Assert; /** * Object representing to description for a DocBlock. diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 8c15dfef..70ae83cb 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -14,7 +14,6 @@ namespace phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock; -use Webmozart\Assert\Assert; /** * Converts a DocBlock back from an object to a complete DocComment including Asterisks. diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index 38cf5804..3b1be27d 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; -use Webmozart\Assert\Assert; /** * Reflection class for an {@}author tag in a Docblock. diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index 6ad1c8eb..afe87d70 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -68,7 +68,7 @@ public static function create( */ public function __toString(): string { - return ($this->description ? $this->description->render() : ''); + return $this->description ? $this->description->render() : ''; } /** diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 61b90ca1..95886147 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -10,6 +10,7 @@ * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ + namespace phpDocumentor\Reflection\DocBlock\Tags; use Mockery as m; From 0bac84ee68d44d6df2b30a5d50ec09d036bfe254 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:32:26 +0100 Subject: [PATCH 009/126] remove unused docblocks --- src/DocBlock.php | 10 --------- src/DocBlock/Description.php | 6 ----- src/DocBlock/DescriptionFactory.php | 7 ------ src/DocBlock/ExampleFinder.php | 22 ------------------- src/DocBlock/Serializer.php | 14 ------------ src/DocBlock/StandardTagFactory.php | 11 ---------- src/DocBlock/TagFactory.php | 7 ------ src/DocBlock/Tags/Author.php | 6 ----- src/DocBlock/Tags/Covers.php | 4 ---- src/DocBlock/Tags/Example.php | 12 ---------- .../Tags/Formatter/AlignFormatter.php | 3 --- .../Tags/Formatter/PassthroughFormatter.php | 3 --- src/DocBlock/Tags/Generic.php | 8 ------- src/DocBlock/Tags/Link.php | 10 ++------- src/DocBlock/Tags/Method.php | 2 -- src/DocBlock/Tags/Param.php | 9 -------- src/DocBlock/Tags/Property.php | 8 ------- src/DocBlock/Tags/PropertyRead.php | 8 ------- src/DocBlock/Tags/PropertyWrite.php | 8 ------- src/DocBlock/Tags/See.php | 4 ---- src/DocBlock/Tags/Since.php | 2 -- src/DocBlock/Tags/Uses.php | 4 ---- src/DocBlock/Tags/Var_.php | 8 ------- src/DocBlock/Tags/Version.php | 2 -- src/DocBlockFactory.php | 7 ------ tests/unit/DocBlock/Tags/MethodTest.php | 3 --- 26 files changed, 2 insertions(+), 186 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 22637322..4d29e63f 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -40,12 +40,9 @@ final class DocBlock private $isTemplateEnd = false; /** - * @param string $summary * @param DocBlock\Tag[] $tags * @param Types\Context $context The context in which the DocBlock occurs. * @param Location $location The location within the file that this DocBlock occurs in. - * @param bool $isTemplateStart - * @param bool $isTemplateEnd */ public function __construct( string $summary = '', @@ -71,9 +68,6 @@ public function __construct( $this->isTemplateStart = $isTemplateStart; } - /** - * @return string - */ public function getSummary(): string { return $this->summary; @@ -181,8 +175,6 @@ public function getTagsByName(string $name) * Checks if a tag of a certain type is present in this DocBlock. * * @param string $name Tag name to check for. - * - * @return bool */ public function hasTag(string $name): bool { @@ -200,7 +192,6 @@ public function hasTag(string $name): bool * Remove a tag from this DocBlock. * * @param Tag $tag The tag to remove. - * */ public function removeTag(Tag $tagToRemove) { @@ -216,7 +207,6 @@ public function removeTag(Tag $tagToRemove) * Adds a tag to this DocBlock. * * @param Tag $tag The tag to add. - * */ private function addTag(Tag $tag) { diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index d4bc1126..d34c9445 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -59,7 +59,6 @@ class Description /** * Initializes a Description with its body (template) and a listing of the tags used in the body template. * - * @param string $bodyTemplate * @param Tag[] $tags */ public function __construct(string $bodyTemplate, array $tags = []) @@ -81,9 +80,6 @@ public function getTags() /** * Renders this description as a string where the provided formatter will format the tags in the expected string * format. - * - * - * @return string */ public function render(Formatter $formatter = null): string { @@ -101,8 +97,6 @@ public function render(Formatter $formatter = null): string /** * Returns a plain string representation of this description. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 54453f68..532788d0 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -39,7 +39,6 @@ class DescriptionFactory /** * Initializes this factory with the means to construct (inline) tags. - * */ public function __construct(TagFactory $tagFactory) { @@ -49,7 +48,6 @@ public function __construct(TagFactory $tagFactory) /** * Returns the parsed text of this description. * - * @param string $contents * * @return Description */ @@ -63,7 +61,6 @@ public function create(string $contents, TypeContext $context = null): Descripti /** * Strips the contents from superfluous whitespace and splits the description into a series of tokens. * - * @param string $contents * * @return string[] A series of tokens of which the description text is composed. */ @@ -149,10 +146,6 @@ private function parse($tokens, TypeContext $context) * * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent * lines and this may cause rendering issues when, for example, using a Markdown converter. - * - * @param string $contents - * - * @return string */ private function removeSuperfluousStartingWhitespace(string $contents): string { diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 8b77160f..0e9290a6 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -28,9 +28,6 @@ class ExampleFinder /** * Attempts to find the example contents for the given descriptor. - * - * - * @return string */ public function find(Example $example): string { @@ -46,9 +43,6 @@ public function find(Example $example): string /** * Registers the project's root directory where an 'examples' folder can be expected. - * - * @param string $directory - * */ public function setSourceDirectory(string $directory = '') { @@ -57,8 +51,6 @@ public function setSourceDirectory(string $directory = '') /** * Returns the project's root directory where an 'examples' folder can be expected. - * - * @return string */ public function getSourceDirectory(): string { @@ -96,7 +88,6 @@ public function getExampleDirectories() * 3. Checks the 'examples' folder in the current working directory for examples * 4. Checks the path relative to the current working directory for the given filename * - * @param string $filename * * @return string|null */ @@ -127,10 +118,6 @@ private function getExampleFileContents(string $filename) /** * Get example filepath based on the example directory inside your project. - * - * @param string $file - * - * @return string */ private function getExamplePathFromExampleDirectory(string $file): string { @@ -139,11 +126,6 @@ private function getExamplePathFromExampleDirectory(string $file): string /** * Returns a path to the example file in the given directory.. - * - * @param string $directory - * @param string $file - * - * @return string */ private function constructExamplePath(string $directory, string $file): string { @@ -152,10 +134,6 @@ private function constructExamplePath(string $directory, string $file): string /** * Get example filepath based on sourcecode. - * - * @param string $file - * - * @return string */ private function getExamplePathFromSource(string $file): string { diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 70ae83cb..9670c166 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -88,8 +88,6 @@ public function getDocComment(DocBlock $docblock): string } /** - * @param $indent - * @param $text * @return mixed */ private function removeTrailingSpaces($indent, $text) @@ -98,8 +96,6 @@ private function removeTrailingSpaces($indent, $text) } /** - * @param $indent - * @param $text * @return mixed */ private function addAsterisksForEachLine($indent, $text) @@ -107,10 +103,6 @@ private function addAsterisksForEachLine($indent, $text) return str_replace("\n", "\n{$indent} * ", $text); } - /** - * @param $wrapLength - * @return string - */ private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string { $text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription() @@ -123,12 +115,6 @@ private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLeng return $text; } - /** - * @param $wrapLength - * @param $indent - * @param $comment - * @return string - */ private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment): string { foreach ($docblock->getTags() as $tag) { diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 736afe59..1612e315 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -160,7 +160,6 @@ public function registerTagHandler(string $tagName, string $handler) /** * Extracts all components for a tag. * - * @param string $tagLine * * @return string[] */ @@ -184,8 +183,6 @@ private function extractTagParts(string $tagLine) * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. * - * @param string $body - * @param string $name * * @return Tag|null */ @@ -202,10 +199,6 @@ private function createTag(string $body, string $name, TypeContext $context) /** * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). - * - * @param string $tagName - * - * @return string */ private function findHandlerClassName(string $tagName, TypeContext $context): string { @@ -258,7 +251,6 @@ private function getArgumentsForParametersFromWiring($parameters, $locator) * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given * tag handler class name. * - * @param string $handlerClassName * * @return \ReflectionParameter[] */ @@ -299,11 +291,8 @@ private function getServiceLocatorWithDynamicParameters(TypeContext $context, st /** * Returns whether the given tag belongs to an annotation. * - * @param string $tagContent * * @todo this method should be populated once we implement Annotation notation support. - * - * @return bool */ private function isAnnotation(string $tagContent): bool { diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 1ed808fe..ae0e0022 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -37,8 +37,6 @@ interface TagFactory * * @param string $name * @param mixed $value - * - * @return void */ public function addParameter(string $name, $value); @@ -52,9 +50,6 @@ public function addParameter(string $name, $value); * interface is passed as alias then every time that interface is requested the provided service will be returned. * * @param object $service - * @param string $alias - * - * @return void */ public function addService($service); @@ -86,8 +81,6 @@ public function create(string $tagLine, TypeContext $context = null): ?Tag; * @throws \InvalidArgumentException if the handler is not a string * @throws \InvalidArgumentException if the handler is not an existing class * @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface - * - * @return void */ public function registerTagHandler(string $tagName, string $handler); } diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index 3b1be27d..a8e6e3aa 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -30,9 +30,6 @@ final class Author extends BaseTag implements Factory\StaticMethod /** * Initializes this tag with the author name and e-mail. - * - * @param string $authorName - * @param string $authorEmail */ public function __construct(string $authorName, string $authorEmail) { @@ -66,8 +63,6 @@ public function getEmail(): string /** * Returns this tag in string form. - * - * @return string */ public function __toString(): string { @@ -77,7 +72,6 @@ public function __toString(): string /** * Attempts to create a new Author object based on †he tag body. * - * @param string $body * * @return static */ diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 2784289d..0de91f7b 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -32,8 +32,6 @@ final class Covers extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. - * - * @param Description $description */ public function __construct(Fqsen $refers, Description $description = null) { @@ -72,8 +70,6 @@ public function getReference(): Fqsen /** * Returns a string representation of this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 8c923559..7c2cfcc0 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -138,8 +138,6 @@ public function getFilePath(): string /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { @@ -148,27 +146,17 @@ public function __toString(): string /** * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). - * - * @param string $uri - * - * @return bool */ private function isUriRelative(string $uri): bool { return false === strpos($uri, ':'); } - /** - * @return int - */ public function getStartingLine(): int { return $this->startingLine; } - /** - * @return int - */ public function getLineCount(): int { return $this->lineCount; diff --git a/src/DocBlock/Tags/Formatter/AlignFormatter.php b/src/DocBlock/Tags/Formatter/AlignFormatter.php index a529782e..ac908e31 100644 --- a/src/DocBlock/Tags/Formatter/AlignFormatter.php +++ b/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -36,9 +36,6 @@ public function __construct(array $tags) /** * Formats the given tag to return a simple plain text version. - * - * - * @return string */ public function format(Tag $tag): string { diff --git a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php index 18d672d6..3676cd50 100644 --- a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php +++ b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -20,9 +20,6 @@ class PassthroughFormatter implements Formatter { /** * Formats the given tag to return a simple plain text version. - * - * - * @return string */ public function format(Tag $tag): string { diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index afe87d70..63604bc4 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -41,9 +41,6 @@ public function __construct(string $name, Description $description = null) /** * Creates a new tag that represents any unknown tag type. * - * @param string $body - * @param string $name - * @param TypeContext $context * * @return static */ @@ -63,8 +60,6 @@ public static function create( /** * Returns the tag as a serialized string - * - * @return string */ public function __toString(): string { @@ -73,9 +68,6 @@ public function __toString(): string /** * Validates if the tag name matches the expected format, otherwise throws an exception. - * - * @param string $name - * */ private function validateTagName(string $name) { diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 69cf5cfd..2e76a548 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -30,8 +30,6 @@ final class Link extends BaseTag implements Factory\StaticMethod /** * Initializes a link to a URL. - * - * @param string $link */ public function __construct(string $link, Description $description = null) { @@ -53,10 +51,8 @@ public static function create(string $body, DescriptionFactory $descriptionFacto } /** - * Gets the link - * - * @return string - */ + * Gets the link + */ public function getLink(): string { return $this->link; @@ -64,8 +60,6 @@ public function getLink(): string /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 65ceb448..ab04af27 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -161,8 +161,6 @@ public static function create( /** * Retrieves the method name. - * - * @return string */ public function getMethodName(): string { diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 249f777a..62a89b18 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -37,11 +37,6 @@ final class Param extends BaseTag implements Factory\StaticMethod /** @var bool determines whether this is a variadic argument */ private $isVariadic = false; - /** - * @param string $variableName - * @param bool $isVariadic - * @param Description $description - */ public function __construct(string $variableName, Type $type = null, bool $isVariadic = false, Description $description = null) { $this->variableName = $variableName; @@ -95,8 +90,6 @@ public static function create( /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -125,8 +118,6 @@ public function isVariadic(): bool /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 23618b13..aaebec6c 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -34,10 +34,6 @@ class Property extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ public static function create( /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ public function getType() /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index c210fac1..6f44b22e 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -34,10 +34,6 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ public static function create( /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ public function getType() /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 1bba03eb..2940d051 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -34,10 +34,6 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ public static function create( /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ public function getType() /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 64a45042..2562fbb0 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -34,8 +34,6 @@ class See extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. - * - * @param Description $description */ public function __construct(Reference $refers, Description $description = null) { @@ -77,8 +75,6 @@ public function getReference(): Reference /** * Returns a string representation of this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index b403cda1..aee5a114 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -85,8 +85,6 @@ public function getVersion(): ?string /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index d9412e4b..25cfa2d1 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -32,8 +32,6 @@ final class Uses extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. - * - * @param Fqsen $refers */ public function __construct(Fqsen $refers, Description $description = null) { @@ -72,8 +70,6 @@ public function getReference(): Fqsen /** * Returns a string representation of this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 3f3c91d3..37b4fa40 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -34,10 +34,6 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ public static function create( /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ public function getType() /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 1f0fc53f..9bc78b38 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -85,8 +85,6 @@ public function getVersion(): ?string /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 246b74bb..e3c364e3 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -29,8 +29,6 @@ final class DocBlockFactory implements DocBlockFactoryInterface /** * Initializes this factory with the required subcontractors. - * - * @param TagFactory $tagFactory */ public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory) { @@ -65,7 +63,6 @@ public static function createInstance(array $additionalTags = []): DocBlockFacto /** * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the * getDocComment method (such as a ReflectionClass object). - * @param Location $location * * @return DocBlock */ @@ -111,8 +108,6 @@ public function registerTagHandler($tagName, $handler) * Strips the asterisks from the DocBlock comment. * * @param string $comment String containing the comment text. - * - * @return string */ private function stripDocComment(string $comment): string { @@ -234,8 +229,6 @@ private function parseTagBlock(string $tags, Types\Context $context): array } /** - * @param string $tags - * * @return string[] */ private function splitTagBlockIntoTagLines(string $tags) diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index b6d1b017..23b6dd4e 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -342,9 +342,6 @@ public function collectionReturnTypesProvider() * @uses \phpDocumentor\Reflection\Types\Compound * @uses \phpDocumentor\Reflection\Types\Integer * @uses \phpDocumentor\Reflection\Types\Object_ - * @param string $returnType - * @param string $expectedType - * @param string $expectedValueType * @param string null $expectedKeyType */ public function testCollectionReturnTypes( From f9d1a0c17707f04c3f2e72fdb2b5e3dc07fe99a4 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:34:30 +0100 Subject: [PATCH 010/126] travis + composer: bump to PHP 7.1 --- .travis.yml | 1 - composer.json | 18 +++++++++++------- composer.lock | 22 +++++++++++----------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/.travis.yml b/.travis.yml index 87225891..ce37fcd2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: php php: - - 7.0 - 7.1 - 7.2 diff --git a/composer.json b/composer.json index e3dc38a9..a0631dfa 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "phpdocumentor/reflection-docblock", + "name": "phpdocumentor/reflection-docblock", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", "type": "library", "license": "MIT", @@ -10,21 +10,25 @@ } ], "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", + "php": "^7.1", + "phpdocumentor/reflection-common": "^1.0", + "phpdocumentor/type-resolver": "^0.4", "webmozart/assert": "^1.0" }, "autoload": { - "psr-4": {"phpDocumentor\\Reflection\\": ["src/"]} + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } }, "autoload-dev": { - "psr-4": {"phpDocumentor\\Reflection\\": ["tests/unit"]} + "psr-4": { + "phpDocumentor\\Reflection\\": "tests/unit" + } }, "require-dev": { "mockery/mockery": "^1.0", "phpunit/phpunit": "^6.4", - "doctrine/instantiator": "~1.0.5" + "doctrine/instantiator": "^1.0" }, "extra": { "branch-alias": { diff --git a/composer.lock b/composer.lock index dc23bcdc..0cabfa40 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f69122debe760b39f6a8eb6eb737b30a", + "content-hash": "2a242eca1a53d53cacb1e5bb03e62846", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -161,32 +161,32 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.0.5", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", - "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", "shasum": "" }, "require": { - "php": ">=5.3,<8.0-DEV" + "php": "^7.1" }, "require-dev": { "athletic/athletic": "~0.1.8", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "~2.0" + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -211,7 +211,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14T21:17:01+00:00" + "time": "2017-07-22T11:58:36+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -1535,7 +1535,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.0" + "php": "^7.1" }, "platform-dev": [] } From 4a9675841b9cb53d0b9ef147575db8cdfc277950 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:38:51 +0100 Subject: [PATCH 011/126] add PHP 7.1 typehints --- src/DocBlock.php | 13 ++-- src/DocBlock/Description.php | 2 +- src/DocBlock/DescriptionFactory.php | 5 +- src/DocBlock/ExampleFinder.php | 7 +-- src/DocBlock/StandardTagFactory.php | 17 +++--- src/DocBlock/Tag.php | 9 ++- src/DocBlock/TagFactory.php | 9 ++- src/DocBlock/Tags/BaseTag.php | 2 +- src/DocBlock/Tags/Covers.php | 9 ++- src/DocBlock/Tags/Deprecated.php | 11 ++-- src/DocBlock/Tags/Factory/StaticMethod.php | 3 + src/DocBlock/Tags/Factory/Strategy.php | 2 +- src/DocBlock/Tags/Formatter.php | 1 - src/DocBlock/Tags/Generic.php | 8 +-- src/DocBlock/Tags/Link.php | 4 +- src/DocBlock/Tags/Method.php | 16 ++--- src/DocBlock/Tags/Param.php | 12 ++-- src/DocBlock/Tags/Property.php | 11 ++-- src/DocBlock/Tags/PropertyRead.php | 11 ++-- src/DocBlock/Tags/PropertyWrite.php | 11 ++-- src/DocBlock/Tags/Reference/Reference.php | 2 +- src/DocBlock/Tags/Reference/Url.php | 2 +- src/DocBlock/Tags/Return_.php | 12 ++-- src/DocBlock/Tags/See.php | 9 ++- src/DocBlock/Tags/Since.php | 8 +-- src/DocBlock/Tags/Source.php | 10 ++-- src/DocBlock/Tags/Throws.php | 11 ++-- src/DocBlock/Tags/Uses.php | 9 ++- src/DocBlock/Tags/Var_.php | 11 ++-- src/DocBlock/Tags/Version.php | 8 +-- src/DocBlockFactory.php | 6 +- src/DocBlockFactoryInterface.php | 5 +- .../DocblocksWithAnnotationsTest.php | 4 +- .../integration/InterpretingDocBlocksTest.php | 8 +-- .../ReconstitutingADocBlockTest.php | 4 +- tests/integration/UsingTagsTest.php | 4 +- .../unit/DocBlock/DescriptionFactoryTest.php | 12 ++-- tests/unit/DocBlock/DescriptionTest.php | 10 ++-- tests/unit/DocBlock/ExampleFinderTest.php | 6 +- tests/unit/DocBlock/SerializerTest.php | 10 ++-- .../unit/DocBlock/StandardTagFactoryTest.php | 30 +++++----- tests/unit/DocBlock/Tags/AuthorTest.php | 22 +++---- tests/unit/DocBlock/Tags/CoversTest.php | 18 +++--- tests/unit/DocBlock/Tags/DeprecatedTest.php | 12 ++-- tests/unit/DocBlock/Tags/ExampleTest.php | 14 ++--- .../Tags/Formatter/AlignFormatterTest.php | 4 +- .../Formatter/PassthroughFormatterTest.php | 6 +- tests/unit/DocBlock/Tags/GenericTest.php | 18 +++--- tests/unit/DocBlock/Tags/LinkTest.php | 18 +++--- tests/unit/DocBlock/Tags/MethodTest.php | 60 +++++++++---------- tests/unit/DocBlock/Tags/ParamTest.php | 26 ++++---- tests/unit/DocBlock/Tags/PropertyReadTest.php | 24 ++++---- tests/unit/DocBlock/Tags/PropertyTest.php | 24 ++++---- .../unit/DocBlock/Tags/PropertyWriteTest.php | 24 ++++---- tests/unit/DocBlock/Tags/ReturnTest.php | 22 +++---- tests/unit/DocBlock/Tags/SeeTest.php | 24 ++++---- tests/unit/DocBlock/Tags/SinceTest.php | 20 +++---- tests/unit/DocBlock/Tags/SourceTest.php | 26 ++++---- tests/unit/DocBlock/Tags/ThrowsTest.php | 22 +++---- tests/unit/DocBlock/Tags/UsesTest.php | 22 +++---- tests/unit/DocBlock/Tags/VarTest.php | 26 ++++---- tests/unit/DocBlock/Tags/VersionTest.php | 20 +++---- tests/unit/DocBlockFactoryTest.php | 20 +++---- tests/unit/DocBlockTest.php | 24 ++++---- 64 files changed, 410 insertions(+), 430 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 4d29e63f..ca7ab88d 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -46,10 +46,10 @@ final class DocBlock */ public function __construct( string $summary = '', - DocBlock\Description $description = null, + ?DocBlock\Description $description = null, array $tags = [], - Types\Context $context = null, - Location $location = null, + ?Types\Context $context = null, + ?Location $location = null, bool $isTemplateStart = false, bool $isTemplateEnd = false ) { @@ -84,7 +84,6 @@ public function getDescription(): DocBlock\Description /** * Returns the current context. * - * @return Types\Context */ public function getContext(): Types\Context { @@ -118,7 +117,6 @@ public function getLocation(): ?Location * * @see self::isTemplateEnd() for the check whether a closing marker was provided. * - * @return boolean */ public function isTemplateStart(): bool { @@ -130,7 +128,6 @@ public function isTemplateStart(): bool * * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. * - * @return boolean */ public function isTemplateEnd(): bool { @@ -193,7 +190,7 @@ public function hasTag(string $name): bool * * @param Tag $tag The tag to remove. */ - public function removeTag(Tag $tagToRemove) + public function removeTag(Tag $tagToRemove): void { foreach ($this->tags as $key => $tag) { if ($tag === $tagToRemove) { @@ -208,7 +205,7 @@ public function removeTag(Tag $tagToRemove) * * @param Tag $tag The tag to add. */ - private function addTag(Tag $tag) + private function addTag(Tag $tag): void { $this->tags[] = $tag; } diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index d34c9445..f5592618 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -81,7 +81,7 @@ public function getTags() * Renders this description as a string where the provided formatter will format the tags in the expected string * format. */ - public function render(Formatter $formatter = null): string + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new PassthroughFormatter(); diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 532788d0..1aafb4d5 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -49,11 +49,10 @@ public function __construct(TagFactory $tagFactory) * Returns the parsed text of this description. * * - * @return Description */ - public function create(string $contents, TypeContext $context = null): Description + public function create(string $contents, ?TypeContext $context = null): Description { - list($text, $tags) = $this->parse($this->lex($contents), $context); + [$text, $tags] = $this->parse($this->lex($contents), $context); return new Description($text, $tags); } diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 0e9290a6..2ac7b456 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -44,7 +44,7 @@ public function find(Example $example): string /** * Registers the project's root directory where an 'examples' folder can be expected. */ - public function setSourceDirectory(string $directory = '') + public function setSourceDirectory(string $directory = ''): void { $this->sourceDirectory = $directory; } @@ -62,7 +62,7 @@ public function getSourceDirectory(): string * * @param string[] $directories */ - public function setExampleDirectories(array $directories) + public function setExampleDirectories(array $directories): void { $this->exampleDirectories = $directories; } @@ -89,9 +89,8 @@ public function getExampleDirectories() * 4. Checks the path relative to the current working directory for the given filename * * - * @return string|null */ - private function getExampleFileContents(string $filename) + private function getExampleFileContents(string $filename): ?string { $normalizedPath = null; diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 1612e315..237d3c35 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -39,7 +39,7 @@ final class StandardTagFactory implements TagFactory { /** PCRE regular expression matching a tag name. */ - const REGEX_TAGNAME = '[\w\-\_\\\\]+'; + public const REGEX_TAGNAME = '[\w\-\_\\\\]+'; /** * @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value. @@ -92,7 +92,7 @@ final class StandardTagFactory implements TagFactory * * @see self::registerTagHandler() to add a new tag handler to the existing default list. */ - public function __construct(FqsenResolver $fqsenResolver, array $tagHandlers = null) + public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers = null) { $this->fqsenResolver = $fqsenResolver; if ($tagHandlers !== null) { @@ -105,13 +105,13 @@ public function __construct(FqsenResolver $fqsenResolver, array $tagHandlers = n /** * {@inheritDoc} */ - public function create(string $tagLine, TypeContext $context = null): Tag + public function create(string $tagLine, ?TypeContext $context = null): Tag { if (! $context) { $context = new TypeContext(''); } - list($tagName, $tagBody) = $this->extractTagParts($tagLine); + [$tagName, $tagBody] = $this->extractTagParts($tagLine); if ($tagBody !== '' && $tagBody[0] === '[') { throw new \InvalidArgumentException( @@ -125,7 +125,7 @@ public function create(string $tagLine, TypeContext $context = null): Tag /** * {@inheritDoc} */ - public function addParameter(string $name, $value) + public function addParameter(string $name, $value): void { $this->serviceLocator[$name] = $value; } @@ -133,7 +133,7 @@ public function addParameter(string $name, $value) /** * {@inheritDoc} */ - public function addService($service, $alias = null) + public function addService($service, $alias = null): void { $this->serviceLocator[$alias ?: get_class($service)] = $service; } @@ -141,7 +141,7 @@ public function addService($service, $alias = null) /** * {@inheritDoc} */ - public function registerTagHandler(string $tagName, string $handler) + public function registerTagHandler(string $tagName, string $handler): void { Assert::stringNotEmpty($tagName); Assert::stringNotEmpty($handler); @@ -184,9 +184,8 @@ private function extractTagParts(string $tagLine) * body was invalid. * * - * @return Tag|null */ - private function createTag(string $body, string $name, TypeContext $context) + private function createTag(string $body, string $name, TypeContext $context): ?Tag { $handlerClassName = $this->findHandlerClassName($name, $context); $arguments = $this->getArgumentsForParametersFromWiring( diff --git a/src/DocBlock/Tag.php b/src/DocBlock/Tag.php index e6d4b88c..bcd37cf6 100644 --- a/src/DocBlock/Tag.php +++ b/src/DocBlock/Tag.php @@ -17,11 +17,14 @@ interface Tag { - public function getName(); + public function getName(): string; + /** + * @return Tag Class that implements Tag + */ public static function create(string $body); - public function render(Formatter $formatter = null); + public function render(?Formatter $formatter = null): string; - public function __toString(); + public function __toString(): string; } diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index ae0e0022..34a3cb69 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -35,10 +35,9 @@ interface TagFactory * * These parameters are injected at the last moment and will override any existing parameter with those names. * - * @param string $name * @param mixed $value */ - public function addParameter(string $name, $value); + public function addParameter(string $name, $value): void; /** * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. @@ -51,7 +50,7 @@ public function addParameter(string $name, $value); * * @param object $service */ - public function addService($service); + public function addService($service): void; /** * Factory method responsible for instantiating the correct sub type. @@ -62,7 +61,7 @@ public function addService($service); * * @return Tag A new tag object. */ - public function create(string $tagLine, TypeContext $context = null): ?Tag; + public function create(string $tagLine, ?TypeContext $context = null): ?Tag; /** * Registers a handler for tags. @@ -82,5 +81,5 @@ public function create(string $tagLine, TypeContext $context = null): ?Tag; * @throws \InvalidArgumentException if the handler is not an existing class * @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface */ - public function registerTagHandler(string $tagName, string $handler); + public function registerTagHandler(string $tagName, string $handler): void; } diff --git a/src/DocBlock/Tags/BaseTag.php b/src/DocBlock/Tags/BaseTag.php index 2fbe5583..2e2260c1 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -42,7 +42,7 @@ public function getDescription() return $this->description; } - public function render(Formatter $formatter = null) + public function render(?Formatter $formatter = null): string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 0de91f7b..e92ee681 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -33,7 +33,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. */ - public function __construct(Fqsen $refers, Description $description = null) + public function __construct(Fqsen $refers, ?Description $description = null) { $this->refers = $refers; $this->description = $description; @@ -44,9 +44,9 @@ public function __construct(Fqsen $refers, Description $description = null) */ public static function create( string $body, - DescriptionFactory $descriptionFactory = null, - FqsenResolver $resolver = null, - TypeContext $context = null + ?DescriptionFactory $descriptionFactory = null, + ?FqsenResolver $resolver = null, + ?TypeContext $context = null ) { Assert::notEmpty($body); @@ -61,7 +61,6 @@ public static function create( /** * Returns the structural element this tag refers to. * - * @return Fqsen */ public function getReference(): Fqsen { diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 85f9f5e2..daddd11f 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -29,7 +29,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod * PCRE regular expression matching a version vector. * Assumes the "x" modifier. */ - const REGEX_VECTOR = '(?: + public const REGEX_VECTOR = '(?: # Normal release vectors. \d\S* | @@ -44,7 +44,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod /** @var string The version vector. */ private $version = ''; - public function __construct($version = null, Description $description = null) + public function __construct($version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); @@ -57,8 +57,8 @@ public function __construct($version = null, Description $description = null) */ public static function create( ?string $body, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { if (empty($body)) { return new static(); @@ -81,9 +81,8 @@ public static function create( /** * Gets the version section of the tag. * - * @return string|null */ - public function getVersion() + public function getVersion(): ?string { return $this->version; } diff --git a/src/DocBlock/Tags/Factory/StaticMethod.php b/src/DocBlock/Tags/Factory/StaticMethod.php index b0673bd0..ada9676e 100644 --- a/src/DocBlock/Tags/Factory/StaticMethod.php +++ b/src/DocBlock/Tags/Factory/StaticMethod.php @@ -15,5 +15,8 @@ interface StaticMethod { + /** + * @return mixed + */ public static function create(string $body); } diff --git a/src/DocBlock/Tags/Factory/Strategy.php b/src/DocBlock/Tags/Factory/Strategy.php index 29769eea..1b7afdb6 100644 --- a/src/DocBlock/Tags/Factory/Strategy.php +++ b/src/DocBlock/Tags/Factory/Strategy.php @@ -15,5 +15,5 @@ interface Strategy { - public function create($body); + public function create($body): void; } diff --git a/src/DocBlock/Tags/Formatter.php b/src/DocBlock/Tags/Formatter.php index 0b456761..ce285f54 100644 --- a/src/DocBlock/Tags/Formatter.php +++ b/src/DocBlock/Tags/Formatter.php @@ -21,7 +21,6 @@ interface Formatter * Formats a tag into a string representation according to a specific format, such as Markdown. * * - * @return string */ public function format(Tag $tag): string; } diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index 63604bc4..0668f34f 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -30,7 +30,7 @@ class Generic extends BaseTag implements Factory\StaticMethod * @param string $name Name of the tag. * @param Description $description The contents of the given tag. */ - public function __construct(string $name, Description $description = null) + public function __construct(string $name, ?Description $description = null) { $this->validateTagName($name); @@ -47,8 +47,8 @@ public function __construct(string $name, Description $description = null) public static function create( string $body, string $name = '', - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); @@ -69,7 +69,7 @@ public function __toString(): string /** * Validates if the tag name matches the expected format, otherwise throws an exception. */ - private function validateTagName(string $name) + private function validateTagName(string $name): void { if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { throw new \InvalidArgumentException( diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 2e76a548..2bbd7715 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -31,7 +31,7 @@ final class Link extends BaseTag implements Factory\StaticMethod /** * Initializes a link to a URL. */ - public function __construct(string $link, Description $description = null) + public function __construct(string $link, ?Description $description = null) { $this->link = $link; $this->description = $description; @@ -40,7 +40,7 @@ public function __construct(string $link, Description $description = null) /** * {@inheritdoc} */ - public static function create(string $body, DescriptionFactory $descriptionFactory = null, TypeContext $context = null) + public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): Link { Assert::notNull($descriptionFactory); diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index ab04af27..0c2c4dfd 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -43,9 +43,9 @@ final class Method extends BaseTag implements Factory\StaticMethod public function __construct( $methodName, array $arguments = [], - Type $returnType = null, + ?Type $returnType = null, $static = false, - Description $description = null + ?Description $description = null ) { Assert::stringNotEmpty($methodName); Assert::boolean($static); @@ -66,10 +66,10 @@ public function __construct( */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null - ) { + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null + ): Method { Assert::stringNotEmpty($body); Assert::allNotNull([ $typeResolver, $descriptionFactory ]); @@ -123,7 +123,7 @@ public static function create( return null; } - list(, $static, $returnType, $methodName, $arguments, $description) = $matches; + [, $static, $returnType, $methodName, $arguments, $description] = $matches; $static = $static === 'static'; @@ -193,7 +193,7 @@ public function getReturnType(): Type return $this->returnType; } - public function __toString() + public function __toString(): string { $arguments = []; foreach ($this->arguments as $argument) { diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 62a89b18..e6fcbdc8 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -37,7 +37,7 @@ final class Param extends BaseTag implements Factory\StaticMethod /** @var bool determines whether this is a variadic argument */ private $isVariadic = false; - public function __construct(string $variableName, Type $type = null, bool $isVariadic = false, Description $description = null) + public function __construct(string $variableName, ?Type $type = null, bool $isVariadic = false, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -50,9 +50,9 @@ public function __construct(string $variableName, Type $type = null, bool $isVar */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -99,9 +99,8 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. * - * @return Type|null */ - public function getType() + public function getType(): ?Type { return $this->type; } @@ -109,7 +108,6 @@ public function getType() /** * Returns whether this tag is variadic. * - * @return boolean */ public function isVariadic(): bool { diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index aaebec6c..8c4f59ad 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -34,7 +34,7 @@ class Property extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - public function __construct(string $variableName, Type $type = null, Description $description = null) + public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -46,9 +46,9 @@ public function __construct(string $variableName, Type $type = null, Description */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -89,9 +89,8 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. * - * @return Type|null */ - public function getType() + public function getType(): ?Type { return $this->type; } diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 6f44b22e..51d6d0df 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -34,7 +34,7 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - public function __construct(string $variableName, Type $type = null, Description $description = null) + public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -46,9 +46,9 @@ public function __construct(string $variableName, Type $type = null, Description */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -89,9 +89,8 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. * - * @return Type|null */ - public function getType() + public function getType(): ?Type { return $this->type; } diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 2940d051..234ac7ed 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -34,7 +34,7 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - public function __construct(string $variableName, Type $type = null, Description $description = null) + public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -46,9 +46,9 @@ public function __construct(string $variableName, Type $type = null, Description */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -89,9 +89,8 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. * - * @return Type|null */ - public function getType() + public function getType(): ?Type { return $this->type; } diff --git a/src/DocBlock/Tags/Reference/Reference.php b/src/DocBlock/Tags/Reference/Reference.php index c02e7f00..4e552527 100644 --- a/src/DocBlock/Tags/Reference/Reference.php +++ b/src/DocBlock/Tags/Reference/Reference.php @@ -18,5 +18,5 @@ */ interface Reference { - public function __toString(); + public function __toString(): string; } diff --git a/src/DocBlock/Tags/Reference/Url.php b/src/DocBlock/Tags/Reference/Url.php index c051a4da..32b20709 100644 --- a/src/DocBlock/Tags/Reference/Url.php +++ b/src/DocBlock/Tags/Reference/Url.php @@ -34,7 +34,7 @@ public function __construct($uri) $this->uri = $uri; } - public function __toString() + public function __toString(): string { return $this->uri; } diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 68aa913d..17e6fd92 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -30,7 +30,7 @@ final class Return_ extends BaseTag implements Factory\StaticMethod /** @var Type */ private $type; - public function __construct(Type $type, Description $description = null) + public function __construct(Type $type, ?Description $description = null) { $this->type = $type; $this->description = $description; @@ -41,9 +41,9 @@ public function __construct(Type $type, Description $description = null) */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -57,15 +57,13 @@ public static function create( /** * Returns the type section of the variable. - * - * @return Type */ public function getType(): Type { return $this->type; } - public function __toString() + public function __toString(): string { return $this->type . ' ' . $this->description; } diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 2562fbb0..453d3130 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -35,7 +35,7 @@ class See extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. */ - public function __construct(Reference $refers, Description $description = null) + public function __construct(Reference $refers, ?Description $description = null) { $this->refers = $refers; $this->description = $description; @@ -46,9 +46,9 @@ public function __construct(Reference $refers, Description $description = null) */ public static function create( string $body, - FqsenResolver $resolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?FqsenResolver $resolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::allNotNull([$resolver, $descriptionFactory]); @@ -66,7 +66,6 @@ public static function create( /** * Returns the ref of this tag. * - * @return Reference */ public function getReference(): Reference { diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index aee5a114..d22a72ae 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -29,7 +29,7 @@ final class Since extends BaseTag implements Factory\StaticMethod * PCRE regular expression matching a version vector. * Assumes the "x" modifier. */ - const REGEX_VECTOR = '(?: + public const REGEX_VECTOR = '(?: # Normal release vectors. \d\S* | @@ -44,7 +44,7 @@ final class Since extends BaseTag implements Factory\StaticMethod /** @var string The version vector. */ private $version = ''; - public function __construct($version = null, Description $description = null) + public function __construct($version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); @@ -57,8 +57,8 @@ public function __construct($version = null, Description $description = null) */ public static function create( ?string $body, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { if (empty($body)) { return new static(); diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index 1fc9e965..cc58a5a4 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -32,7 +32,7 @@ final class Source extends BaseTag implements Factory\StaticMethod /** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */ private $lineCount = null; - public function __construct($startingLine, $lineCount = null, Description $description = null) + public function __construct($startingLine, $lineCount = null, ?Description $description = null) { Assert::integerish($startingLine); Assert::nullOrIntegerish($lineCount); @@ -47,8 +47,8 @@ public function __construct($startingLine, $lineCount = null, Description $descr */ public static function create( string $body, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); @@ -87,12 +87,12 @@ public function getStartingLine(): int * @return int|null The number of lines, relative to the starting line. NULL * means "to the end". */ - public function getLineCount() + public function getLineCount(): ?int { return $this->lineCount; } - public function __toString() + public function __toString(): string { return $this->startingLine . ($this->lineCount !== null ? ' ' . $this->lineCount : '') diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 19b6f9d0..829b014b 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -30,7 +30,7 @@ final class Throws extends BaseTag implements Factory\StaticMethod /** @var Type */ private $type; - public function __construct(Type $type, Description $description = null) + public function __construct(Type $type, ?Description $description = null) { $this->type = $type; $this->description = $description; @@ -41,9 +41,9 @@ public function __construct(Type $type, Description $description = null) */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -58,14 +58,13 @@ public static function create( /** * Returns the type section of the variable. * - * @return Type */ public function getType(): Type { return $this->type; } - public function __toString() + public function __toString(): string { return $this->type . ' ' . $this->description; } diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 25cfa2d1..05acd801 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -33,7 +33,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. */ - public function __construct(Fqsen $refers, Description $description = null) + public function __construct(Fqsen $refers, ?Description $description = null) { $this->refers = $refers; $this->description = $description; @@ -44,9 +44,9 @@ public function __construct(Fqsen $refers, Description $description = null) */ public static function create( string $body, - FqsenResolver $resolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?FqsenResolver $resolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::allNotNull([$resolver, $descriptionFactory]); @@ -61,7 +61,6 @@ public static function create( /** * Returns the structural element this tag refers to. * - * @return Fqsen */ public function getReference(): Fqsen { diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 37b4fa40..f6e0edf6 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -34,7 +34,7 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - public function __construct(string $variableName, Type $type = null, Description $description = null) + public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -46,9 +46,9 @@ public function __construct(string $variableName, Type $type = null, Description */ public static function create( string $body, - TypeResolver $typeResolver = null, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?TypeResolver $typeResolver = null, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -89,9 +89,8 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. * - * @return Type|null */ - public function getType() + public function getType(): ?Type { return $this->type; } diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 9bc78b38..468d99d6 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -29,7 +29,7 @@ final class Version extends BaseTag implements Factory\StaticMethod * PCRE regular expression matching a version vector. * Assumes the "x" modifier. */ - const REGEX_VECTOR = '(?: + public const REGEX_VECTOR = '(?: # Normal release vectors. \d\S* | @@ -44,7 +44,7 @@ final class Version extends BaseTag implements Factory\StaticMethod /** @var string The version vector. */ private $version = ''; - public function __construct($version = null, Description $description = null) + public function __construct($version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); @@ -57,8 +57,8 @@ public function __construct($version = null, Description $description = null) */ public static function create( ?string $body, - DescriptionFactory $descriptionFactory = null, - TypeContext $context = null + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null ) { if (empty($body)) { return new static(); diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index e3c364e3..10e56edd 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -41,7 +41,6 @@ public function __construct(DescriptionFactory $descriptionFactory, TagFactory $ * * @param string[] $additionalTags * - * @return DocBlockFactory */ public static function createInstance(array $additionalTags = []): DocBlockFactory { @@ -64,9 +63,8 @@ public static function createInstance(array $additionalTags = []): DocBlockFacto * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the * getDocComment method (such as a ReflectionClass object). * - * @return DocBlock */ - public function create($docblock, Types\Context $context = null, Location $location = null): DocBlock + public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock { if (is_object($docblock)) { if (!method_exists($docblock, 'getDocComment')) { @@ -99,7 +97,7 @@ public function create($docblock, Types\Context $context = null, Location $locat ); } - public function registerTagHandler($tagName, $handler) + public function registerTagHandler($tagName, $handler): void { $this->tagFactory->registerTagHandler($tagName, $handler); } diff --git a/src/DocBlockFactoryInterface.php b/src/DocBlockFactoryInterface.php index 151134f9..83742a1f 100644 --- a/src/DocBlockFactoryInterface.php +++ b/src/DocBlockFactoryInterface.php @@ -9,15 +9,12 @@ interface DocBlockFactoryInterface * * @param string[] $additionalTags * - * @return DocBlockFactory */ public static function createInstance(array $additionalTags = []): DocBlockFactory; /** * @param string|object $docblock - * @param Location $location * - * @return DocBlock */ - public function create($docblock, Types\Context $context = null, Location $location = null): DocBlock; + public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock; } diff --git a/tests/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php index ffd9c42d..87ee5c4d 100644 --- a/tests/integration/DocblocksWithAnnotationsTest.php +++ b/tests/integration/DocblocksWithAnnotationsTest.php @@ -24,12 +24,12 @@ final class DocblocksWithAnnotationsTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } - public function testDocblockWithAnnotations() + public function testDocblockWithAnnotations(): void { $docComment = <<assertEmpty($docblock->getTags()); } - public function testInterpretingTags() + public function testInterpretingTags(): void { /** * @var DocBlock $docblock @@ -78,7 +78,7 @@ public function testInterpretingTags() $this->assertSame('', (string)$seeTag->getDescription()); } - public function testDescriptionsCanEscapeAtSignsAndClosingBraces() + public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void { /** * @var string $docComment diff --git a/tests/integration/ReconstitutingADocBlockTest.php b/tests/integration/ReconstitutingADocBlockTest.php index 23f54c8b..8ff8fdfc 100644 --- a/tests/integration/ReconstitutingADocBlockTest.php +++ b/tests/integration/ReconstitutingADocBlockTest.php @@ -24,12 +24,12 @@ class ReconstitutingADocBlockTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } - public function testReconstituteADocBlock() + public function testReconstituteADocBlock(): void { /** * @var string $docComment diff --git a/tests/integration/UsingTagsTest.php b/tests/integration/UsingTagsTest.php index ec886a18..dce845d9 100644 --- a/tests/integration/UsingTagsTest.php +++ b/tests/integration/UsingTagsTest.php @@ -26,12 +26,12 @@ class UsingTagsTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } - public function testAddingYourOwnTagUsingAStaticMethodAsFactory() + public function testAddingYourOwnTagUsingAStaticMethodAsFactory(): void { /** * @var object[] $customTagObjects diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php index 9a758e8b..228723f5 100644 --- a/tests/unit/DocBlock/DescriptionFactoryTest.php +++ b/tests/unit/DocBlock/DescriptionFactoryTest.php @@ -27,7 +27,7 @@ class DescriptionFactoryTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -38,7 +38,7 @@ public function tearDown() * @uses phpDocumentor\Reflection\DocBlock\Description * @dataProvider provideSimpleExampleDescriptions */ - public function testDescriptionCanParseASimpleString($contents) + public function testDescriptionCanParseASimpleString($contents): void { $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); @@ -55,7 +55,7 @@ public function testDescriptionCanParseASimpleString($contents) * @uses phpDocumentor\Reflection\DocBlock\Description * @dataProvider provideEscapeSequences */ - public function testEscapeSequences($contents, $expected) + public function testEscapeSequences($contents, $expected): void { $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); @@ -75,7 +75,7 @@ public function testEscapeSequences($contents, $expected) * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses phpDocumentor\Reflection\Types\Context */ - public function testDescriptionCanParseAStringWithInlineTag() + public function testDescriptionCanParseAStringWithInlineTag(): void { $contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'; $context = new Context(''); @@ -100,7 +100,7 @@ public function testDescriptionCanParseAStringWithInlineTag() * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses phpDocumentor\Reflection\Types\Context */ - public function testDescriptionCanParseAStringStartingWithInlineTag() + public function testDescriptionCanParseAStringStartingWithInlineTag(): void { $contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'; $context = new Context(''); @@ -121,7 +121,7 @@ public function testDescriptionCanParseAStringStartingWithInlineTag() * @covers ::create * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testIfSuperfluousStartingSpacesAreRemoved() + public function testIfSuperfluousStartingSpacesAreRemoved(): void { $factory = new DescriptionFactory(m::mock(TagFactory::class)); $descriptionText = <<fixture = new ExampleFinder(); } @@ -34,7 +34,7 @@ public function setUp() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Example * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testFileNotFound() + public function testFileNotFound(): void { $example = new Example('./example.php', false, 1, 0, new Description('Test')); $this->assertSame('** File not found : ./example.php **', $this->fixture->find($example)); diff --git a/tests/unit/DocBlock/SerializerTest.php b/tests/unit/DocBlock/SerializerTest.php index 5e6caaa6..20ac8620 100644 --- a/tests/unit/DocBlock/SerializerTest.php +++ b/tests/unit/DocBlock/SerializerTest.php @@ -26,7 +26,7 @@ class SerializerTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testReconstructsADocCommentFromADocBlock() + public function testReconstructsADocCommentFromADocBlock(): void { $expected = <<<'DOCCOMMENT' /** @@ -74,7 +74,7 @@ public function testReconstructsADocCommentFromADocBlock() * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testAddPrefixToDocBlock() + public function testAddPrefixToDocBlock(): void { $expected = <<<'DOCCOMMENT' aa/** @@ -108,7 +108,7 @@ public function testAddPrefixToDocBlock() * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testAddPrefixToDocBlockExceptFirstLine() + public function testAddPrefixToDocBlockExceptFirstLine(): void { $expected = <<<'DOCCOMMENT' /** @@ -142,7 +142,7 @@ public function testAddPrefixToDocBlockExceptFirstLine() * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testWordwrapsAroundTheGivenAmountOfCharacters() + public function testWordwrapsAroundTheGivenAmountOfCharacters(): void { $expected = <<<'DOCCOMMENT' /** diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 6f0e548e..f360a2aa 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -36,7 +36,7 @@ class StandardTagFactoryTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -49,7 +49,7 @@ public function tearDown() * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreatingAGenericTag() + public function testCreatingAGenericTag(): void { $expectedTagName = 'unknown-tag'; $expectedDescriptionText = 'This is a description'; @@ -81,7 +81,7 @@ public function testCreatingAGenericTag() * @uses phpDocumentor\Reflection\DocBlock\Tags\Author * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testCreatingASpecificTag() + public function testCreatingASpecificTag(): void { $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); @@ -102,7 +102,7 @@ public function testCreatingASpecificTag() * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen */ - public function testAnEmptyContextIsCreatedIfNoneIsProvided() + public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void { $fqsen = '\Tag'; $resolver = m::mock(FqsenResolver::class) @@ -130,7 +130,7 @@ public function testAnEmptyContextIsCreatedIfNoneIsProvided() * @uses phpDocumentor\Reflection\DocBlock\Tags\Author * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testPassingYourOwnSetOfTagHandlers() + public function testPassingYourOwnSetOfTagHandlers(): void { $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]); @@ -149,7 +149,7 @@ public function testPassingYourOwnSetOfTagHandlers() * @expectedException \InvalidArgumentException * @expectedExceptionMessage The tag "@user[myuser" does not seem to be wellformed, please check it for errors */ - public function testExceptionIsThrownIfProvidedTagIsNotWellformed() + public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void { $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); $tagFactory->create('@user[myuser'); @@ -160,7 +160,7 @@ public function testExceptionIsThrownIfProvidedTagIsNotWellformed() * @covers ::addParameter * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testAddParameterToServiceLocator() + public function testAddParameterToServiceLocator(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -177,7 +177,7 @@ public function testAddParameterToServiceLocator() * @covers ::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct */ - public function testAddServiceToServiceLocator() + public function testAddServiceToServiceLocator(): void { $service = new PassthroughFormatter(); @@ -196,7 +196,7 @@ public function testAddServiceToServiceLocator() * @covers ::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct */ - public function testInjectConcreteServiceForInterfaceToServiceLocator() + public function testInjectConcreteServiceForInterfaceToServiceLocator(): void { $interfaceName = Formatter::class; $service = new PassthroughFormatter(); @@ -219,7 +219,7 @@ public function testInjectConcreteServiceForInterfaceToServiceLocator() * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::create * @uses phpDocumentor\Reflection\DocBlock\Tags\Author */ - public function testRegisteringAHandlerForANewTag() + public function testRegisteringAHandlerForANewTag(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -237,7 +237,7 @@ public function testRegisteringAHandlerForANewTag() * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() + public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -251,7 +251,7 @@ public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFu * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() + public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -265,7 +265,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() + public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -279,7 +279,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClas * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() + public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void { $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); @@ -295,7 +295,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementThe * @uses phpDocumentor\Reflection\Docblock\Tags\Return_ * @uses phpDocumentor\Reflection\Docblock\Tags\BaseTag */ - public function testReturntagIsMappedCorrectly() + public function testReturntagIsMappedCorrectly(): void { $context = new Context(''); diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 95886147..183236b8 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -25,7 +25,7 @@ class AuthorTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -34,7 +34,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -48,7 +48,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -59,7 +59,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -73,7 +73,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getAuthorName */ - public function testHasTheAuthorName() + public function testHasTheAuthorName(): void { $expected = 'Mike van Riel'; @@ -86,7 +86,7 @@ public function testHasTheAuthorName() * @covers ::__construct * @covers ::getEmail */ - public function testHasTheAuthorMailAddress() + public function testHasTheAuthorMailAddress(): void { $expected = 'mike@phpdoc.org'; @@ -99,7 +99,7 @@ public function testHasTheAuthorMailAddress() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testInitializationFailsIfEmailIsNotValid() + public function testInitializationFailsIfEmailIsNotValid(): void { new Author('Mike van Riel', 'mike'); } @@ -108,7 +108,7 @@ public function testInitializationFailsIfEmailIsNotValid() * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -119,7 +119,7 @@ public function testStringRepresentationIsReturned() * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationWithEmtpyEmail() + public function testStringRepresentationWithEmtpyEmail(): void { $fixture = new Author('Mike van Riel', ''); @@ -130,7 +130,7 @@ public function testStringRepresentationWithEmtpyEmail() * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author:: */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $fixture = Author::create('Mike van Riel '); @@ -143,7 +143,7 @@ public function testFactoryMethod() * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author:: */ - public function testFactoryMethodReturnsNullIfItCouldNotReadBody() + public function testFactoryMethodReturnsNullIfItCouldNotReadBody(): void { $this->assertNull(Author::create('dfgr<')); } diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index 48d288aa..87126b44 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -31,7 +31,7 @@ class CoversTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -41,7 +41,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -56,7 +56,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -68,7 +68,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -82,7 +82,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() + public function testHasReferenceToFqsen(): void { $expected = new Fqsen('\DateTime'); @@ -96,7 +96,7 @@ public function testHasReferenceToFqsen() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -110,7 +110,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -126,7 +126,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -150,7 +150,7 @@ public function testFactoryMethod() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Covers::create('')); } diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index 7313d376..fd70d88f 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -28,7 +28,7 @@ class DeprecatedTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -38,7 +38,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -53,7 +53,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -65,7 +65,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -146,7 +146,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethodCreatesEmptyDeprecatedTag() + public function testFactoryMethodCreatesEmptyDeprecatedTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -162,7 +162,7 @@ public function testFactoryMethodCreatesEmptyDeprecatedTag() * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void { $this->assertEquals(new Deprecated(), Deprecated::create('dkhf<')); } diff --git a/tests/unit/DocBlock/Tags/ExampleTest.php b/tests/unit/DocBlock/Tags/ExampleTest.php index 49bdad14..3b3239a2 100644 --- a/tests/unit/DocBlock/Tags/ExampleTest.php +++ b/tests/unit/DocBlock/Tags/ExampleTest.php @@ -15,7 +15,7 @@ class ExampleTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -26,7 +26,7 @@ public function tearDown() * @covers ::getContent * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testExampleWithoutContent() + public function testExampleWithoutContent(): void { $tag = Example::create('"example1.php"'); $this->assertEquals('"example1.php"', $tag->getContent()); @@ -41,7 +41,7 @@ public function testExampleWithoutContent() * @covers ::getDescription * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testWithDescription() + public function testWithDescription(): void { $tag = Example::create('"example1.php" some text'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -55,7 +55,7 @@ public function testWithDescription() * @covers ::getStartingLine * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testStartlineIsParsed() + public function testStartlineIsParsed(): void { $tag = Example::create('"example1.php" 10'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -70,7 +70,7 @@ public function testStartlineIsParsed() * @covers ::getDescription * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testAllowOmitingLineCount() + public function testAllowOmitingLineCount(): void { $tag = Example::create('"example1.php" 10 some text'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -86,7 +86,7 @@ public function testAllowOmitingLineCount() * @covers ::getLineCount * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testLengthIsParsed() + public function testLengthIsParsed(): void { $tag = Example::create('"example1.php" 10 5'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -103,7 +103,7 @@ public function testLengthIsParsed() * @covers ::getDescription * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testFullExample() + public function testFullExample(): void { $tag = Example::create('"example1.php" 10 5 test text'); $this->assertEquals('example1.php', $tag->getFilePath()); diff --git a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php index b5eab3a0..40efcb4f 100644 --- a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php @@ -30,7 +30,7 @@ class AlignFormatterTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -45,7 +45,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testFormatterCallsToStringAndReturnsAStandardRepresentation() + public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void { $tags = [ new Param('foobar', new String_()), diff --git a/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php index 6fa8055f..3f7e8b4c 100644 --- a/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php @@ -26,7 +26,7 @@ class PassthroughFormatterTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -37,7 +37,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testFormatterCallsToStringAndReturnsAStandardRepresentation() + public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void { $expected = '@unknown-tag This is a description'; @@ -55,7 +55,7 @@ public function testFormatterCallsToStringAndReturnsAStandardRepresentation() * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testFormatterToStringWitoutDescription() + public function testFormatterToStringWitoutDescription(): void { $expected = '@unknown-tag'; $fixture = new PassthroughFormatter(); diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index b59aee5d..7c7d9868 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -28,7 +28,7 @@ class GenericTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -37,7 +37,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Generic('generic', new Description('Description')); @@ -52,7 +52,7 @@ public function testIfCorrectTagNameIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Generic('generic', new Description('Description')); @@ -64,7 +64,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Generic('generic', new Description('Description')); @@ -79,7 +79,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -94,7 +94,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Generic('generic', new Description('Description')); @@ -108,7 +108,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -129,7 +129,7 @@ public function testFactoryMethod() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameIsNotEmpty() + public function testFactoryMethodFailsIfNameIsNotEmpty(): void { Generic::create('', ''); } @@ -139,7 +139,7 @@ public function testFactoryMethodFailsIfNameIsNotEmpty() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameContainsIllegalCharacters() + public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void { Generic::create('', 'name/myname'); } diff --git a/tests/unit/DocBlock/Tags/LinkTest.php b/tests/unit/DocBlock/Tags/LinkTest.php index 829c6ef8..0b1f6a7e 100644 --- a/tests/unit/DocBlock/Tags/LinkTest.php +++ b/tests/unit/DocBlock/Tags/LinkTest.php @@ -28,7 +28,7 @@ class LinkTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -38,7 +38,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -53,7 +53,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -65,7 +65,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -79,7 +79,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getLink */ - public function testHasLinkUrl() + public function testHasLinkUrl(): void { $expected = 'http://this.is.my/link'; @@ -93,7 +93,7 @@ public function testHasLinkUrl() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -107,7 +107,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -121,7 +121,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -145,7 +145,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethodCreatesEmptyLinkTag() + public function testFactoryMethodCreatesEmptyLinkTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 23b6dd4e..4f811d0d 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -37,7 +37,7 @@ class MethodTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -46,7 +46,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Method('myMethod'); @@ -62,7 +62,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], @@ -81,7 +81,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Method('myMethod'); @@ -95,7 +95,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getMethodName */ - public function testHasMethodName() + public function testHasMethodName(): void { $expected = 'myMethod'; @@ -108,7 +108,7 @@ public function testHasMethodName() * @covers ::__construct * @covers ::getArguments */ - public function testHasArguments() + public function testHasArguments(): void { $arguments = [ [ 'name' => 'argument1', 'type' => new String_() ] @@ -123,7 +123,7 @@ public function testHasArguments() * @covers ::__construct * @covers ::getArguments */ - public function testArgumentsMayBePassedAsString() + public function testArgumentsMayBePassedAsString(): void { $arguments = ['argument1']; $expected = [ @@ -139,7 +139,7 @@ public function testArgumentsMayBePassedAsString() * @covers ::__construct * @covers ::getArguments */ - public function testArgumentTypeCanBeInferredAsVoid() + public function testArgumentTypeCanBeInferredAsVoid(): void { $arguments = [ [ 'name' => 'argument1' ] ]; $expected = [ @@ -157,7 +157,7 @@ public function testArgumentTypeCanBeInferredAsVoid() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::getArguments * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testRestArgumentIsParsedAsRegularArg() + public function testRestArgumentIsParsedAsRegularArg(): void { $expected = [ [ 'name' => 'arg1', 'type' => new Void_() ], @@ -185,7 +185,7 @@ public function testRestArgumentIsParsedAsRegularArg() * @covers ::__construct * @covers ::getReturnType */ - public function testHasReturnType() + public function testHasReturnType(): void { $expected = new String_(); @@ -198,7 +198,7 @@ public function testHasReturnType() * @covers ::__construct * @covers ::getReturnType */ - public function testReturnTypeCanBeInferredAsVoid() + public function testReturnTypeCanBeInferredAsVoid(): void { $fixture = new Method('myMethod', []); @@ -209,7 +209,7 @@ public function testReturnTypeCanBeInferredAsVoid() * @covers ::__construct * @covers ::isStatic */ - public function testMethodCanBeStatic() + public function testMethodCanBeStatic(): void { $expected = false; $fixture = new Method('myMethod', [], null, $expected); @@ -225,7 +225,7 @@ public function testMethodCanBeStatic() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -240,7 +240,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::isStatic */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], @@ -263,7 +263,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -298,7 +298,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testReturnTypeThis() + public function testReturnTypeThis(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -347,9 +347,9 @@ public function collectionReturnTypesProvider() public function testCollectionReturnTypes( string $returnType, string $expectedType, - string $expectedValueType = null, - string $expectedKeyType = null - ) { + ?string $expectedValueType = null, + ?string $expectedKeyType = null + ): void { $resolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description('')); @@ -368,7 +368,7 @@ public function testCollectionReturnTypes( * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsEmpty() + public function testFactoryMethodFailsIfBodyIsEmpty(): void { Method::create(''); } @@ -377,7 +377,7 @@ public function testFactoryMethodFailsIfBodyIsEmpty() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect() + public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void { $this->assertNull(Method::create('body(')); } @@ -386,7 +386,7 @@ public function testFactoryMethodReturnsNullIfBodyIsIncorrect() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Method::create('body'); } @@ -395,7 +395,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Method::create('body', new TypeResolver()); } @@ -404,7 +404,7 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsNotString() + public function testCreationFailsIfBodyIsNotString(): void { new Method([]); } @@ -413,7 +413,7 @@ public function testCreationFailsIfBodyIsNotString() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsEmpty() + public function testCreationFailsIfBodyIsEmpty(): void { new Method(''); } @@ -422,7 +422,7 @@ public function testCreationFailsIfBodyIsEmpty() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfStaticIsNotBoolean() + public function testCreationFailsIfStaticIsNotBoolean(): void { new Method('body', [], null, []); } @@ -431,7 +431,7 @@ public function testCreationFailsIfStaticIsNotBoolean() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry() + public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void { new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); } @@ -445,7 +445,7 @@ public function testCreationFailsIfArgumentRecordContainsInvalidEntry() * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context */ - public function testCreateMethodParenthesisMissing() + public function testCreateMethodParenthesisMissing(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -479,7 +479,7 @@ public function testCreateMethodParenthesisMissing() * @uses \phpDocumentor\Reflection\Types\Context * @uses \phpDocumentor\Reflection\Types\Void_ */ - public function testCreateWithoutReturnType() + public function testCreateWithoutReturnType(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -516,7 +516,7 @@ public function testCreateWithoutReturnType() * @uses \phpDocumentor\Reflection\Types\Integer * @uses \phpDocumentor\Reflection\Types\Object_ */ - public function testCreateWithMixedReturnTypes() + public function testCreateWithMixedReturnTypes(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index 95e4c8a6..1f0edf2e 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -30,7 +30,7 @@ class ParamTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Param('myParameter', null, false, new Description('Description')); @@ -56,7 +56,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); $this->assertSame('@param string ...$myParameter Description', $fixture->render()); @@ -75,7 +75,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Param('myParameter'); @@ -89,7 +89,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myParameter'; @@ -102,7 +102,7 @@ public function testHasVariableName() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -115,7 +115,7 @@ public function testHasType() * @covers ::__construct * @covers ::isVariadic */ - public function testIfParameterIsVariadic() + public function testIfParameterIsVariadic(): void { $fixture = new Param('myParameter', new String_(), false); $this->assertFalse($fixture->isVariadic()); @@ -129,7 +129,7 @@ public function testIfParameterIsVariadic() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -145,7 +145,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); @@ -159,7 +159,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -184,7 +184,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $descriptionFactory = m::mock(DescriptionFactory::class); Param::create('', new TypeResolver(), $descriptionFactory); @@ -194,7 +194,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Param::create('body'); } @@ -204,7 +204,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Param::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index 7e8794a1..5bf07235 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -30,7 +30,7 @@ class PropertyReadTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new PropertyRead('myProperty', null, new Description('Description')); @@ -55,7 +55,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); $this->assertSame('@property-read string $myProperty Description', $fixture->render()); @@ -71,7 +71,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new PropertyRead('myProperty'); @@ -85,7 +85,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -98,7 +98,7 @@ public function testHasVariableName() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -112,7 +112,7 @@ public function testHasType() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -127,7 +127,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); @@ -141,7 +141,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -170,7 +170,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $descriptionFactory = m::mock(DescriptionFactory::class); PropertyRead::create('', new TypeResolver(), $descriptionFactory); @@ -180,7 +180,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { PropertyRead::create('body'); } @@ -190,7 +190,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { PropertyRead::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index 53a99ccb..73af3983 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -30,7 +30,7 @@ class PropertyTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Property('myProperty', null, new Description('Description')); @@ -55,7 +55,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Property('myProperty', new String_(), new Description('Description')); $this->assertSame('@property string $myProperty Description', $fixture->render()); @@ -71,7 +71,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Property('myProperty'); @@ -85,7 +85,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -98,7 +98,7 @@ public function testHasVariableName() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -112,7 +112,7 @@ public function testHasType() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -127,7 +127,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Property('myProperty', new String_(), new Description('Description')); @@ -141,7 +141,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -165,7 +165,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $descriptionFactory = m::mock(DescriptionFactory::class); Property::create('', new TypeResolver(), $descriptionFactory); @@ -175,7 +175,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Property::create('body'); } @@ -185,7 +185,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Property::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index 79c28413..185dff0c 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -30,7 +30,7 @@ class PropertyWriteTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new PropertyWrite('myProperty', null, new Description('Description')); @@ -55,7 +55,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); $this->assertSame('@property-write string $myProperty Description', $fixture->render()); @@ -71,7 +71,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new PropertyWrite('myProperty'); @@ -85,7 +85,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -98,7 +98,7 @@ public function testHasVariableName() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -112,7 +112,7 @@ public function testHasType() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -127,7 +127,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); @@ -141,7 +141,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -170,7 +170,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $descriptionFactory = m::mock(DescriptionFactory::class); PropertyWrite::create('', new TypeResolver(), $descriptionFactory); @@ -180,7 +180,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { PropertyWrite::create('body'); } @@ -190,7 +190,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { PropertyWrite::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 53fe992e..76071ec8 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -30,7 +30,7 @@ class ReturnTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -55,7 +55,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -67,7 +67,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -81,7 +81,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -95,7 +95,7 @@ public function testHasType() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -109,7 +109,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Return_(new String_(), new Description('Description')); @@ -125,7 +125,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -146,7 +146,7 @@ public function testFactoryMethod() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Return_::create('')); } @@ -155,7 +155,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Return_::create('body'); } @@ -164,7 +164,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Return_::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index 6de4eadc..598f7643 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -32,7 +32,7 @@ class SeeTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\Fqsen * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -60,7 +60,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -74,7 +74,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\Fqsen * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -90,7 +90,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() + public function testHasReferenceToFqsen(): void { $expected = new FqsenRef(new Fqsen('\DateTime')); @@ -106,7 +106,7 @@ public function testHasReferenceToFqsen() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -122,7 +122,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description')); @@ -139,7 +139,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -169,7 +169,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethodWithUrl() + public function testFactoryMethodWithUrl(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -194,7 +194,7 @@ public function testFactoryMethodWithUrl() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(See::create('')); } @@ -203,7 +203,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { See::create('body'); } @@ -212,7 +212,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { See::create('body', new FqsenResolver()); } diff --git a/tests/unit/DocBlock/Tags/SinceTest.php b/tests/unit/DocBlock/Tags/SinceTest.php index 6e39ad8c..04cf35b4 100644 --- a/tests/unit/DocBlock/Tags/SinceTest.php +++ b/tests/unit/DocBlock/Tags/SinceTest.php @@ -29,7 +29,7 @@ class SinceTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Since('1.0', new Description('Description')); @@ -54,7 +54,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Since('1.0', new Description('Description')); @@ -66,7 +66,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Since('1.0', new Description('Description')); @@ -80,7 +80,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -94,7 +94,7 @@ public function testHasVersionNumber() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -108,7 +108,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Since('1.0', new Description('Description')); @@ -122,7 +122,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -146,7 +146,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethodCreatesEmptySinceTag() + public function testFactoryMethodCreatesEmptySinceTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -161,7 +161,7 @@ public function testFactoryMethodCreatesEmptySinceTag() /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void { $this->assertNull(Since::create('dkhf<')); } diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index 632bcd91..f2ab955f 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -28,7 +28,7 @@ class SourceTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -38,7 +38,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Source(1, null, new Description('Description')); @@ -53,7 +53,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Source(1, 10, new Description('Description')); $this->assertSame('@source 1 10 Description', $fixture->render()); @@ -69,7 +69,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Source(1); @@ -83,7 +83,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getStartingLine */ - public function testHasStartingLine() + public function testHasStartingLine(): void { $expected = 1; @@ -96,7 +96,7 @@ public function testHasStartingLine() * @covers ::__construct * @covers ::getLineCount */ - public function testHasLineCount() + public function testHasLineCount(): void { $expected = 2; @@ -110,7 +110,7 @@ public function testHasLineCount() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -125,7 +125,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Source(1, 10, new Description('Description')); @@ -139,7 +139,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -162,7 +162,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $descriptionFactory = m::mock(DescriptionFactory::class); Source::create('', $descriptionFactory); @@ -173,7 +173,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Source::create('1'); } @@ -182,7 +182,7 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfStartingLineIsNotInteger() + public function testExceptionIsThrownIfStartingLineIsNotInteger(): void { new Source('blabla'); } @@ -191,7 +191,7 @@ public function testExceptionIsThrownIfStartingLineIsNotInteger() * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() + public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void { new Source('1', []); } diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 6e4dec3e..3b42dca7 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -30,7 +30,7 @@ class ThrowsTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -55,7 +55,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -67,7 +67,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -81,7 +81,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -95,7 +95,7 @@ public function testHasType() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -109,7 +109,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Throws(new String_(), new Description('Description')); @@ -125,7 +125,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = new TypeResolver(); @@ -146,7 +146,7 @@ public function testFactoryMethod() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Throws::create('')); } @@ -155,7 +155,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Throws::create('body'); } @@ -164,7 +164,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Throws::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index e8fcb14f..e581232d 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -30,7 +30,7 @@ class UsesTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -55,7 +55,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -67,7 +67,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -81,7 +81,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() + public function testHasReferenceToFqsen(): void { $expected = new Fqsen('\DateTime'); @@ -95,7 +95,7 @@ public function testHasReferenceToFqsen() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -109,7 +109,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -125,7 +125,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $resolver = m::mock(FqsenResolver::class); @@ -149,7 +149,7 @@ public function testFactoryMethod() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Uses::create('')); } @@ -158,7 +158,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Uses::create('body'); } @@ -167,7 +167,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Uses::create('body', new FqsenResolver()); } diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 3b994c51..070fc7b3 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -30,7 +30,7 @@ class VarTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -40,7 +40,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Var_('myVariable', null, new Description('Description')); @@ -51,7 +51,7 @@ public function testIfCorrectTagNameIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfVariableNameIsOmmitedIfEmpty() + public function testIfVariableNameIsOmmitedIfEmpty(): void { $fixture = new Var_('', null, null); @@ -66,7 +66,7 @@ public function testIfVariableNameIsOmmitedIfEmpty() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); $this->assertSame('@var string $myVariable Description', $fixture->render()); @@ -82,7 +82,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Var_('myVariable'); @@ -96,7 +96,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myVariable'; @@ -109,7 +109,7 @@ public function testHasVariableName() * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -123,7 +123,7 @@ public function testHasType() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -138,7 +138,7 @@ public function testHasDescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); @@ -152,7 +152,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -176,7 +176,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $descriptionFactory = m::mock(DescriptionFactory::class); Var_::create('', new TypeResolver(), $descriptionFactory); @@ -186,7 +186,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Var_::create('body'); } @@ -196,7 +196,7 @@ public function testFactoryMethodFailsIfResolverIsNull() * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Var_::create('body', new TypeResolver()); } diff --git a/tests/unit/DocBlock/Tags/VersionTest.php b/tests/unit/DocBlock/Tags/VersionTest.php index 2e5837d0..58cddc9f 100644 --- a/tests/unit/DocBlock/Tags/VersionTest.php +++ b/tests/unit/DocBlock/Tags/VersionTest.php @@ -28,7 +28,7 @@ class VersionTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -38,7 +38,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned() + public function testIfCorrectTagNameIsReturned(): void { $fixture = new Version('1.0', new Description('Description')); @@ -53,7 +53,7 @@ public function testIfCorrectTagNameIsReturned() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter() + public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $fixture = new Version('1.0', new Description('Description')); @@ -65,7 +65,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter() * @uses \phpDocumentor\Reflection\DocBlock\Description * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter() + public function testIfTagCanBeRenderedUsingSpecificFormatter(): void { $fixture = new Version('1.0', new Description('Description')); @@ -79,7 +79,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter() * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -93,7 +93,7 @@ public function testHasVersionNumber() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -107,7 +107,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Version('1.0', new Description('Description')); @@ -121,7 +121,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); @@ -145,7 +145,7 @@ public function testFactoryMethod() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethodCreatesEmptyVersionTag() + public function testFactoryMethodCreatesEmptyVersionTag(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -160,7 +160,7 @@ public function testFactoryMethodCreatesEmptyVersionTag() /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void { $this->assertNull(Version::create('dkhf<')); } diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 7822e554..74ff17d5 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -33,7 +33,7 @@ class DocBlockFactoryTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -44,7 +44,7 @@ public function tearDown() * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testCreateFactoryUsingFactoryMethod() + public function testCreateFactoryUsingFactoryMethod(): void { $fixture = DocBlockFactory::createInstance(); @@ -56,7 +56,7 @@ public function testCreateFactoryUsingFactoryMethod() * @covers ::create * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreateDocBlockFromReflection() + public function testCreateDocBlockFromReflection(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -78,7 +78,7 @@ public function testCreateDocBlockFromReflection() * @covers ::create * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreateDocBlockFromStringWithDocComment() + public function testCreateDocBlockFromStringWithDocComment(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -97,7 +97,7 @@ public function testCreateDocBlockFromStringWithDocComment() * @covers ::__construct * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreateDocBlockFromStringWithoutDocComment() + public function testCreateDocBlockFromStringWithoutDocComment(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -118,7 +118,7 @@ public function testCreateDocBlockFromStringWithoutDocComment() * @uses phpDocumentor\Reflection\DocBlock\Description * @dataProvider provideSummaryAndDescriptions */ - public function testSummaryAndDescriptionAreSeparated($given, $summary, $description) + public function testSummaryAndDescriptionAreSeparated($given, $summary, $description): void { $tagFactory = m::mock(TagFactory::class); $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); @@ -135,7 +135,7 @@ public function testSummaryAndDescriptionAreSeparated($given, $summary, $descrip * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testDescriptionsRetainFormatting() + public function testDescriptionsRetainFormatting(): void { $tagFactory = m::mock(TagFactory::class); $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); @@ -168,7 +168,7 @@ public function testDescriptionsRetainFormatting() * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testTagsAreInterpretedUsingFactory() + public function testTagsAreInterpretedUsingFactory(): void { $tagString = << This is with @@ -255,7 +255,7 @@ public function provideSummaryAndDescriptions() * @uses phpDocumentor\Reflection\Types\Context * @uses phpDocumentor\Reflection\DocBlock\Tags\Param */ - public function testTagsWithContextNamespace() + public function testTagsWithContextNamespace(): void { $tagFactoryMock = m::mock(TagFactory::class); $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), $tagFactoryMock); @@ -274,7 +274,7 @@ public function testTagsWithContextNamespace() * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testTagsAreFilteredForNullValues() + public function testTagsAreFilteredForNullValues(): void { $tagString = << This is with diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 0bf2a0f7..84580d73 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -28,7 +28,7 @@ class DocBlockTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown() + public function tearDown(): void { m::close(); } @@ -39,7 +39,7 @@ public function tearDown() * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveASummary() + public function testDocBlockCanHaveASummary(): void { $summary = 'This is a summary'; @@ -54,7 +54,7 @@ public function testDocBlockCanHaveASummary() * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveADescription() + public function testDocBlockCanHaveADescription(): void { $description = new DocBlock\Description(''); @@ -70,7 +70,7 @@ public function testDocBlockCanHaveADescription() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag */ - public function testDocBlockCanHaveTags() + public function testDocBlockCanHaveTags(): void { $tags = [ m::mock(DocBlock\Tag::class) @@ -90,7 +90,7 @@ public function testDocBlockCanHaveTags() * * @expectedException \InvalidArgumentException */ - public function testDocBlockAllowsOnlyTags() + public function testDocBlockAllowsOnlyTags(): void { $tags = [ null @@ -107,7 +107,7 @@ public function testDocBlockAllowsOnlyTags() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag */ - public function testFindTagsInDocBlockByName() + public function testFindTagsInDocBlockByName(): void { $tag1 = m::mock(DocBlock\Tag::class); $tag2 = m::mock(DocBlock\Tag::class); @@ -132,7 +132,7 @@ public function testFindTagsInDocBlockByName() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag */ - public function testCheckIfThereAreTagsWithAGivenName() + public function testCheckIfThereAreTagsWithAGivenName(): void { $tag1 = m::mock(DocBlock\Tag::class); $tag2 = m::mock(DocBlock\Tag::class); @@ -156,7 +156,7 @@ public function testCheckIfThereAreTagsWithAGivenName() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre() + public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre(): void { $context = new Context(''); @@ -172,7 +172,7 @@ public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Location */ - public function testDocBlockKnowsAtWhichLineItIs() + public function testDocBlockKnowsAtWhichLineItIs(): void { $location = new Location(10); @@ -187,7 +187,7 @@ public function testDocBlockKnowsAtWhichLineItIs() * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate() + public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate(): void { $fixture = new DocBlock('', null, [], null, null, true); @@ -200,7 +200,7 @@ public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate() * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate() + public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate(): void { $fixture = new DocBlock('', null, [], null, null, false, true); @@ -213,7 +213,7 @@ public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate() * * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated */ - public function testRemoveTag() + public function testRemoveTag(): void { $someTag = new Deprecated(); $anotherTag = new Deprecated(); From 082c811880e2dab6f3b44f8331e5e093076d5ca3 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:40:48 +0100 Subject: [PATCH 012/126] remove unused docblocks --- src/DocBlock.php | 3 --- src/DocBlock/DescriptionFactory.php | 2 -- src/DocBlock/ExampleFinder.php | 2 -- src/DocBlock/StandardTagFactory.php | 2 -- src/DocBlock/Tags/Covers.php | 1 - src/DocBlock/Tags/Deprecated.php | 1 - src/DocBlock/Tags/Formatter.php | 2 -- src/DocBlock/Tags/Param.php | 2 -- src/DocBlock/Tags/Property.php | 1 - src/DocBlock/Tags/PropertyRead.php | 1 - src/DocBlock/Tags/PropertyWrite.php | 1 - src/DocBlock/Tags/See.php | 1 - src/DocBlock/Tags/Throws.php | 1 - src/DocBlock/Tags/Uses.php | 1 - src/DocBlock/Tags/Var_.php | 1 - src/DocBlockFactory.php | 2 -- src/DocBlockFactoryInterface.php | 2 -- 17 files changed, 26 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index ca7ab88d..ff2e4b78 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -83,7 +83,6 @@ public function getDescription(): DocBlock\Description /** * Returns the current context. - * */ public function getContext(): Types\Context { @@ -116,7 +115,6 @@ public function getLocation(): ?Location * elements that follow until another DocBlock is found that contains the closing marker (`#@-`). * * @see self::isTemplateEnd() for the check whether a closing marker was provided. - * */ public function isTemplateStart(): bool { @@ -127,7 +125,6 @@ public function isTemplateStart(): bool * Returns whether this DocBlock is the end of a Template section. * * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. - * */ public function isTemplateEnd(): bool { diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 1aafb4d5..39d91b71 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -47,8 +47,6 @@ public function __construct(TagFactory $tagFactory) /** * Returns the parsed text of this description. - * - * */ public function create(string $contents, ?TypeContext $context = null): Description { diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 2ac7b456..d404a205 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -87,8 +87,6 @@ public function getExampleDirectories() * 2. Checks the source folder for the given filename * 3. Checks the 'examples' folder in the current working directory for examples * 4. Checks the path relative to the current working directory for the given filename - * - * */ private function getExampleFileContents(string $filename): ?string { diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 237d3c35..5feab3d0 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -182,8 +182,6 @@ private function extractTagParts(string $tagLine) /** * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. - * - * */ private function createTag(string $body, string $name, TypeContext $context): ?Tag { diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index e92ee681..d35a4bfb 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -60,7 +60,6 @@ public static function create( /** * Returns the structural element this tag refers to. - * */ public function getReference(): Fqsen { diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index daddd11f..8f36729c 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -80,7 +80,6 @@ public static function create( /** * Gets the version section of the tag. - * */ public function getVersion(): ?string { diff --git a/src/DocBlock/Tags/Formatter.php b/src/DocBlock/Tags/Formatter.php index ce285f54..16a424f7 100644 --- a/src/DocBlock/Tags/Formatter.php +++ b/src/DocBlock/Tags/Formatter.php @@ -19,8 +19,6 @@ interface Formatter { /** * Formats a tag into a string representation according to a specific format, such as Markdown. - * - * */ public function format(Tag $tag): string; } diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index e6fcbdc8..189831e1 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -98,7 +98,6 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. - * */ public function getType(): ?Type { @@ -107,7 +106,6 @@ public function getType(): ?Type /** * Returns whether this tag is variadic. - * */ public function isVariadic(): bool { diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 8c4f59ad..9a021439 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -88,7 +88,6 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. - * */ public function getType(): ?Type { diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 51d6d0df..c4d17332 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -88,7 +88,6 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. - * */ public function getType(): ?Type { diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 234ac7ed..845acb3a 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -88,7 +88,6 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. - * */ public function getType(): ?Type { diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 453d3130..6e94dba7 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -65,7 +65,6 @@ public static function create( /** * Returns the ref of this tag. - * */ public function getReference(): Reference { diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 829b014b..3b82ead5 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -57,7 +57,6 @@ public static function create( /** * Returns the type section of the variable. - * */ public function getType(): Type { diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 05acd801..5bed26f8 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -60,7 +60,6 @@ public static function create( /** * Returns the structural element this tag refers to. - * */ public function getReference(): Fqsen { diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index f6e0edf6..0e487c1b 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -88,7 +88,6 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. - * */ public function getType(): ?Type { diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 10e56edd..4ef6bc45 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -40,7 +40,6 @@ public function __construct(DescriptionFactory $descriptionFactory, TagFactory $ * Factory method for easy instantiation. * * @param string[] $additionalTags - * */ public static function createInstance(array $additionalTags = []): DocBlockFactory { @@ -62,7 +61,6 @@ public static function createInstance(array $additionalTags = []): DocBlockFacto /** * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the * getDocComment method (such as a ReflectionClass object). - * */ public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock { diff --git a/src/DocBlockFactoryInterface.php b/src/DocBlockFactoryInterface.php index 83742a1f..4f665dd6 100644 --- a/src/DocBlockFactoryInterface.php +++ b/src/DocBlockFactoryInterface.php @@ -8,13 +8,11 @@ interface DocBlockFactoryInterface * Factory method for easy instantiation. * * @param string[] $additionalTags - * */ public static function createInstance(array $additionalTags = []): DocBlockFactory; /** * @param string|object $docblock - * */ public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock; } From 51122cfa1dbfb572898b67ad8c60d8f427dfbe93 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:41:44 +0100 Subject: [PATCH 013/126] improve comment --- src/DocBlock/Tags/BaseTag.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DocBlock/Tags/BaseTag.php b/src/DocBlock/Tags/BaseTag.php index 2e2260c1..3c51e622 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -24,7 +24,7 @@ abstract class BaseTag implements DocBlock\Tag /** @var string Name of the tag */ protected $name = ''; - /** @var Description|null Description of the tag. */ + /** @var Description|string|null Description of the tag. */ protected $description; /** From 5282c2e9a8c1f95e043184f3b4d7206172d978e6 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:43:47 +0100 Subject: [PATCH 014/126] return test code back --- tests/unit/DocBlock/Tags/DeprecatedTest.php | 129 ++++++++++---------- 1 file changed, 64 insertions(+), 65 deletions(-) diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index fd70d88f..4cdacb2a 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -74,71 +74,70 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void $this->assertSame('Rendered output', $fixture->render($formatter)); } -// -// /** -// * @covers ::__construct -// * @covers ::getVersion -// */ -// public function testHasVersionNumber() -// { -// $expected = '1.0'; -// -// $fixture = new Deprecated($expected); -// -// $this->assertSame($expected, $fixture->getVersion()); -// } -// -// /** -// * @covers ::__construct -// * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription -// * @uses \phpDocumentor\Reflection\DocBlock\Description -// */ -// public function testHasDescription() -// { -// $expected = new Description('Description'); -// -// $fixture = new Deprecated('1.0', $expected); -// -// $this->assertSame($expected, $fixture->getDescription()); -// } -// -// /** -// * @covers ::__construct -// * @covers ::__toString -// * @uses \phpDocumentor\Reflection\DocBlock\Description -// */ -// public function testStringRepresentationIsReturned() -// { -// $fixture = new Deprecated('1.0', new Description('Description')); -// -// $this->assertSame('1.0 Description', (string)$fixture); -// } -// -// /** -// * @covers ::create -// * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: -// * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory -// * @uses \phpDocumentor\Reflection\DocBlock\Description -// * @uses \phpDocumentor\Reflection\Types\Context -// */ -// public function testFactoryMethod() -// { -// $descriptionFactory = m::mock(DescriptionFactory::class); -// $context = new Context(''); -// -// $version = '1.0'; -// $description = new Description('My Description'); -// -// $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); -// -// $fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context); -// -// $this->assertSame('1.0 My Description', (string)$fixture); -// $this->assertSame($version, $fixture->getVersion()); -// $this->assertSame($description, $fixture->getDescription()); -// } - -// + + /** + * @covers ::__construct + * @covers ::getVersion + */ + public function testHasVersionNumber() + { + $expected = '1.0'; + + $fixture = new Deprecated($expected); + + $this->assertSame($expected, $fixture->getVersion()); + } + + /** + * @covers ::__construct + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription + * @uses \phpDocumentor\Reflection\DocBlock\Description + */ + public function testHasDescription() + { + $expected = new Description('Description'); + + $fixture = new Deprecated('1.0', $expected); + + $this->assertSame($expected, $fixture->getDescription()); + } + + /** + * @covers ::__construct + * @covers ::__toString + * @uses \phpDocumentor\Reflection\DocBlock\Description + */ + public function testStringRepresentationIsReturned() + { + $fixture = new Deprecated('1.0', new Description('Description')); + + $this->assertSame('1.0 Description', (string)$fixture); + } + + /** + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethod() + { + $descriptionFactory = m::mock(DescriptionFactory::class); + $context = new Context(''); + + $version = '1.0'; + $description = new Description('My Description'); + + $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); + + $fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context); + + $this->assertSame('1.0 My Description', (string)$fixture); + $this->assertSame($version, $fixture->getVersion()); + $this->assertSame($description, $fixture->getDescription()); + } + /** * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: From e9e35284d9c11fdddd2affadeea20401a55a563a Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:44:57 +0100 Subject: [PATCH 015/126] use PHPUnit 6.0 syntax for tests --- .../unit/DocBlock/StandardTagFactoryTest.php | 30 ++++++++--------- tests/unit/DocBlock/Tags/AuthorTest.php | 4 +-- tests/unit/DocBlock/Tags/CoversTest.php | 4 +-- tests/unit/DocBlock/Tags/GenericTest.php | 8 ++--- tests/unit/DocBlock/Tags/MethodTest.php | 32 +++++++++---------- tests/unit/DocBlock/Tags/ParamTest.php | 12 +++---- tests/unit/DocBlock/Tags/PropertyReadTest.php | 12 +++---- tests/unit/DocBlock/Tags/PropertyTest.php | 12 +++---- .../unit/DocBlock/Tags/PropertyWriteTest.php | 12 +++---- tests/unit/DocBlock/Tags/ReturnTest.php | 12 +++---- tests/unit/DocBlock/Tags/SeeTest.php | 12 +++---- tests/unit/DocBlock/Tags/SourceTest.php | 16 +++++----- tests/unit/DocBlock/Tags/ThrowsTest.php | 12 +++---- tests/unit/DocBlock/Tags/UsesTest.php | 12 +++---- tests/unit/DocBlock/Tags/VarTest.php | 12 +++---- tests/unit/DocBlockTest.php | 7 ++-- 16 files changed, 101 insertions(+), 108 deletions(-) diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index f360a2aa..8a03f7a3 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -144,13 +144,13 @@ public function testPassingYourOwnSetOfTagHandlers(): void /** * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage The tag "@user[myuser" does not seem to be wellformed, please check it for errors + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void + public function testExceptionIsThrownIfProvidedTagIsNotWellformed() : void { + $this->expectException('InvalidArgumentException'); + $this->expectExceptionMessage('The tag "@user[myuser" does not seem to be wellformed, please check it for errors'); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); $tagFactory->create('@user[myuser'); } @@ -235,13 +235,12 @@ public function testRegisteringAHandlerForANewTag(): void * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void + public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class); } @@ -249,13 +248,12 @@ public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFu * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void + public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('my-tag', ''); } @@ -263,13 +261,12 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void + public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('my-tag', 'IDoNotExist'); } @@ -277,13 +274,12 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClas * @covers ::registerTagHandler * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @expectedException \InvalidArgumentException */ - public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void + public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void { + $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('my-tag', 'stdClass'); } diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 183236b8..7cdf56ca 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -97,10 +97,10 @@ public function testHasTheAuthorMailAddress(): void /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testInitializationFailsIfEmailIsNotValid(): void + public function testInitializationFailsIfEmailIsNotValid() : void { + $this->expectException('InvalidArgumentException'); new Author('Mike van Riel', 'mike'); } diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index 87126b44..a4629151 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -148,10 +148,10 @@ public function testFactoryMethod(): void /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Covers::create('')); } } diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index 7c7d9868..e8612de8 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -127,20 +127,20 @@ public function testFactoryMethod(): void /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameIsNotEmpty(): void + public function testFactoryMethodFailsIfNameIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); Generic::create('', ''); } /** * @covers ::create * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void + public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void { + $this->expectException('InvalidArgumentException'); Generic::create('', 'name/myname'); } } diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 4f811d0d..379a2631 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -366,73 +366,73 @@ public function testCollectionReturnTypes( /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsEmpty(): void + public function testFactoryMethodFailsIfBodyIsEmpty() : void { + $this->expectException('InvalidArgumentException'); Method::create(''); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void + public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Method::create('body(')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Method::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Method::create('body', new TypeResolver()); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsNotString(): void + public function testCreationFailsIfBodyIsNotString() : void { + $this->expectException('InvalidArgumentException'); new Method([]); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsEmpty(): void + public function testCreationFailsIfBodyIsEmpty() : void { + $this->expectException('InvalidArgumentException'); new Method(''); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfStaticIsNotBoolean(): void + public function testCreationFailsIfStaticIsNotBoolean() : void { + $this->expectException('InvalidArgumentException'); new Method('body', [], null, []); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void + public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void { + $this->expectException('InvalidArgumentException'); new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); } diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index 1f0edf2e..eaa7dcd9 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -182,30 +182,30 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Param::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Param::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Param::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index 5bf07235..78132af8 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -168,30 +168,30 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); PropertyRead::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyRead::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyRead::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index 73af3983..9d4cdfa9 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -163,30 +163,30 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Property::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Property::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Property::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index 185dff0c..cdc146b5 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -168,30 +168,30 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); PropertyWrite::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyWrite::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); PropertyWrite::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 76071ec8..61ab6a2b 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -144,28 +144,28 @@ public function testFactoryMethod(): void /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Return_::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Return_::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Return_::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index 598f7643..b969bbaf 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -192,28 +192,28 @@ public function testFactoryMethodWithUrl(): void /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(See::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); See::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); See::create('body', new FqsenResolver()); } } diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index f2ab955f..950cc302 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -160,10 +160,10 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Source::create('', $descriptionFactory); } @@ -171,28 +171,28 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Source::create('1'); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfStartingLineIsNotInteger(): void + public function testExceptionIsThrownIfStartingLineIsNotInteger() : void { + $this->expectException('InvalidArgumentException'); new Source('blabla'); } /** * @covers ::__construct - * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void + public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void { + $this->expectException('InvalidArgumentException'); new Source('1', []); } } diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 3b42dca7..07ba54d1 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -144,28 +144,28 @@ public function testFactoryMethod(): void /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Throws::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Throws::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Throws::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index e581232d..4dc6910b 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -147,28 +147,28 @@ public function testFactoryMethod(): void /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { + $this->expectException('InvalidArgumentException'); $this->assertNull(Uses::create('')); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Uses::create('body'); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Uses::create('body', new FqsenResolver()); } } diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 070fc7b3..7ade39eb 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -174,30 +174,30 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { + $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); Var_::create('', new TypeResolver(), $descriptionFactory); } /** * @covers ::create - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { + $this->expectException('InvalidArgumentException'); Var_::create('body'); } /** * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver - * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { + $this->expectException('InvalidArgumentException'); Var_::create('body', new TypeResolver()); } } diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 84580d73..7961fec3 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -84,18 +84,15 @@ public function testDocBlockCanHaveTags(): void /** * @covers ::__construct * @covers ::getTags - * * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag - * - * @expectedException \InvalidArgumentException */ - public function testDocBlockAllowsOnlyTags(): void + public function testDocBlockAllowsOnlyTags() : void { + $this->expectException('InvalidArgumentException'); $tags = [ null ]; - $fixture = new DocBlock('', null, $tags); } From f8d4fda4f3b68a283764f6aca55f151b701d225e Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:45:49 +0100 Subject: [PATCH 016/126] fix cs --- src/DocBlock/Tag.php | 2 +- tests/unit/DocBlock/StandardTagFactoryTest.php | 10 +++++----- tests/unit/DocBlock/Tags/AuthorTest.php | 2 +- tests/unit/DocBlock/Tags/CoversTest.php | 2 +- tests/unit/DocBlock/Tags/DeprecatedTest.php | 8 ++++---- tests/unit/DocBlock/Tags/GenericTest.php | 4 ++-- tests/unit/DocBlock/Tags/MethodTest.php | 16 ++++++++-------- tests/unit/DocBlock/Tags/ParamTest.php | 6 +++--- tests/unit/DocBlock/Tags/PropertyReadTest.php | 6 +++--- tests/unit/DocBlock/Tags/PropertyTest.php | 6 +++--- tests/unit/DocBlock/Tags/PropertyWriteTest.php | 6 +++--- tests/unit/DocBlock/Tags/ReturnTest.php | 6 +++--- tests/unit/DocBlock/Tags/SeeTest.php | 6 +++--- tests/unit/DocBlock/Tags/SourceTest.php | 8 ++++---- tests/unit/DocBlock/Tags/ThrowsTest.php | 6 +++--- tests/unit/DocBlock/Tags/UsesTest.php | 6 +++--- tests/unit/DocBlock/Tags/VarTest.php | 6 +++--- tests/unit/DocBlockTest.php | 2 +- 18 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/DocBlock/Tag.php b/src/DocBlock/Tag.php index bcd37cf6..8dec92ed 100644 --- a/src/DocBlock/Tag.php +++ b/src/DocBlock/Tag.php @@ -20,7 +20,7 @@ interface Tag public function getName(): string; /** - * @return Tag Class that implements Tag + * @return Tag|mixed Class that implements Tag */ public static function create(string $body); diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 8a03f7a3..b3a3dc9b 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -147,7 +147,7 @@ public function testPassingYourOwnSetOfTagHandlers(): void * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testExceptionIsThrownIfProvidedTagIsNotWellformed() : void + public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void { $this->expectException('InvalidArgumentException'); $this->expectExceptionMessage('The tag "@user[myuser" does not seem to be wellformed, please check it for errors'); @@ -236,7 +236,7 @@ public function testRegisteringAHandlerForANewTag(): void * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void + public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -249,7 +249,7 @@ public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFu * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void + public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -262,7 +262,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void + public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); @@ -275,7 +275,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClas * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void + public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void { $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 7cdf56ca..826ba0b4 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -98,7 +98,7 @@ public function testHasTheAuthorMailAddress(): void /** * @covers ::__construct */ - public function testInitializationFailsIfEmailIsNotValid() : void + public function testInitializationFailsIfEmailIsNotValid(): void { $this->expectException('InvalidArgumentException'); new Author('Mike van Riel', 'mike'); diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index a4629151..a1ef7f41 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -149,7 +149,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Covers::create('')); diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index 4cdacb2a..7f8a4f55 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -79,7 +79,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -93,7 +93,7 @@ public function testHasVersionNumber() * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription() + public function testHasDescription(): void { $expected = new Description('Description'); @@ -107,7 +107,7 @@ public function testHasDescription() * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -121,7 +121,7 @@ public function testStringRepresentationIsReturned() * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testFactoryMethod() + public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); $context = new Context(''); diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index e8612de8..c9fa0aef 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -128,7 +128,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfNameIsNotEmpty() : void + public function testFactoryMethodFailsIfNameIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); Generic::create('', ''); @@ -138,7 +138,7 @@ public function testFactoryMethodFailsIfNameIsNotEmpty() : void * @covers ::create * @covers ::__construct */ - public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void + public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void { $this->expectException('InvalidArgumentException'); Generic::create('', 'name/myname'); diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 379a2631..1a6e43df 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -367,7 +367,7 @@ public function testCollectionReturnTypes( /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsEmpty() : void + public function testFactoryMethodFailsIfBodyIsEmpty(): void { $this->expectException('InvalidArgumentException'); Method::create(''); @@ -376,7 +376,7 @@ public function testFactoryMethodFailsIfBodyIsEmpty() : void /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void + public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Method::create('body(')); @@ -385,7 +385,7 @@ public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Method::create('body'); @@ -394,7 +394,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Method::create('body', new TypeResolver()); @@ -403,7 +403,7 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void /** * @covers ::__construct */ - public function testCreationFailsIfBodyIsNotString() : void + public function testCreationFailsIfBodyIsNotString(): void { $this->expectException('InvalidArgumentException'); new Method([]); @@ -412,7 +412,7 @@ public function testCreationFailsIfBodyIsNotString() : void /** * @covers ::__construct */ - public function testCreationFailsIfBodyIsEmpty() : void + public function testCreationFailsIfBodyIsEmpty(): void { $this->expectException('InvalidArgumentException'); new Method(''); @@ -421,7 +421,7 @@ public function testCreationFailsIfBodyIsEmpty() : void /** * @covers ::__construct */ - public function testCreationFailsIfStaticIsNotBoolean() : void + public function testCreationFailsIfStaticIsNotBoolean(): void { $this->expectException('InvalidArgumentException'); new Method('body', [], null, []); @@ -430,7 +430,7 @@ public function testCreationFailsIfStaticIsNotBoolean() : void /** * @covers ::__construct */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void + public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void { $this->expectException('InvalidArgumentException'); new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index eaa7dcd9..a824bf22 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -183,7 +183,7 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -193,7 +193,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Param::create('body'); @@ -203,7 +203,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Param::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index 78132af8..72e62c94 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -169,7 +169,7 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -179,7 +179,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyRead::create('body'); @@ -189,7 +189,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyRead::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index 9d4cdfa9..3792fa35 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -164,7 +164,7 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -174,7 +174,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Property::create('body'); @@ -184,7 +184,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Property::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index cdc146b5..03009c44 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -169,7 +169,7 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -179,7 +179,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyWrite::create('body'); @@ -189,7 +189,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); PropertyWrite::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 61ab6a2b..52591e45 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -145,7 +145,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Return_::create('')); @@ -154,7 +154,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Return_::create('body'); @@ -163,7 +163,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Return_::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index b969bbaf..a282be41 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -193,7 +193,7 @@ public function testFactoryMethodWithUrl(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(See::create('')); @@ -202,7 +202,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); See::create('body'); @@ -211,7 +211,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); See::create('body', new FqsenResolver()); diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index 950cc302..782f38bd 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -161,7 +161,7 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -172,7 +172,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Source::create('1'); @@ -181,7 +181,7 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void /** * @covers ::__construct */ - public function testExceptionIsThrownIfStartingLineIsNotInteger() : void + public function testExceptionIsThrownIfStartingLineIsNotInteger(): void { $this->expectException('InvalidArgumentException'); new Source('blabla'); @@ -190,7 +190,7 @@ public function testExceptionIsThrownIfStartingLineIsNotInteger() : void /** * @covers ::__construct */ - public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void + public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void { $this->expectException('InvalidArgumentException'); new Source('1', []); diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 07ba54d1..33cd78ce 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -145,7 +145,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Throws::create('')); @@ -154,7 +154,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Throws::create('body'); @@ -163,7 +163,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Throws::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index 4dc6910b..2e41474f 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -148,7 +148,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() : void + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->expectException('InvalidArgumentException'); $this->assertNull(Uses::create('')); @@ -157,7 +157,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Uses::create('body'); @@ -166,7 +166,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Uses::create('body', new FqsenResolver()); diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 7ade39eb..46dd0878 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -175,7 +175,7 @@ public function testFactoryMethod(): void * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void + public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -185,7 +185,7 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull() : void + public function testFactoryMethodFailsIfResolverIsNull(): void { $this->expectException('InvalidArgumentException'); Var_::create('body'); @@ -195,7 +195,7 @@ public function testFactoryMethodFailsIfResolverIsNull() : void * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { $this->expectException('InvalidArgumentException'); Var_::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 7961fec3..3a5d0909 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -87,7 +87,7 @@ public function testDocBlockCanHaveTags(): void * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag */ - public function testDocBlockAllowsOnlyTags() : void + public function testDocBlockAllowsOnlyTags(): void { $this->expectException('InvalidArgumentException'); $tags = [ From 7d2174e8f65f44a94a128e0985cca95971fc5abf Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:47:01 +0100 Subject: [PATCH 017/126] use ::class over string --- tests/unit/DocBlock/StandardTagFactoryTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index b3a3dc9b..526ca710 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -241,7 +241,7 @@ public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFu $this->expectException('InvalidArgumentException'); $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); - $tagFactory->registerTagHandler('Name\Spaced\Tag', Author::class); + $tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class); } /** From c664d2866d0bb85bec54c017b68fefa1ff26becd Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 23:47:43 +0100 Subject: [PATCH 018/126] fix cs --- src/DocBlock/Tags/Author.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index a8e6e3aa..ba8f782b 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; - /** * Reflection class for an {@}author tag in a Docblock. */ From c19b4d170c5a9cc9d93d3d63d7125f894f2726b1 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 28 Nov 2017 03:11:53 +0100 Subject: [PATCH 019/126] [cs] remove value-less docblocks --- src/DocBlock.php | 3 --- src/DocBlock/Tags/Method.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index ff2e4b78..b7df9973 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -73,9 +73,6 @@ public function getSummary(): string return $this->summary; } - /** - * @return DocBlock\Description - */ public function getDescription(): DocBlock\Description { return $this->description; diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 0c2c4dfd..a5254e79 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -185,9 +185,6 @@ public function isStatic(): bool return $this->isStatic; } - /** - * @return Type - */ public function getReturnType(): Type { return $this->returnType; From bab88701ea52d718b4d56728670f43a456720e6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Votruba?= Date: Sat, 2 Dec 2017 19:12:29 +0100 Subject: [PATCH 020/126] Add PHPStan and bump to max level (#139) * composer: put require- together * add phpstan * add phpstan to travis * phpstan fixes * phpstan fixes * phpstan fixes * drop null defaults since every property is null by default * DescriptionFactory: fix parse nullable type * travis: add phpstan max * travis: fix phpstan config --- .travis.yml | 1 + composer.json | 11 +- composer.lock | 1029 ++++++++++++++++++++++++++- phpstan.neon | 10 + src/DocBlock.php | 14 +- src/DocBlock/DescriptionFactory.php | 2 +- src/DocBlock/Serializer.php | 4 +- src/DocBlock/StandardTagFactory.php | 2 +- src/DocBlock/Tags/Author.php | 5 +- src/DocBlock/Tags/Covers.php | 2 +- src/DocBlock/Tags/Method.php | 4 +- src/DocBlock/Tags/Param.php | 2 +- src/DocBlock/Tags/Property.php | 2 +- src/DocBlock/Tags/PropertyRead.php | 2 +- src/DocBlock/Tags/PropertyWrite.php | 2 +- src/DocBlock/Tags/See.php | 2 +- src/DocBlock/Tags/Since.php | 6 +- src/DocBlock/Tags/Source.php | 2 +- src/DocBlock/Tags/Uses.php | 2 +- src/DocBlock/Tags/Var_.php | 2 +- src/DocBlock/Tags/Version.php | 5 +- src/DocBlockFactory.php | 2 +- 22 files changed, 1050 insertions(+), 63 deletions(-) create mode 100644 phpstan.neon diff --git a/.travis.yml b/.travis.yml index ce37fcd2..6e3c9cbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ script: - vendor/bin/phpunit --coverage-clover=coverage.xml -v # coding style - if [[ $STATIC_ANALYSIS != "" ]]; then temp/ecs/bin/ecs check src tests; fi + - if [[ $STATIC_ANALYSIS != "" ]]; then vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; fi after_script: - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; diff --git a/composer.json b/composer.json index a0631dfa..f97ebdfb 100644 --- a/composer.json +++ b/composer.json @@ -15,6 +15,12 @@ "phpdocumentor/type-resolver": "^0.4", "webmozart/assert": "^1.0" }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4", + "doctrine/instantiator": "^1.0", + "phpstan/phpstan": "^0.9.0" + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": "src" @@ -25,11 +31,6 @@ "phpDocumentor\\Reflection\\": "tests/unit" } }, - "require-dev": { - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4", - "doctrine/instantiator": "^1.0" - }, "extra": { "branch-alias": { "dev-master": "4.x-dev" diff --git a/composer.lock b/composer.lock index 0cabfa40..c81991ac 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "2a242eca1a53d53cacb1e5bb03e62846", + "content-hash": "f6bf95704ed863f57d7200f760c54aa0", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -261,6 +261,49 @@ ], "time": "2016-01-20T08:20:44+00:00" }, + { + "name": "jean85/pretty-package-versions", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "cda6ed1bfbcf7a3736b8943466ad8b1b5c0cc7c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/cda6ed1bfbcf7a3736b8943466ad8b1b5c0cc7c9", + "reference": "cda6ed1bfbcf7a3736b8943466ad8b1b5c0cc7c9", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.1.3", + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A wrapper for ocramius/pretty-package-versions to get pretty versions strings", + "keywords": [ + "package versions" + ], + "time": "2017-09-06T15:48:57+00:00" + }, { "name": "mockery/mockery", "version": "1.0", @@ -331,45 +374,606 @@ "version": "1.7.0", "source": { "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "nette/bootstrap", + "version": "v2.4.5", + "source": { + "type": "git", + "url": "https://github.com/nette/bootstrap.git", + "reference": "804925787764d708a7782ea0d9382a310bb21968" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/bootstrap/zipball/804925787764d708a7782ea0d9382a310bb21968", + "reference": "804925787764d708a7782ea0d9382a310bb21968", + "shasum": "" + }, + "require": { + "nette/di": "~2.4.7", + "nette/utils": "~2.4", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "~2.2", + "nette/application": "~2.3", + "nette/caching": "~2.3", + "nette/database": "~2.3", + "nette/forms": "~2.3", + "nette/http": "~2.4.0", + "nette/mail": "~2.3", + "nette/robot-loader": "^2.4.2 || ^3.0", + "nette/safe-stream": "~2.2", + "nette/security": "~2.3", + "nette/tester": "~2.0", + "tracy/tracy": "^2.4.1" + }, + "suggest": { + "nette/robot-loader": "to use Configurator::createRobotLoader()", + "tracy/tracy": "to use Configurator::enableTracy()" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", + "homepage": "https://nette.org", + "keywords": [ + "bootstrapping", + "configurator", + "nette" + ], + "time": "2017-08-20T17:36:59+00:00" + }, + { + "name": "nette/di", + "version": "v2.4.10", + "source": { + "type": "git", + "url": "https://github.com/nette/di.git", + "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/di/zipball/a4b3be935b755f23aebea1ce33d7e3c832cdff98", + "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/neon": "^2.3.3 || ~3.0.0", + "nette/php-generator": "^2.6.1 || ~3.0.0", + "nette/utils": "^2.4.3 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/bootstrap": "<2.4", + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "compiled", + "di", + "dic", + "factory", + "ioc", + "nette", + "static" + ], + "time": "2017-08-31T22:42:00+00:00" + }, + { + "name": "nette/finder", + "version": "v2.4.1", + "source": { + "type": "git", + "url": "https://github.com/nette/finder.git", + "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/finder/zipball/4d43a66d072c57d585bf08a3ef68d3587f7e9547", + "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette Finder: Files Searching", + "homepage": "https://nette.org", + "time": "2017-07-10T23:47:08+00:00" + }, + { + "name": "nette/neon", + "version": "v2.4.2", + "source": { + "type": "git", + "url": "https://github.com/nette/neon.git", + "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/neon/zipball/9eacd50553b26b53a3977bfb2fea2166d4331622", + "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-json": "*", + "php": ">=5.6.0" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "Nette NEON: parser & generator for Nette Object Notation", + "homepage": "http://ne-on.org", + "time": "2017-07-11T18:29:08+00:00" + }, + { + "name": "nette/php-generator", + "version": "v3.0.1", + "source": { + "type": "git", + "url": "https://github.com/nette/php-generator.git", + "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/php-generator/zipball/eb2dbc9c3409e9db40568109ca4994d51373b60c", + "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c", + "shasum": "" + }, + "require": { + "nette/utils": "^2.4.2 || ~3.0.0", + "php": ">=7.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.1 features.", + "homepage": "https://nette.org", + "keywords": [ + "code", + "nette", + "php", + "scaffolding" + ], + "time": "2017-07-11T19:07:13+00:00" + }, + { + "name": "nette/robot-loader", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/nette/robot-loader.git", + "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/robot-loader/zipball/b703b4f5955831b0bcaacbd2f6af76021b056826", + "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "nette/finder": "^2.3 || ^3.0", + "nette/utils": "^2.4 || ^3.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "^2.0", + "tracy/tracy": "^2.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", + "homepage": "https://nette.org", + "keywords": [ + "autoload", + "class", + "interface", + "nette", + "trait" + ], + "time": "2017-07-18T00:09:56+00:00" + }, + { + "name": "nette/utils", + "version": "v2.4.8", + "source": { + "type": "git", + "url": "https://github.com/nette/utils.git", + "reference": "f1584033b5af945b470533b466b81a789d532034" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/utils/zipball/f1584033b5af945b470533b466b81a789d532034", + "reference": "f1584033b5af945b470533b466b81a789d532034", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "nette/tester": "~2.0", + "tracy/tracy": "^2.3" + }, + "suggest": { + "ext-gd": "to use Image", + "ext-iconv": "to use Strings::webalize() and toAscii()", + "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", + "ext-json": "to use Nette\\Utils\\Json", + "ext-mbstring": "to use Strings::lower() etc...", + "ext-xml": "to use Strings::length() etc. when mbstring is not available" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", + "homepage": "https://nette.org", + "keywords": [ + "array", + "core", + "datetime", + "images", + "json", + "nette", + "paginator", + "password", + "slugify", + "string", + "unicode", + "utf-8", + "utility", + "validation" + ], + "time": "2017-08-20T17:32:29+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v3.1.2", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "08131e7ff29de6bb9f12275c7d35df71f25f4d89" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/08131e7ff29de6bb9f12275c7d35df71f25f4d89", + "reference": "08131e7ff29de6bb9f12275c7d35df71f25f4d89", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2017-11-04T11:48:34+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "72b226d2957e9e6a9ed09aeaa29cabd840d1a3b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/72b226d2957e9e6a9ed09aeaa29cabd840d1a3b7", + "reference": "72b226d2957e9e6a9ed09aeaa29cabd840d1a3b7", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "composer-plugin-api": "^1.0", + "php": "~7.0" }, "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" + "composer/composer": "^1.3", + "ext-zip": "*", + "humbug/humbug": "dev-master", + "phpunit/phpunit": "^5.7.5" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } }, - "type": "library", "autoload": { "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] + "PackageVersions\\": "src/PackageVersions" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } ], - "time": "2017-10-19T19:58:43+00:00" + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2017-09-06T15:24:43+00:00" }, { "name": "phar-io/manifest", @@ -536,6 +1140,106 @@ ], "time": "2017-11-24T13:59:53+00:00" }, + { + "name": "phpstan/phpdoc-parser", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/08d714b2f0bc0a2bf9407255d5bb634669b7065c", + "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c", + "shasum": "" + }, + "require": { + "php": "~7.0" + }, + "require-dev": { + "consistence/coding-standard": "^2.0.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan": "^0.9", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "^3.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "time": "2017-11-22T10:46:07+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "0.9", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "f8cccde009c856e42704b7e4c250d5c73c60d00d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f8cccde009c856e42704b7e4c250d5c73c60d00d", + "reference": "f8cccde009c856e42704b7e4c250d5c73c60d00d", + "shasum": "" + }, + "require": { + "jean85/pretty-package-versions": "^1.0.2", + "nette/bootstrap": "^2.4 || ^3.0", + "nette/di": "^2.4.7 || ^3.0", + "nette/robot-loader": "^3.0.1", + "nette/utils": "^2.4.5 || ^3.0", + "nikic/php-parser": "^3.1", + "php": "~7.0", + "phpstan/phpdoc-parser": "^0.1", + "symfony/console": "~3.2 || ~4.0", + "symfony/finder": "~3.2 || ~4.0" + }, + "require-dev": { + "consistence/coding-standard": "2.2.1", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "phing/phing": "^2.16.0", + "phpstan/phpstan-php-parser": "^0.9", + "phpstan/phpstan-phpunit": "^0.9", + "phpstan/phpstan-strict-rules": "^0.9", + "phpunit/phpunit": "^6.3", + "slevomat/coding-standard": "4.0.0" + }, + "bin": [ + "bin/phpstan" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9-dev" + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": [ + "src/", + "build/PHPStan" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "time": "2017-11-29T11:25:41+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "5.2.3", @@ -929,6 +1633,53 @@ ], "time": "2017-08-03T14:08:16+00:00" }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -1488,6 +2239,238 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "symfony/console", + "version": "v3.3.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/63cd7960a0a522c3537f6326706d7f3b8de65805", + "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3", + "symfony/dependency-injection": "~3.3", + "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", + "symfony/process": "~2.8|~3.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/filesystem": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2017-11-16T15:24:32+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.3.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "74557880e2846b5c84029faa96b834da37e29810" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/74557880e2846b5c84029faa96b834da37e29810", + "reference": "74557880e2846b5c84029faa96b834da37e29810", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2017-11-10T16:38:39+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.3.13", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "138af5ec075d4b1d1bd19de08c38a34bb2d7d880" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/138af5ec075d4b1d1bd19de08c38a34bb2d7d880", + "reference": "138af5ec075d4b1d1bd19de08c38a34bb2d7d880", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2017-11-05T15:47:03+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, { "name": "theseer/tokenizer", "version": "1.1.0", diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 00000000..2beb983c --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,10 @@ +parameters: + ignoreErrors: + # false positive + - '#Call to an undefined method object::getDocComment\(\)#' + - '#Cannot call method render\(\) on phpDocumentor\\Reflection\\DocBlock\\Description\|string#' + - '#Calling method create\(\) on possibly null value of type phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory\|null#' + - '#Calling method resolve\(\) on possibly null value of type phpDocumentor\\Reflection\\(TypeResolver|FqsenResolver)\|null#' + + # nested parents + - '#Calling method render\(\) on possibly null value of type phpDocumentor\\Reflection\\DocBlock\\Description\|string\|null#' diff --git a/src/DocBlock.php b/src/DocBlock.php index b7df9973..726a8e04 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -22,16 +22,16 @@ final class DocBlock private $summary = ''; /** @var DocBlock\Description The actual description for this docblock. */ - private $description = null; + private $description; /** @var Tag[] An array containing all the tags in this docblock; except inline. */ private $tags = []; - /** @var Types\Context Information about the context of this DocBlock. */ - private $context = null; + /** @var Types\Context|null Information about the context of this DocBlock. */ + private $context; - /** @var Location Information about the location of this DocBlock. */ - private $location = null; + /** @var Location|null Information about the location of this DocBlock. */ + private $location; /** @var bool Is this DocBlock (the start of) a template? */ private $isTemplateStart = false; @@ -81,7 +81,7 @@ public function getDescription(): DocBlock\Description /** * Returns the current context. */ - public function getContext(): Types\Context + public function getContext(): ?Types\Context { return $this->context; } @@ -182,7 +182,7 @@ public function hasTag(string $name): bool /** * Remove a tag from this DocBlock. * - * @param Tag $tag The tag to remove. + * @param Tag $tagToRemove The tag to remove. */ public function removeTag(Tag $tagToRemove): void { diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 39d91b71..3d2a7437 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -108,7 +108,7 @@ private function lex(string $contents) * * @return string[]|Tag[] */ - private function parse($tokens, TypeContext $context) + private function parse($tokens, ?TypeContext $context = null): array { $count = count($tokens); $tagCount = 0; diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 9670c166..64eb9961 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -30,10 +30,10 @@ class Serializer protected $isFirstLineIndented = true; /** @var int|null The max length of a line. */ - protected $lineLength = null; + protected $lineLength; /** @var DocBlock\Tags\Formatter A custom tag formatter. */ - protected $tagFormatter = null; + protected $tagFormatter; /** * Create a Serializer instance. diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 5feab3d0..8ff252ba 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -105,7 +105,7 @@ public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers = /** * {@inheritDoc} */ - public function create(string $tagLine, ?TypeContext $context = null): Tag + public function create(string $tagLine, ?TypeContext $context = null): ?Tag { if (! $context) { $context = new TypeContext(''); diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index ba8f782b..c239220b 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -70,11 +70,8 @@ public function __toString(): string /** * Attempts to create a new Author object based on †he tag body. - * - * - * @return static */ - public static function create(string $body) + public static function create(string $body): ?self { $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); if (!$splitTagContent) { diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index d35a4bfb..46fcd87e 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -28,7 +28,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod protected $name = 'covers'; /** @var Fqsen */ - private $refers = null; + private $refers; /** * Initializes this tag. diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index a5254e79..9e8ac193 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -69,7 +69,7 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): Method { + ): ?self { Assert::stringNotEmpty($body); Assert::allNotNull([ $typeResolver, $descriptionFactory ]); @@ -125,7 +125,7 @@ public static function create( [, $static, $returnType, $methodName, $arguments, $description] = $matches; - $static = $static === 'static'; + $static = $static === 'static'; if ($returnType === '') { $returnType = 'void'; diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 189831e1..d386703c 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -28,7 +28,7 @@ final class Param extends BaseTag implements Factory\StaticMethod /** @var string */ protected $name = 'param'; - /** @var Type */ + /** @var Type|null */ private $type; /** @var string */ diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 9a021439..c421f961 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -28,7 +28,7 @@ class Property extends BaseTag implements Factory\StaticMethod /** @var string */ protected $name = 'property'; - /** @var Type */ + /** @var Type|null */ private $type; /** @var string */ diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index c4d17332..d37acb0d 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -28,7 +28,7 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** @var string */ protected $name = 'property-read'; - /** @var Type */ + /** @var Type|null */ private $type; /** @var string */ diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 845acb3a..b762e586 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -28,7 +28,7 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** @var string */ protected $name = 'property-write'; - /** @var Type */ + /** @var Type|null */ private $type; /** @var string */ diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 6e94dba7..67838ad2 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -30,7 +30,7 @@ class See extends BaseTag implements Factory\StaticMethod protected $name = 'see'; /** @var Reference */ - protected $refers = null; + protected $refers; /** * Initializes this tag. diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index d22a72ae..9fe288f0 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -15,6 +15,7 @@ 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; @@ -52,14 +53,11 @@ public function __construct($version = null, ?Description $description = null) $this->description = $description; } - /** - * @return static - */ public static function create( ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) { + ): ?self { if (empty($body)) { return new static(); } diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index cc58a5a4..b2285e63 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -30,7 +30,7 @@ final class Source extends BaseTag implements Factory\StaticMethod private $startingLine = 1; /** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */ - private $lineCount = null; + private $lineCount; public function __construct($startingLine, $lineCount = null, ?Description $description = null) { diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 5bed26f8..15608164 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -28,7 +28,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod protected $name = 'uses'; /** @var Fqsen */ - protected $refers = null; + protected $refers; /** * Initializes this tag. diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 0e487c1b..af249063 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -28,7 +28,7 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** @var string */ protected $name = 'var'; - /** @var Type */ + /** @var Type|null */ private $type; /** @var string */ diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 468d99d6..0f958af8 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -52,14 +52,11 @@ public function __construct($version = null, ?Description $description = null) $this->description = $description; } - /** - * @return static - */ public static function create( ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) { + ): ?self { if (empty($body)) { return new static(); } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 4ef6bc45..dca5b703 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -207,7 +207,7 @@ private function splitDocBlock(string $comment) * @param string $tags Tag block to parse. * @param Types\Context $context Context of the parsed Tag * - * @return DocBlock\Tag[] + * @return DocBlock\Tag[]|string[]|null[] */ private function parseTagBlock(string $tags, Types\Context $context): array { From 4ea190884db7a90912aa756f00b385beaeb2eb84 Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Thu, 7 Dec 2017 18:29:55 -0200 Subject: [PATCH 021/126] Use assertCount (#140) --- tests/unit/DocBlock/DescriptionTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/DocBlock/DescriptionTest.php b/tests/unit/DocBlock/DescriptionTest.php index a28163e3..ae4bdd28 100644 --- a/tests/unit/DocBlock/DescriptionTest.php +++ b/tests/unit/DocBlock/DescriptionTest.php @@ -93,7 +93,7 @@ public function testDescriptionTagsGetter(): void $fixture = new Description($body, $tags); - $this->assertEquals(2, count($fixture->getTags())); + $this->assertCount(2, $fixture->getTags()); $actualTags = $fixture->getTags(); $this->assertSame($tags, $actualTags); From 4595df959d534037c79eac662ea15b69383c14a9 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 28 Dec 2017 22:17:47 +0100 Subject: [PATCH 022/126] bump type resolver --- composer.json | 2 +- composer.lock | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index f97ebdfb..12d58268 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "require": { "php": "^7.1", "phpdocumentor/reflection-common": "^1.0", - "phpdocumentor/type-resolver": "^0.4", + "phpdocumentor/type-resolver": "^0.5", "webmozart/assert": "^1.0" }, "require-dev": { diff --git a/composer.lock b/composer.lock index c81991ac..f60e4ebb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f6bf95704ed863f57d7200f760c54aa0", + "content-hash": "ddbc2e7fc547b4ff06199c20ee406c72", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -62,25 +62,25 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "0.4.0", + "version": "0.5.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + "reference": "7159da1ff4ab5de0c033bab91c9d3f52dd9a7a02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7159da1ff4ab5de0c033bab91c9d3f52dd9a7a02", + "reference": "7159da1ff4ab5de0c033bab91c9d3f52dd9a7a02", "shasum": "" }, "require": { - "php": "^5.5 || ^7.0", + "php": "^7.0", "phpdocumentor/reflection-common": "^1.0" }, "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" }, "type": "library", "extra": { @@ -90,9 +90,7 @@ }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -105,7 +103,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-07-14T14:27:02+00:00" + "time": "2017-11-15T21:30:06+00:00" }, { "name": "webmozart/assert", From a1e6160b99a3a92da5c367bc1f45895926fae31e Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Tue, 2 Jan 2018 04:52:36 -0200 Subject: [PATCH 023/126] Welcome 2018 :tada: --- README.md | 4 ++-- composer.json | 2 +- src/DocBlock.php | 2 +- src/DocBlock/Description.php | 2 +- src/DocBlock/DescriptionFactory.php | 2 +- src/DocBlock/ExampleFinder.php | 2 +- src/DocBlock/Serializer.php | 2 +- src/DocBlock/StandardTagFactory.php | 2 +- src/DocBlock/Tag.php | 2 +- src/DocBlock/TagFactory.php | 2 +- src/DocBlock/Tags/Author.php | 2 +- src/DocBlock/Tags/BaseTag.php | 2 +- src/DocBlock/Tags/Covers.php | 2 +- src/DocBlock/Tags/Deprecated.php | 2 +- src/DocBlock/Tags/Example.php | 2 +- src/DocBlock/Tags/Factory/StaticMethod.php | 2 +- src/DocBlock/Tags/Factory/Strategy.php | 2 +- src/DocBlock/Tags/Formatter.php | 2 +- src/DocBlock/Tags/Formatter/AlignFormatter.php | 2 +- src/DocBlock/Tags/Formatter/PassthroughFormatter.php | 2 +- src/DocBlock/Tags/Generic.php | 2 +- src/DocBlock/Tags/Link.php | 2 +- src/DocBlock/Tags/Method.php | 2 +- src/DocBlock/Tags/Param.php | 2 +- src/DocBlock/Tags/Property.php | 2 +- src/DocBlock/Tags/PropertyRead.php | 2 +- src/DocBlock/Tags/PropertyWrite.php | 2 +- src/DocBlock/Tags/Reference/Fqsen.php | 2 +- src/DocBlock/Tags/Reference/Reference.php | 2 +- src/DocBlock/Tags/Reference/Url.php | 2 +- src/DocBlock/Tags/Return_.php | 2 +- src/DocBlock/Tags/See.php | 2 +- src/DocBlock/Tags/Since.php | 2 +- src/DocBlock/Tags/Source.php | 2 +- src/DocBlock/Tags/Throws.php | 2 +- src/DocBlock/Tags/Uses.php | 2 +- src/DocBlock/Tags/Var_.php | 2 +- src/DocBlock/Tags/Version.php | 2 +- src/DocBlockFactory.php | 2 +- tests/integration/DocblocksWithAnnotationsTest.php | 2 +- tests/integration/InterpretingDocBlocksTest.php | 2 +- tests/integration/ReconstitutingADocBlockTest.php | 2 +- tests/integration/UsingTagsTest.php | 2 +- tests/unit/DocBlock/DescriptionFactoryTest.php | 2 +- tests/unit/DocBlock/DescriptionTest.php | 2 +- tests/unit/DocBlock/SerializerTest.php | 2 +- tests/unit/DocBlock/StandardTagFactoryTest.php | 2 +- tests/unit/DocBlock/Tags/AuthorTest.php | 2 +- tests/unit/DocBlock/Tags/CoversTest.php | 2 +- tests/unit/DocBlock/Tags/DeprecatedTest.php | 2 +- tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php | 2 +- .../unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php | 2 +- tests/unit/DocBlock/Tags/GenericTest.php | 2 +- tests/unit/DocBlock/Tags/LinkTest.php | 2 +- tests/unit/DocBlock/Tags/MethodTest.php | 2 +- tests/unit/DocBlock/Tags/ParamTest.php | 2 +- tests/unit/DocBlock/Tags/PropertyReadTest.php | 2 +- tests/unit/DocBlock/Tags/PropertyTest.php | 2 +- tests/unit/DocBlock/Tags/PropertyWriteTest.php | 2 +- tests/unit/DocBlock/Tags/ReturnTest.php | 2 +- tests/unit/DocBlock/Tags/SeeTest.php | 2 +- tests/unit/DocBlock/Tags/SinceTest.php | 2 +- tests/unit/DocBlock/Tags/SourceTest.php | 2 +- tests/unit/DocBlock/Tags/ThrowsTest.php | 2 +- tests/unit/DocBlock/Tags/UsesTest.php | 2 +- tests/unit/DocBlock/Tags/VarTest.php | 2 +- tests/unit/DocBlock/Tags/VersionTest.php | 2 +- tests/unit/DocBlockFactoryTest.php | 2 +- tests/unit/DocBlockTest.php | 2 +- 69 files changed, 70 insertions(+), 70 deletions(-) diff --git a/README.md b/README.md index 5a7d326d..71227480 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,8 @@ instantiated using its `createInstance` factory method like this: $factory = \phpDocumentor\Reflection\DocBlockFactory::createInstance(); ``` -Then we can use the `create` method of the factory to interpret the DocBlock. -Please note that it is also possible to provide a class that has the +Then we can use the `create` method of the factory to interpret the DocBlock. +Please note that it is also possible to provide a class that has the `getDocComment()` method, such as an object of type `ReflectionClass`, the create method will read that if it exists. diff --git a/composer.json b/composer.json index 12d58268..57a6e286 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "phpdocumentor/reflection-docblock", "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "type": "library", + "type": "library", "license": "MIT", "authors": [ { diff --git a/src/DocBlock.php b/src/DocBlock.php index 726a8e04..13cb3834 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index f5592618..a83efcbe 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 3d2a7437..30717799 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index d404a205..b147e52e 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 64eb9961..1daa4afd 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 8ff252ba..f4613291 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tag.php b/src/DocBlock/Tag.php index 8dec92ed..76244b27 100644 --- a/src/DocBlock/Tag.php +++ b/src/DocBlock/Tag.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 34a3cb69..23425dc3 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index c239220b..1dc42c11 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/BaseTag.php b/src/DocBlock/Tags/BaseTag.php index 3c51e622..d844ed16 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 46fcd87e..30c0a3eb 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 8f36729c..914ffa54 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 7c2cfcc0..d5dd513c 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Factory/StaticMethod.php b/src/DocBlock/Tags/Factory/StaticMethod.php index ada9676e..753985ac 100644 --- a/src/DocBlock/Tags/Factory/StaticMethod.php +++ b/src/DocBlock/Tags/Factory/StaticMethod.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Factory/Strategy.php b/src/DocBlock/Tags/Factory/Strategy.php index 1b7afdb6..d1d5a271 100644 --- a/src/DocBlock/Tags/Factory/Strategy.php +++ b/src/DocBlock/Tags/Factory/Strategy.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Formatter.php b/src/DocBlock/Tags/Formatter.php index 16a424f7..68ff419c 100644 --- a/src/DocBlock/Tags/Formatter.php +++ b/src/DocBlock/Tags/Formatter.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Formatter/AlignFormatter.php b/src/DocBlock/Tags/Formatter/AlignFormatter.php index ac908e31..617c660c 100644 --- a/src/DocBlock/Tags/Formatter/AlignFormatter.php +++ b/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -7,7 +7,7 @@ * file that was distributed with this source code. * * @author Jan Schneider - * @copyright 2017 Mike van Riel + * @copyright 2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php index 3676cd50..62e0fcc8 100644 --- a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php +++ b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index 0668f34f..d50f9968 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 2bbd7715..bd23f61e 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -6,7 +6,7 @@ * PHP Version 5.3 * * @author Ben Selby - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 9e8ac193..f2ae498e 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index d386703c..75d50012 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index c421f961..29daefec 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index d37acb0d..b168ffa1 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index b762e586..89f93721 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Reference/Fqsen.php b/src/DocBlock/Tags/Reference/Fqsen.php index 3ba076bc..059d2d5a 100644 --- a/src/DocBlock/Tags/Reference/Fqsen.php +++ b/src/DocBlock/Tags/Reference/Fqsen.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2017 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Reference/Reference.php b/src/DocBlock/Tags/Reference/Reference.php index 4e552527..39501967 100644 --- a/src/DocBlock/Tags/Reference/Reference.php +++ b/src/DocBlock/Tags/Reference/Reference.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2017 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Reference/Url.php b/src/DocBlock/Tags/Reference/Url.php index 32b20709..847423b6 100644 --- a/src/DocBlock/Tags/Reference/Url.php +++ b/src/DocBlock/Tags/Reference/Url.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2017 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 17e6fd92..fd908929 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 67838ad2..b5cc45c0 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 9fe288f0..f048099f 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index b2285e63..cbe06751 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 3b82ead5..544f7a18 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 15608164..1b2ee73a 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index af249063..9f2e3ae1 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 0f958af8..1710adf7 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -6,7 +6,7 @@ * PHP Version 5.3 * * @author Vasil Rangelov - * @copyright 2010-2011 Mike van Riel / Naenius (http://www.naenius.com) + * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index dca5b703..48dba0df 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php index 87ee5c4d..59aa0d3a 100644 --- a/tests/integration/DocblocksWithAnnotationsTest.php +++ b/tests/integration/DocblocksWithAnnotationsTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2017 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index 97c2c7ad..c185ce29 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/ReconstitutingADocBlockTest.php b/tests/integration/ReconstitutingADocBlockTest.php index 8ff8fdfc..9d99f674 100644 --- a/tests/integration/ReconstitutingADocBlockTest.php +++ b/tests/integration/ReconstitutingADocBlockTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/UsingTagsTest.php b/tests/integration/UsingTagsTest.php index dce845d9..8130dcba 100644 --- a/tests/integration/UsingTagsTest.php +++ b/tests/integration/UsingTagsTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php index 228723f5..4942014a 100644 --- a/tests/unit/DocBlock/DescriptionFactoryTest.php +++ b/tests/unit/DocBlock/DescriptionFactoryTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/DescriptionTest.php b/tests/unit/DocBlock/DescriptionTest.php index ae4bdd28..4c28cbb4 100644 --- a/tests/unit/DocBlock/DescriptionTest.php +++ b/tests/unit/DocBlock/DescriptionTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/SerializerTest.php b/tests/unit/DocBlock/SerializerTest.php index 20ac8620..46d9abed 100644 --- a/tests/unit/DocBlock/SerializerTest.php +++ b/tests/unit/DocBlock/SerializerTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 526ca710..4fa1abb4 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 826ba0b4..088c236c 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index a1ef7f41..d16abdf7 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index 7f8a4f55..706f4ce3 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php index 40efcb4f..1251f688 100644 --- a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php @@ -7,7 +7,7 @@ * file that was distributed with this source code. * * @author Jan Schneider - * @copyright 2017 Mike van Riel + * @copyright 2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php index 3f7e8b4c..6c4a2812 100644 --- a/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index c9fa0aef..1f257216 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @generic http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/LinkTest.php b/tests/unit/DocBlock/Tags/LinkTest.php index 0b1f6a7e..2322b399 100644 --- a/tests/unit/DocBlock/Tags/LinkTest.php +++ b/tests/unit/DocBlock/Tags/LinkTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 1a6e43df..b4e65d4e 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index a824bf22..f6f90b65 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index 72e62c94..fde5df63 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index 3792fa35..ff0ca1fd 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index 03009c44..b07c9873 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 52591e45..845a210b 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index a282be41..4787fa1d 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/SinceTest.php b/tests/unit/DocBlock/Tags/SinceTest.php index 04cf35b4..7fce2cd9 100644 --- a/tests/unit/DocBlock/Tags/SinceTest.php +++ b/tests/unit/DocBlock/Tags/SinceTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index 782f38bd..c1fed44d 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 33cd78ce..3451a07e 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index 2e41474f..92904a18 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 46dd0878..599b5e94 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/Tags/VersionTest.php b/tests/unit/DocBlock/Tags/VersionTest.php index 58cddc9f..0302eed0 100644 --- a/tests/unit/DocBlock/Tags/VersionTest.php +++ b/tests/unit/DocBlock/Tags/VersionTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 74ff17d5..6b3e8f6c 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 3a5d0909..84263200 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -6,7 +6,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel + * @copyright 2010-2018 Mike van Riel * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ From 803a9a5b80c34f6bb8558d1b05e92df29ac7f62b Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:33:03 +0100 Subject: [PATCH 024/126] composer: require ecs locally --- composer.json | 3 +- composer.lock | 1778 +++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 1645 insertions(+), 136 deletions(-) diff --git a/composer.json b/composer.json index 57a6e286..276e395e 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,8 @@ "mockery/mockery": "^1.0", "phpunit/phpunit": "^6.4", "doctrine/instantiator": "^1.0", - "phpstan/phpstan": "^0.9.0" + "phpstan/phpstan": "^0.9.0", + "symplify/easy-coding-standard": "^3.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index f60e4ebb..8cd97a05 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ddbc2e7fc547b4ff06199c20ee406c72", + "content-hash": "1ba35ca2206e8aed707c2db7be1d7951", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -157,6 +157,136 @@ } ], "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "doctrine/annotations", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^7.1" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2017-12-06T07:11:42+00:00" + }, { "name": "doctrine/instantiator", "version": "1.1.0", @@ -211,6 +341,190 @@ ], "time": "2017-07-22T11:58:36+00:00" }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.9.0", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "454ddbe65da6a9297446f442bad244e8a99a9a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/454ddbe65da6a9297446f442bad244e8a99a9a38", + "reference": "454ddbe65da6a9297446f442bad244e8a99a9a38", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "gecko-packages/gecko-php-unit": "^2.0 || ^3.0", + "php": "^5.6 || >=7.0 <7.3", + "php-cs-fixer/diff": "^1.2", + "symfony/console": "^3.2 || ^4.0", + "symfony/event-dispatcher": "^3.0 || ^4.0", + "symfony/filesystem": "^3.0 || ^4.0", + "symfony/finder": "^3.0 || ^4.0", + "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0 || ^4.0", + "symfony/stopwatch": "^3.0 || ^4.0" + }, + "conflict": { + "hhvm": "*" + }, + "require-dev": { + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev", + "justinrainbow/json-schema": "^5.0", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.0", + "php-cs-fixer/accessible-object": "^1.0", + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "symfony/phpunit-bridge": "^3.2.2 || ^4.0" + }, + "suggest": { + "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2017-12-08T16:36:20+00:00" + }, + { + "name": "gecko-packages/gecko-php-unit", + "version": "v3.0", + "source": { + "type": "git", + "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", + "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/6a866551dffc2154c1b091bae3a7877d39c25ca3", + "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-dom": "When testing with xml.", + "ext-libxml": "When testing with xml.", + "phpunit/phpunit": "This is an extension for it so make sure you have it some way." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GeckoPackages\\PHPUnit\\": "src/PHPUnit" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Additional PHPUnit asserts and constraints.", + "homepage": "https://github.com/GeckoPackages", + "keywords": [ + "extension", + "filesystem", + "phpunit" + ], + "time": "2017-08-23T07:46:41+00:00" + }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.0", @@ -261,20 +575,20 @@ }, { "name": "jean85/pretty-package-versions", - "version": "1.0.2", + "version": "1.0.3", "source": { "type": "git", "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "cda6ed1bfbcf7a3736b8943466ad8b1b5c0cc7c9" + "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/cda6ed1bfbcf7a3736b8943466ad8b1b5c0cc7c9", - "reference": "cda6ed1bfbcf7a3736b8943466ad8b1b5c0cc7c9", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", + "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", "shasum": "" }, "require": { - "ocramius/package-versions": "^1.1.3", + "ocramius/package-versions": "^1.2.0", "php": "^7.0" }, "require-dev": { @@ -300,7 +614,7 @@ "keywords": [ "package versions" ], - "time": "2017-09-06T15:48:57+00:00" + "time": "2017-11-30T22:02:29+00:00" }, { "name": "mockery/mockery", @@ -488,6 +802,75 @@ ], "time": "2017-08-20T17:36:59+00:00" }, + { + "name": "nette/caching", + "version": "v2.5.6", + "source": { + "type": "git", + "url": "https://github.com/nette/caching.git", + "reference": "1231735b5135ca02bd381b70482c052d2a90bdc9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/caching/zipball/1231735b5135ca02bd381b70482c052d2a90bdc9", + "reference": "1231735b5135ca02bd381b70482c052d2a90bdc9", + "shasum": "" + }, + "require": { + "nette/finder": "^2.2 || ~3.0.0", + "nette/utils": "^2.4 || ~3.0.0", + "php": ">=5.6.0" + }, + "conflict": { + "nette/nette": "<2.2" + }, + "require-dev": { + "latte/latte": "^2.4", + "nette/di": "^2.4 || ~3.0.0", + "nette/tester": "^2.0", + "tracy/tracy": "^2.4" + }, + "suggest": { + "ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "https://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "https://nette.org/contributors" + } + ], + "description": "⏱ Nette Caching: library with easy-to-use API and many cache backends.", + "homepage": "https://nette.org", + "keywords": [ + "cache", + "journal", + "memcached", + "nette", + "sqlite" + ], + "time": "2017-08-30T12:12:25+00:00" + }, { "name": "nette/di", "version": "v2.4.10", @@ -875,16 +1258,16 @@ }, { "name": "nikic/php-parser", - "version": "v3.1.2", + "version": "v3.1.3", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "08131e7ff29de6bb9f12275c7d35df71f25f4d89" + "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/08131e7ff29de6bb9f12275c7d35df71f25f4d89", - "reference": "08131e7ff29de6bb9f12275c7d35df71f25f4d89", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/579f4ce846734a1cf55d6a531d00ca07a43e3cda", + "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda", "shasum": "" }, "require": { @@ -922,20 +1305,20 @@ "parser", "php" ], - "time": "2017-11-04T11:48:34+00:00" + "time": "2017-12-26T14:43:21+00:00" }, { "name": "ocramius/package-versions", - "version": "1.1.3", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "72b226d2957e9e6a9ed09aeaa29cabd840d1a3b7" + "reference": "ad8a245decad4897cc6b432743913dad0d69753c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/72b226d2957e9e6a9ed09aeaa29cabd840d1a3b7", - "reference": "72b226d2957e9e6a9ed09aeaa29cabd840d1a3b7", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", + "reference": "ad8a245decad4897cc6b432743913dad0d69753c", "shasum": "" }, "require": { @@ -946,7 +1329,7 @@ "composer/composer": "^1.3", "ext-zip": "*", "humbug/humbug": "dev-master", - "phpunit/phpunit": "^5.7.5" + "phpunit/phpunit": "^6.4" }, "type": "composer-plugin", "extra": { @@ -971,27 +1354,75 @@ } ], "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2017-09-06T15:24:43+00:00" + "time": "2017-11-24T11:07:03+00:00" }, { - "name": "phar-io/manifest", - "version": "1.0.1", + "name": "paragonie/random_compat", + "version": "v2.0.11", "source": { "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", "shasum": "" }, "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" }, "type": "library", "extra": { @@ -1075,6 +1506,54 @@ "description": "Library for handling version information and constraints", "time": "2017-03-05T17:38:23+00:00" }, + { + "name": "php-cs-fixer/diff", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/f0ef6133d674137e902fdf8a6f2e8e97e14a087b", + "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.4.3", + "symfony/process": "^3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "SpacePossum" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", + "keywords": [ + "diff" + ], + "time": "2017-10-19T09:58:18+00:00" + }, { "name": "phpspec/prophecy", "version": "1.7.3", @@ -1180,20 +1659,20 @@ }, { "name": "phpstan/phpstan", - "version": "0.9", + "version": "0.9.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "f8cccde009c856e42704b7e4c250d5c73c60d00d" + "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f8cccde009c856e42704b7e4c250d5c73c60d00d", - "reference": "f8cccde009c856e42704b7e4c250d5c73c60d00d", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef60e5cc0a32ddb2637523dafef966e0aac1e16f", + "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f", "shasum": "" }, "require": { - "jean85/pretty-package-versions": "^1.0.2", + "jean85/pretty-package-versions": "^1.0.3", "nette/bootstrap": "^2.4 || ^3.0", "nette/di": "^2.4.7 || ^3.0", "nette/robot-loader": "^3.0.1", @@ -1211,7 +1690,7 @@ "phpstan/phpstan-php-parser": "^0.9", "phpstan/phpstan-phpunit": "^0.9", "phpstan/phpstan-strict-rules": "^0.9", - "phpunit/phpunit": "^6.3", + "phpunit/phpunit": "^6.5.2", "slevomat/coding-standard": "4.0.0" }, "bin": [ @@ -1236,20 +1715,20 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2017-11-29T11:25:41+00:00" + "time": "2017-12-02T19:34:06+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "5.2.3", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d" + "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", - "reference": "8e1d2397d8adf59a3f12b2878a3aaa66d1ab189d", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", + "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", "shasum": "" }, "require": { @@ -1258,14 +1737,13 @@ "php": "^7.0", "phpunit/php-file-iterator": "^1.4.2", "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0", + "phpunit/php-token-stream": "^2.0.1", "sebastian/code-unit-reverse-lookup": "^1.0.1", "sebastian/environment": "^3.0", "sebastian/version": "^2.0.1", "theseer/tokenizer": "^1.1" }, "require-dev": { - "ext-xdebug": "^2.5", "phpunit/phpunit": "^6.0" }, "suggest": { @@ -1274,7 +1752,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.2.x-dev" + "dev-master": "5.3.x-dev" } }, "autoload": { @@ -1289,7 +1767,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1300,20 +1778,20 @@ "testing", "xunit" ], - "time": "2017-11-03T13:47:33+00:00" + "time": "2017-12-06T09:29:45+00:00" }, { "name": "phpunit/php-file-iterator", - "version": "1.4.3", + "version": "1.4.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "8ebba84e5bd74fc5fdeb916b38749016c7232f93" + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/8ebba84e5bd74fc5fdeb916b38749016c7232f93", - "reference": "8ebba84e5bd74fc5fdeb916b38749016c7232f93", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", "shasum": "" }, "require": { @@ -1347,7 +1825,7 @@ "filesystem", "iterator" ], - "time": "2017-11-24T15:00:59+00:00" + "time": "2017-11-27T13:52:08+00:00" }, { "name": "phpunit/php-text-template", @@ -1441,16 +1919,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0" + "reference": "791198a2c6254db10131eecfe8c06670700904db" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/9a02332089ac48e704c70f6cefed30c224e3c0b0", - "reference": "9a02332089ac48e704c70f6cefed30c224e3c0b0", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", + "reference": "791198a2c6254db10131eecfe8c06670700904db", "shasum": "" }, "require": { @@ -1486,20 +1964,20 @@ "keywords": [ "tokenizer" ], - "time": "2017-08-20T05:47:52+00:00" + "time": "2017-11-27T05:48:46+00:00" }, { "name": "phpunit/phpunit", - "version": "6.4.4", + "version": "6.5.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932" + "reference": "83d27937a310f2984fd575686138597147bdc7df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/562f7dc75d46510a4ed5d16189ae57fbe45a9932", - "reference": "562f7dc75d46510a4ed5d16189ae57fbe45a9932", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df", + "reference": "83d27937a310f2984fd575686138597147bdc7df", "shasum": "" }, "require": { @@ -1513,12 +1991,12 @@ "phar-io/version": "^1.0", "php": "^7.0", "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.2.2", - "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-code-coverage": "^5.3", + "phpunit/php-file-iterator": "^1.4.3", "phpunit/php-text-template": "^1.2.1", "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^4.0.3", - "sebastian/comparator": "^2.0.2", + "phpunit/phpunit-mock-objects": "^5.0.5", + "sebastian/comparator": "^2.1", "sebastian/diff": "^2.0", "sebastian/environment": "^3.1", "sebastian/exporter": "^3.1", @@ -1544,7 +2022,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "6.4.x-dev" + "dev-master": "6.5.x-dev" } }, "autoload": { @@ -1570,33 +2048,33 @@ "testing", "xunit" ], - "time": "2017-11-08T11:26:09+00:00" + "time": "2017-12-17T06:31:19+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "4.0.4", + "version": "5.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0" + "reference": "283b9f4f670e3a6fd6c4ff95c51a952eb5c75933" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/2f789b59ab89669015ad984afa350c4ec577ade0", - "reference": "2f789b59ab89669015ad984afa350c4ec577ade0", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/283b9f4f670e3a6fd6c4ff95c51a952eb5c75933", + "reference": "283b9f4f670e3a6fd6c4ff95c51a952eb5c75933", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.5", "php": "^7.0", "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.0" + "sebastian/exporter": "^3.1" }, "conflict": { "phpunit/phpunit": "<6.0" }, "require-dev": { - "phpunit/phpunit": "^6.0" + "phpunit/phpunit": "^6.5" }, "suggest": { "ext-soap": "*" @@ -1604,7 +2082,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0.x-dev" + "dev-master": "5.0.x-dev" } }, "autoload": { @@ -1619,7 +2097,7 @@ "authors": [ { "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", + "email": "sebastian@phpunit.de", "role": "lead" } ], @@ -1629,7 +2107,56 @@ "mock", "xunit" ], - "time": "2017-08-03T14:08:16+00:00" + "time": "2017-12-10T08:01:53+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -1725,16 +2252,16 @@ }, { "name": "sebastian/comparator", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158" + "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/1174d9018191e93cb9d719edec01257fc05f8158", - "reference": "1174d9018191e93cb9d719edec01257fc05f8158", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b11c729f95109b56a0fe9650c6a63a0fcd8c439f", + "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f", "shasum": "" }, "require": { @@ -1785,7 +2312,7 @@ "compare", "equality" ], - "time": "2017-11-03T07:16:52+00:00" + "time": "2017-12-22T14:50:35+00:00" }, { "name": "sebastian/diff", @@ -2237,46 +2764,194 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, + { + "name": "slevomat/coding-standard", + "version": "4.1.0", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "3992f968313fdd42fd174210731dd949b3487148" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/3992f968313fdd42fd174210731dd949b3487148", + "reference": "3992f968313fdd42fd174210731dd949b3487148", + "shasum": "" + }, + "require": { + "php": "^7.1", + "squizlabs/php_codesniffer": "^3.0.1" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "0.9.2", + "phing/phing": "2.16", + "phpstan/phpstan": "0.9.1", + "phpunit/phpunit": "6.5.5" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "time": "2017-12-19T12:51:07+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.2.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7c00c3000ac0ce79c96fcbfef86b49a71158cd1", + "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-12-19T21:44:46+00:00" + }, + { + "name": "symfony/config", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "0356e6d5298e9e72212c0bad65c2f1b49e42d622" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/0356e6d5298e9e72212c0bad65c2f1b49e42d622", + "reference": "0356e6d5298e9e72212c0bad65c2f1b49e42d622", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/filesystem": "~3.4|~4.0" + }, + "conflict": { + "symfony/finder": "<3.4" + }, + "require-dev": { + "symfony/finder": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2017-12-14T19:48:22+00:00" + }, { "name": "symfony/console", - "version": "v3.3.13", + "version": "v4.0.2", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805" + "reference": "de8cf039eacdec59d83f7def67e3b8ff5ed46714" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/63cd7960a0a522c3537f6326706d7f3b8de65805", - "reference": "63cd7960a0a522c3537f6326706d7f3b8de65805", + "url": "https://api.github.com/repos/symfony/console/zipball/de8cf039eacdec59d83f7def67e3b8ff5ed46714", + "reference": "de8cf039eacdec59d83f7def67e3b8ff5ed46714", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/debug": "~2.8|~3.0", + "php": "^7.1.3", "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/dependency-injection": "<3.3" + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "~3.3", - "symfony/dependency-injection": "~3.3", - "symfony/event-dispatcher": "~2.8|~3.0", - "symfony/filesystem": "~2.8|~3.0", - "symfony/process": "~2.8|~3.0" + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", - "symfony/filesystem": "", + "symfony/lock": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2303,36 +2978,36 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-11-16T15:24:32+00:00" + "time": "2017-12-14T19:48:22+00:00" }, { "name": "symfony/debug", - "version": "v3.3.13", + "version": "v4.0.2", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "74557880e2846b5c84029faa96b834da37e29810" + "reference": "8c3e709209ce3b952a31c0f4a31ac7703c3d0226" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/74557880e2846b5c84029faa96b834da37e29810", - "reference": "74557880e2846b5c84029faa96b834da37e29810", + "url": "https://api.github.com/repos/symfony/debug/zipball/8c3e709209ce3b952a31c0f4a31ac7703c3d0226", + "reference": "8c3e709209ce3b952a31c0f4a31ac7703c3d0226", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", + "php": "^7.1.3", "psr/log": "~1.0" }, "conflict": { - "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + "symfony/http-kernel": "<3.4" }, "require-dev": { - "symfony/http-kernel": "~2.8|~3.0" + "symfony/http-kernel": "~3.4|~4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { @@ -2359,34 +3034,56 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2017-11-10T16:38:39+00:00" + "time": "2017-12-12T08:41:51+00:00" }, { - "name": "symfony/finder", - "version": "v3.3.13", + "name": "symfony/dependency-injection", + "version": "v4.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "138af5ec075d4b1d1bd19de08c38a34bb2d7d880" + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "d2fa088b5fd7d429974a36bf1a9846b912d9d124" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/138af5ec075d4b1d1bd19de08c38a34bb2d7d880", - "reference": "138af5ec075d4b1d1bd19de08c38a34bb2d7d880", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d2fa088b5fd7d429974a36bf1a9846b912d9d124", + "reference": "d2fa088b5fd7d429974a36bf1a9846b912d9d124", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^7.1.3", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/finder": "<3.4", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.3-dev" + "dev-master": "4.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Component\\Finder\\": "" + "Symfony\\Component\\DependencyInjection\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -2406,42 +3103,53 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Finder Component", + "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-11-05T15:47:03+00:00" + "time": "2017-12-14T19:48:22+00:00" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", + "name": "symfony/event-dispatcher", + "version": "v4.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "d4face19ed8002eec8280bc1c5ec18130472bf43" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d4face19ed8002eec8280bc1c5ec18130472bf43", + "reference": "d4face19ed8002eec8280bc1c5ec18130472bf43", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^7.1.3" + }, + "conflict": { + "symfony/dependency-injection": "<3.4" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0" }, "suggest": { - "ext-mbstring": "For best performance" + "symfony/dependency-injection": "", + "symfony/http-kernel": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.6-dev" + "dev-master": "4.0-dev" } }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" + "Symfony\\Component\\EventDispatcher\\": "" }, - "files": [ - "bootstrap.php" + "exclude-from-classmap": [ + "/Tests/" ] }, "notification-url": "https://packagist.org/downloads/", @@ -2450,25 +3158,825 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill for the Mbstring extension", + "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], + "time": "2017-12-14T19:48:22+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "8c2868641d0c4885eee9c12a89c2b695eb1985cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8c2868641d0c4885eee9c12a89c2b695eb1985cd", + "reference": "8c2868641d0c4885eee9c12a89c2b695eb1985cd", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2017-12-14T19:48:22+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", + "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2017-11-07T14:45:01+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "aba96bd07be7796c81ca0ceafa7d48a6fef036c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/aba96bd07be7796c81ca0ceafa7d48a6fef036c8", + "reference": "aba96bd07be7796c81ca0ceafa7d48a6fef036c8", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.1" + }, + "require-dev": { + "symfony/expression-language": "~3.4|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2017-12-14T19:48:22+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "f2ea7461cdcad837b8bc6022b59d5eb8c9618aa5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f2ea7461cdcad837b8bc6022b59d5eb8c9618aa5", + "reference": "f2ea7461cdcad837b8bc6022b59d5eb8c9618aa5", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "psr/log": "~1.0", + "symfony/debug": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/http-foundation": "~3.4|~4.0" + }, + "conflict": { + "symfony/config": "<3.4", + "symfony/dependency-injection": "<3.4", + "symfony/var-dumper": "<3.4", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~3.4|~4.0", + "symfony/config": "~3.4|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/css-selector": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/dom-crawler": "~3.4|~4.0", + "symfony/expression-language": "~3.4|~4.0", + "symfony/finder": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~3.4|~4.0", + "symfony/templating": "~3.4|~4.0", + "symfony/translation": "~3.4|~4.0", + "symfony/var-dumper": "~3.4|~4.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2017-12-15T03:06:17+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "75fdda335eb0adbd464089e8a0184c61097808e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/75fdda335eb0adbd464089e8a0184c61097808e0", + "reference": "75fdda335eb0adbd464089e8a0184c61097808e0", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony OptionsResolver Component", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "time": "2017-12-14T19:48:22+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2017-10-11T12:05:26+00:00" + }, + { + "name": "symfony/polyfill-php72", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php72.git", + "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/6de4f4884b97abbbed9f0a84a95ff2ff77254254", + "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php72\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], "time": "2017-10-11T12:05:26+00:00" }, + { + "name": "symfony/process", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "18d1953068e72262830bad593f0366fa62c93fb7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/18d1953068e72262830bad593f0366fa62c93fb7", + "reference": "18d1953068e72262830bad593f0366fa62c93fb7", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2017-12-14T19:48:22+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "ac0e49150555c703fef6b696d8eaba1db7a3ca03" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/ac0e49150555c703fef6b696d8eaba1db7a3ca03", + "reference": "ac0e49150555c703fef6b696d8eaba1db7a3ca03", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2017-11-09T12:45:29+00:00" + }, + { + "name": "symfony/yaml", + "version": "v4.0.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "a5ee52d155f06ad23b19eb63c31228ff56ad1116" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a5ee52d155f06ad23b19eb63c31228ff56ad1116", + "reference": "a5ee52d155f06ad23b19eb63c31228ff56ad1116", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2017-12-12T08:41:51+00:00" + }, + { + "name": "symplify/coding-standard", + "version": "v3.0.8", + "source": { + "type": "git", + "url": "https://github.com/Symplify/CodingStandard.git", + "reference": "9a8151cce1be35a66514006005ffbca605d80012" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Symplify/CodingStandard/zipball/9a8151cce1be35a66514006005ffbca605d80012", + "reference": "9a8151cce1be35a66514006005ffbca605d80012", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^2.9", + "nette/finder": "^2.4", + "nette/utils": "^2.4", + "php": "^7.1", + "squizlabs/php_codesniffer": "^3.2", + "symplify/token-runner": "^3.0" + }, + "require-dev": { + "nette/application": "^2.4", + "phpunit/phpunit": "^6.5", + "symplify/easy-coding-standard": "^3.0", + "symplify/package-builder": "^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "psr-4": { + "Symplify\\CodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Set of Symplify rules for PHP_CodeSniffer.", + "time": "2017-12-19T16:38:40+00:00" + }, + { + "name": "symplify/easy-coding-standard", + "version": "v3.0.8", + "source": { + "type": "git", + "url": "https://github.com/Symplify/EasyCodingStandard.git", + "reference": "f9813d1458213745814929b21d0fe8f728ac17a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Symplify/EasyCodingStandard/zipball/f9813d1458213745814929b21d0fe8f728ac17a1", + "reference": "f9813d1458213745814929b21d0fe8f728ac17a1", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^2.9", + "nette/caching": "^2.4|^3.0", + "nette/di": "^2.4|^3.0", + "nette/neon": "^2.4|^3.0", + "nette/robot-loader": "^2.4|^3.0.1", + "nette/utils": "^2.4|^3.0", + "php": "^7.1", + "slevomat/coding-standard": "^4.0", + "squizlabs/php_codesniffer": "^3.2", + "symfony/config": "^4.0", + "symfony/console": "^4.0", + "symfony/dependency-injection": "^4.0", + "symfony/finder": "^4.0", + "symfony/http-kernel": "^4.0", + "symfony/yaml": "^4.0", + "symplify/coding-standard": "^3.0", + "symplify/package-builder": "^3.0", + "symplify/token-runner": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4" + }, + "bin": [ + "bin/easy-coding-standard", + "bin/ecs", + "bin/easy-coding-standard.php" + ], + "type": "library", + "autoload": { + "psr-4": { + "Symplify\\EasyCodingStandard\\": "src", + "Symplify\\EasyCodingStandard\\ChangedFilesDetector\\": "packages/ChangedFilesDetector/src", + "Symplify\\EasyCodingStandard\\Configuration\\": "packages/Configuration/src", + "Symplify\\EasyCodingStandard\\FixerRunner\\": "packages/FixerRunner/src", + "Symplify\\EasyCodingStandard\\SniffRunner\\": "packages/SniffRunner/src", + "Symplify\\EasyCodingStandard\\Performance\\": "packages/Performance/src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer.", + "time": "2017-12-19T16:54:31+00:00" + }, + { + "name": "symplify/package-builder", + "version": "v3.0.8", + "source": { + "type": "git", + "url": "https://github.com/Symplify/PackageBuilder.git", + "reference": "f3a1c72d6c48812c8784475d625c54af5052f3bd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Symplify/PackageBuilder/zipball/f3a1c72d6c48812c8784475d625c54af5052f3bd", + "reference": "f3a1c72d6c48812c8784475d625c54af5052f3bd", + "shasum": "" + }, + "require": { + "nette/di": "^2.4|^3.0", + "nette/neon": "^2.4|^3.0", + "php": "^7.1", + "symfony/config": "^4.0", + "symfony/console": "^4.0", + "symfony/dependency-injection": "^4.0", + "symfony/finder": "^4.0", + "symfony/http-kernel": "^4.0", + "symfony/yaml": "^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.4", + "tracy/tracy": "^2.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symplify\\PackageBuilder\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Dependency Injection, Console and Kernel toolkit for Symplify packages.", + "time": "2017-12-25T18:47:52+00:00" + }, + { + "name": "symplify/token-runner", + "version": "v3.0.8", + "source": { + "type": "git", + "url": "https://github.com/Symplify/TokenRunner.git", + "reference": "eeb21bce8ac048410dbbce69d584c74644ca6add" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Symplify/TokenRunner/zipball/eeb21bce8ac048410dbbce69d584c74644ca6add", + "reference": "eeb21bce8ac048410dbbce69d584c74644ca6add", + "shasum": "" + }, + "require": { + "friendsofphp/php-cs-fixer": "^2.9", + "nette/finder": "^2.4", + "nette/utils": "^2.4", + "php": "^7.1", + "phpdocumentor/reflection-docblock": "^4.2", + "squizlabs/php_codesniffer": "^3.2", + "symplify/package-builder": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symplify\\TokenRunner\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Set of utils for PHP_CodeSniffer and PHP CS Fixer.", + "time": "2017-12-25T20:32:49+00:00" + }, { "name": "theseer/tokenizer", "version": "1.1.0", From 67d8d8eca5d90ab08f9d97ecdc19a2931af45577 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:38:48 +0100 Subject: [PATCH 025/126] travis: split PHPSTAN and ECS runs --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6e3c9cbd..d464e605 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,9 @@ php: matrix: include: - php: 7.1 - env: STATIC_ANALYSIS=true + env: ECS=true + - php: 7.1 + env: PHPSTAN=true cache: directories: @@ -15,14 +17,12 @@ cache: install: - composer install --no-interaction - # coding style - - if [[ $STATIC_ANALYSIS != "" ]]; then composer create-project symplify/easy-coding-standard temp/ecs; fi + - if [[ $ECS != "" ]]; then composer create-project symplify/easy-coding-standard temp/ecs; fi script: - vendor/bin/phpunit --coverage-clover=coverage.xml -v - # coding style - - if [[ $STATIC_ANALYSIS != "" ]]; then temp/ecs/bin/ecs check src tests; fi - - if [[ $STATIC_ANALYSIS != "" ]]; then vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; fi + - if [[ $ECS != "" ]]; then temp/ecs/bin/ecs check src tests; fi + - if [[ $PHPSTAN != "" ]]; then vendor/bin/phpstan analyse src tests --level max --configuration phpstan.neon; fi after_script: - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; From 84bd0918ef5c60bd576e8483cb632f79293978ac Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:39:56 +0100 Subject: [PATCH 026/126] ecs - fix config paths --- easy-coding-standard.neon | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index 7c2ba6e2..e0e7b3eb 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -1,7 +1,6 @@ includes: - temp/ecs/config/clean-code.neon - - temp/ecs/config/psr2-checkers.neon - - temp/ecs/config/spaces.neon + - temp/ecs/config/psr2.neon - temp/ecs/config/common.neon checkers: From 89a0935960e43f91ca2c4adfd3ae96157410b89e Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:40:42 +0100 Subject: [PATCH 027/126] travis: drop tests from phsptan, too many errors --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d464e605..153880f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,7 +22,7 @@ install: script: - vendor/bin/phpunit --coverage-clover=coverage.xml -v - if [[ $ECS != "" ]]; then temp/ecs/bin/ecs check src tests; fi - - if [[ $PHPSTAN != "" ]]; then vendor/bin/phpstan analyse src tests --level max --configuration phpstan.neon; fi + - if [[ $PHPSTAN != "" ]]; then vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; fi after_script: - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; From 1c8f795c0ecb52bf83c285c40aa15637cc194e37 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:40:57 +0100 Subject: [PATCH 028/126] apply coding standard to code --- src/DocBlock/DescriptionFactory.php | 6 +- src/DocBlock/Serializer.php | 2 +- src/DocBlock/StandardTagFactory.php | 44 ++++----- src/DocBlock/Tags/Author.php | 2 +- src/DocBlock/Tags/Example.php | 14 +-- .../Tags/Formatter/AlignFormatter.php | 2 +- .../Tags/Formatter/PassthroughFormatter.php | 2 +- src/DocBlock/Tags/Link.php | 2 +- src/DocBlock/Tags/Method.php | 20 ++-- src/DocBlock/Tags/Reference/Fqsen.php | 2 +- src/DocBlock/Tags/See.php | 2 +- src/DocBlock/Tags/Since.php | 2 +- src/DocBlock/Tags/Source.php | 14 +-- src/DocBlock/Tags/Throws.php | 4 +- src/DocBlock/Tags/Uses.php | 2 +- src/DocBlock/Tags/Var_.php | 8 +- src/DocBlockFactory.php | 2 +- .../DocblocksWithAnnotationsTest.php | 2 +- .../integration/InterpretingDocBlocksTest.php | 4 +- tests/integration/UsingTagsTest.php | 2 +- .../unit/DocBlock/DescriptionFactoryTest.php | 18 ++-- tests/unit/DocBlock/DescriptionTest.php | 4 +- tests/unit/DocBlock/SerializerTest.php | 8 +- .../unit/DocBlock/StandardTagFactoryTest.php | 37 ++++---- tests/unit/DocBlock/Tags/CoversTest.php | 5 +- tests/unit/DocBlock/Tags/DeprecatedTest.php | 4 +- tests/unit/DocBlock/Tags/ExampleTest.php | 1 - .../Tags/Formatter/AlignFormatterTest.php | 4 +- tests/unit/DocBlock/Tags/GenericTest.php | 5 +- tests/unit/DocBlock/Tags/LinkTest.php | 6 +- tests/unit/DocBlock/Tags/MethodTest.php | 91 +++++++++---------- tests/unit/DocBlock/Tags/ParamTest.php | 4 +- tests/unit/DocBlock/Tags/PropertyReadTest.php | 4 +- tests/unit/DocBlock/Tags/PropertyTest.php | 4 +- .../unit/DocBlock/Tags/PropertyWriteTest.php | 4 +- tests/unit/DocBlock/Tags/ReturnTest.php | 4 +- tests/unit/DocBlock/Tags/SeeTest.php | 10 +- tests/unit/DocBlock/Tags/SinceTest.php | 11 +-- tests/unit/DocBlock/Tags/SourceTest.php | 6 +- tests/unit/DocBlock/Tags/ThrowsTest.php | 10 +- tests/unit/DocBlock/Tags/UsesTest.php | 10 +- tests/unit/DocBlock/Tags/VarTest.php | 8 +- tests/unit/DocBlock/Tags/VersionTest.php | 10 +- tests/unit/DocBlockFactoryTest.php | 18 ++-- tests/unit/DocBlockTest.php | 4 +- 45 files changed, 212 insertions(+), 216 deletions(-) diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 30717799..5da07e12 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -112,7 +112,7 @@ private function parse($tokens, ?TypeContext $context = null): array { $count = count($tokens); $tagCount = 0; - $tags = []; + $tags = []; for ($i = 1; $i < $count; $i += 2) { $tags[] = $this->tagFactory->create($tokens[$i], $context); @@ -156,7 +156,7 @@ private function removeSuperfluousStartingWhitespace(string $contents): string // determine how many whitespace characters need to be stripped $startingSpaceCount = 9999999; - for ($i = 1; $i < count($lines); $i++) { + for ($i = 1; $i < count($lines); ++$i) { // lines with a no length do not count as they are not indented at all if (strlen(trim($lines[$i])) === 0) { continue; @@ -169,7 +169,7 @@ private function removeSuperfluousStartingWhitespace(string $contents): string // strip the number of spaces from each line if ($startingSpaceCount > 0) { - for ($i = 1; $i < count($lines); $i++) { + for ($i = 1; $i < count($lines); ++$i) { $lines[$i] = substr($lines[$i], $startingSpaceCount); } } diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 1daa4afd..d9cb0757 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -105,7 +105,7 @@ private function addAsterisksForEachLine($indent, $text) private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string { - $text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription() + $text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription() : ''); if ($wrapLength !== null) { $text = wordwrap($text, $wrapLength); diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index f4613291..106b6b4b 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -45,25 +45,25 @@ final class StandardTagFactory implements TagFactory * @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value. */ private $tagHandlerMappings = [ - 'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author', - 'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers', - 'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated', + 'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author', + 'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers', + 'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated', // 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example', - 'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link', - 'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method', - 'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param', - 'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', - 'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property', + 'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link', + 'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method', + 'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param', + 'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', + 'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property', 'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite', - 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_', - 'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See', - 'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since', - 'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source', - 'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', - 'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', - 'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses', - 'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_', - 'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version' + 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_', + 'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See', + 'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since', + 'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source', + 'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', + 'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', + 'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses', + 'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_', + 'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version', ]; /** @@ -186,7 +186,7 @@ private function extractTagParts(string $tagLine) private function createTag(string $body, string $name, TypeContext $context): ?Tag { $handlerClassName = $this->findHandlerClassName($name, $context); - $arguments = $this->getArgumentsForParametersFromWiring( + $arguments = $this->getArgumentsForParametersFromWiring( $this->fetchParametersForHandlerFactoryMethod($handlerClassName), $this->getServiceLocatorWithDynamicParameters($context, $name, $body) ); @@ -254,7 +254,7 @@ private function getArgumentsForParametersFromWiring($parameters, $locator) private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) { if (! isset($this->tagHandlerParameterCache[$handlerClassName])) { - $methodReflection = new \ReflectionMethod($handlerClassName, 'create'); + $methodReflection = new \ReflectionMethod($handlerClassName, 'create'); $this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters(); } @@ -276,9 +276,9 @@ private function getServiceLocatorWithDynamicParameters(TypeContext $context, st $locator = array_merge( $this->serviceLocator, [ - 'name' => $tagName, - 'body' => $tagBody, - TypeContext::class => $context + 'name' => $tagName, + 'body' => $tagBody, + TypeContext::class => $context, ] ); diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index 1dc42c11..60f082cb 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -36,7 +36,7 @@ public function __construct(string $authorName, string $authorEmail) throw new \InvalidArgumentException('The author tag does not have a valid e-mail address'); } - $this->authorName = $authorName; + $this->authorName = $authorName; $this->authorEmail = $authorEmail; } diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index d5dd513c..437a2271 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -69,7 +69,7 @@ public function getContent() if ($this->isURI) { $filePath = $this->isUriRelative($this->filePath) ? str_replace('%2F', '/', rawurlencode($this->filePath)) - :$this->filePath; + : $this->filePath; } return trim($filePath . ' ' . parent::getDescription()); @@ -89,7 +89,7 @@ public static function create(string $body) } $filePath = null; - $fileUri = null; + $fileUri = null; if ('' !== $matches[1]) { $filePath = $matches[1]; } else { @@ -97,17 +97,17 @@ public static function create(string $body) } $startingLine = 1; - $lineCount = null; - $description = null; + $lineCount = null; + $description = null; if (array_key_exists(3, $matches)) { $description = $matches[3]; // Starting line / Number of lines / Description if (preg_match('/^([1-9]\d*)(?:\s+((?1))\s*)?(.*)$/sux', $matches[3], $contentMatches)) { - $startingLine = (int)$contentMatches[1]; + $startingLine = (int) $contentMatches[1]; if (isset($contentMatches[2]) && $contentMatches[2] !== '') { - $lineCount = (int)$contentMatches[2]; + $lineCount = (int) $contentMatches[2]; } if (array_key_exists(3, $contentMatches)) { @@ -117,7 +117,7 @@ public static function create(string $body) } return new static( - $filePath !== null?$filePath:$fileUri, + $filePath !== null ? $filePath : $fileUri, $fileUri !== null, $startingLine, $lineCount, diff --git a/src/DocBlock/Tags/Formatter/AlignFormatter.php b/src/DocBlock/Tags/Formatter/AlignFormatter.php index 617c660c..6a47f5df 100644 --- a/src/DocBlock/Tags/Formatter/AlignFormatter.php +++ b/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -39,6 +39,6 @@ public function __construct(array $tags) */ public function format(Tag $tag): string { - return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string)$tag; + return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string) $tag; } } diff --git a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php index 62e0fcc8..a143afa7 100644 --- a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php +++ b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -23,6 +23,6 @@ class PassthroughFormatter implements Formatter */ public function format(Tag $tag): string { - return trim('@' . $tag->getName() . ' ' . (string)$tag); + return trim('@' . $tag->getName() . ' ' . (string) $tag); } } diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index bd23f61e..45953ede 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -40,7 +40,7 @@ public function __construct(string $link, ?Description $description = null) /** * {@inheritdoc} */ - public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): Link + public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self { Assert::notNull($descriptionFactory); diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index f2ae498e..2862731b 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -54,10 +54,10 @@ public function __construct( $returnType = new Void_(); } - $this->methodName = $methodName; - $this->arguments = $this->filterArguments($arguments); - $this->returnType = $returnType; - $this->isStatic = $static; + $this->methodName = $methodName; + $this->arguments = $this->filterArguments($arguments); + $this->returnType = $returnType; + $this->isStatic = $static; $this->description = $description; } @@ -71,7 +71,7 @@ public static function create( ?TypeContext $context = null ): ?self { Assert::stringNotEmpty($body); - Assert::allNotNull([ $typeResolver, $descriptionFactory ]); + Assert::allNotNull([$typeResolver, $descriptionFactory]); // 1. none or more whitespace // 2. optionally the keyword "static" followed by whitespace @@ -131,7 +131,7 @@ public static function create( $returnType = 'void'; } - $returnType = $typeResolver->resolve($returnType, $context); + $returnType = $typeResolver->resolve($returnType, $context); $description = $descriptionFactory->create($description, $context); if (is_string($arguments) && strlen($arguments) > 0) { @@ -150,7 +150,7 @@ public static function create( } } - $argument = [ 'name' => $argumentName, 'type' => $argumentType]; + $argument = ['name' => $argumentName, 'type' => $argumentType]; } } else { $arguments = []; @@ -198,7 +198,7 @@ public function __toString(): string } return trim(($this->isStatic() ? 'static ' : '') - . (string)$this->returnType . ' ' + . (string) $this->returnType . ' ' . $this->methodName . '(' . implode(', ', $arguments) . ')' . ($this->description ? ' ' . $this->description->render() : '')); @@ -208,7 +208,7 @@ private function filterArguments($arguments) { foreach ($arguments as &$argument) { if (is_string($argument)) { - $argument = [ 'name' => $argument ]; + $argument = ['name' => $argument]; } if (! isset($argument['type'])) { @@ -217,7 +217,7 @@ private function filterArguments($arguments) $keys = array_keys($argument); sort($keys); - if ($keys !== [ 'name', 'type' ]) { + if ($keys !== ['name', 'type']) { throw new \InvalidArgumentException( 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) ); diff --git a/src/DocBlock/Tags/Reference/Fqsen.php b/src/DocBlock/Tags/Reference/Fqsen.php index 059d2d5a..748ea3cc 100644 --- a/src/DocBlock/Tags/Reference/Fqsen.php +++ b/src/DocBlock/Tags/Reference/Fqsen.php @@ -38,6 +38,6 @@ public function __construct(RealFqsen $fqsen) */ public function __toString(): string { - return (string)$this->fqsen; + return (string) $this->fqsen; } } diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index b5cc45c0..a6fb3a29 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -52,7 +52,7 @@ public static function create( ) { Assert::allNotNull([$resolver, $descriptionFactory]); - $parts = preg_split('/\s+/Su', $body, 2); + $parts = preg_split('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; // https://tools.ietf.org/html/rfc2396#section-3 diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index f048099f..de714c57 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -49,7 +49,7 @@ public function __construct($version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); - $this->version = $version; + $this->version = $version; $this->description = $description; } diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index cbe06751..b2420d1b 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -37,9 +37,9 @@ public function __construct($startingLine, $lineCount = null, ?Description $desc Assert::integerish($startingLine); Assert::nullOrIntegerish($lineCount); - $this->startingLine = (int)$startingLine; - $this->lineCount = $lineCount !== null ? (int)$lineCount : null; - $this->description = $description; + $this->startingLine = (int) $startingLine; + $this->lineCount = $lineCount !== null ? (int) $lineCount : null; + $this->description = $description; } /** @@ -54,14 +54,14 @@ public static function create( Assert::notNull($descriptionFactory); $startingLine = 1; - $lineCount = null; - $description = null; + $lineCount = null; + $description = null; // Starting line / Number of lines / Description if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) { - $startingLine = (int)$matches[1]; + $startingLine = (int) $matches[1]; if (isset($matches[2]) && $matches[2] !== '') { - $lineCount = (int)$matches[2]; + $lineCount = (int) $matches[2]; } $description = $matches[3]; diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 544f7a18..5e851842 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -32,7 +32,7 @@ final class Throws extends BaseTag implements Factory\StaticMethod public function __construct(Type $type, ?Description $description = null) { - $this->type = $type; + $this->type = $type; $this->description = $description; } @@ -49,7 +49,7 @@ public static function create( $parts = preg_split('/\s+/Su', $body, 2); - $type = $typeResolver->resolve($parts[0] ?? '', $context); + $type = $typeResolver->resolve($parts[0] ?? '', $context); $description = $descriptionFactory->create($parts[1] ?? '', $context); return new static($type, $description); diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 1b2ee73a..ff7774fd 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -35,7 +35,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod */ public function __construct(Fqsen $refers, ?Description $description = null) { - $this->refers = $refers; + $this->refers = $refers; $this->description = $description; } diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 9f2e3ae1..dbb25957 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -37,8 +37,8 @@ class Var_ extends BaseTag implements Factory\StaticMethod public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -53,8 +53,8 @@ public static function create( Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 48dba0df..ca16bf65 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -41,7 +41,7 @@ public function __construct(DescriptionFactory $descriptionFactory, TagFactory $ * * @param string[] $additionalTags */ - public static function createInstance(array $additionalTags = []): DocBlockFactory + public static function createInstance(array $additionalTags = []): self { $fqsenResolver = new FqsenResolver(); $tagFactory = new StandardTagFactory($fqsenResolver); diff --git a/tests/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php index 59aa0d3a..06e50815 100644 --- a/tests/integration/DocblocksWithAnnotationsTest.php +++ b/tests/integration/DocblocksWithAnnotationsTest.php @@ -39,7 +39,7 @@ public function testDocblockWithAnnotations(): void */ DOCCOMMENT; - $factory = DocBlockFactory::createInstance(); + $factory = DocBlockFactory::createInstance(); $docblock = $factory->create($docComment); $this->assertCount(3, $docblock->getTags()); diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index c185ce29..b2ec5ea0 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -74,8 +74,8 @@ public function testInterpretingTags(): void $this->assertInstanceOf(See::class, $seeTags[0]); $seeTag = $seeTags[0]; - $this->assertSame('\\' . StandardTagFactory::class, (string)$seeTag->getReference()); - $this->assertSame('', (string)$seeTag->getDescription()); + $this->assertSame('\\' . StandardTagFactory::class, (string) $seeTag->getReference()); + $this->assertSame('', (string) $seeTag->getDescription()); } public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void diff --git a/tests/integration/UsingTagsTest.php b/tests/integration/UsingTagsTest.php index 8130dcba..101cbf86 100644 --- a/tests/integration/UsingTagsTest.php +++ b/tests/integration/UsingTagsTest.php @@ -42,7 +42,7 @@ public function testAddingYourOwnTagUsingAStaticMethodAsFactory(): void $this->assertInstanceOf(\MyTag::class, $customTagObjects[0]); $this->assertSame('my-tag', $customTagObjects[0]->getName()); - $this->assertSame('I have a description', (string)$customTagObjects[0]->getDescription()); + $this->assertSame('I have a description', (string) $customTagObjects[0]->getDescription()); $this->assertSame($docComment, $reconstitutedDocComment); } } diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php index 4942014a..0f8376f5 100644 --- a/tests/unit/DocBlock/DescriptionFactoryTest.php +++ b/tests/unit/DocBlock/DescriptionFactoryTest.php @@ -43,7 +43,7 @@ public function testDescriptionCanParseASimpleString($contents): void $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, new Context('')); $this->assertSame($contents, $description->render()); @@ -60,7 +60,7 @@ public function testEscapeSequences($contents, $expected): void $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, new Context('')); $this->assertSame($expected, $description->render()); @@ -77,15 +77,15 @@ public function testEscapeSequences($contents, $expected): void */ public function testDescriptionCanParseAStringWithInlineTag(): void { - $contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'; - $context = new Context(''); + $contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'; + $context = new Context(''); $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create') ->once() ->with('@link http://phpdoc.org/ description', $context) ->andReturn(new Link('http://phpdoc.org/', new Description('description'))); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, $context); $this->assertSame($contents, $description->render()); @@ -102,15 +102,15 @@ public function testDescriptionCanParseAStringWithInlineTag(): void */ public function testDescriptionCanParseAStringStartingWithInlineTag(): void { - $contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'; - $context = new Context(''); + $contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'; + $context = new Context(''); $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create') ->once() ->with('@link http://phpdoc.org/ This', $context) ->andReturn(new Link('http://phpdoc.org/', new Description('This'))); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, $context); $this->assertSame($contents, $description->render()); @@ -123,7 +123,7 @@ public function testDescriptionCanParseAStringStartingWithInlineTag(): void */ public function testIfSuperfluousStartingSpacesAreRemoved(): void { - $factory = new DescriptionFactory(m::mock(TagFactory::class)); + $factory = new DescriptionFactory(m::mock(TagFactory::class)); $descriptionText = <<assertSame($expected, (string)$fixture); + $this->assertSame($expected, (string) $fixture); } /** @@ -123,6 +123,6 @@ public function testDescriptionMultipleTagsCanBeCastToString(): void $fixture = new Description($body, $tags); $expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})'; - $this->assertSame($expected, (string)$fixture); + $this->assertSame($expected, (string) $fixture); } } diff --git a/tests/unit/DocBlock/SerializerTest.php b/tests/unit/DocBlock/SerializerTest.php index 46d9abed..adfd8f93 100644 --- a/tests/unit/DocBlock/SerializerTest.php +++ b/tests/unit/DocBlock/SerializerTest.php @@ -58,7 +58,7 @@ public function testReconstructsADocCommentFromADocBlock(): void 'This is a summary', new Description('This is a description'), [ - new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')) + new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')), ] ); @@ -92,7 +92,7 @@ public function testAddPrefixToDocBlock(): void 'This is a summary', new Description('This is a description'), [ - new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')) + new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')), ] ); @@ -126,7 +126,7 @@ public function testAddPrefixToDocBlockExceptFirstLine(): void 'This is a summary', new Description('This is a description'), [ - new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')) + new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')), ] ); @@ -166,7 +166,7 @@ public function testWordwrapsAroundTheGivenAmountOfCharacters(): void 'This is a summary', new Description('This is a description'), [ - new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')) + new DocBlock\Tags\Generic('unknown-tag', new Description('Test description for the unknown tag')), ] ); diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 4fa1abb4..e6647c71 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -32,7 +32,6 @@ */ class StandardTagFactoryTest extends TestCase { - /** * Call Mockery::close after each test. */ @@ -51,10 +50,10 @@ public function tearDown(): void */ public function testCreatingAGenericTag(): void { - $expectedTagName = 'unknown-tag'; + $expectedTagName = 'unknown-tag'; $expectedDescriptionText = 'This is a description'; - $expectedDescription = new Description($expectedDescriptionText); - $context = new Context(''); + $expectedDescription = new Description($expectedDescriptionText); + $context = new Context(''); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory @@ -83,7 +82,7 @@ public function testCreatingAGenericTag(): void */ public function testCreatingASpecificTag(): void { - $context = new Context(''); + $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); /** @var Author $tag */ @@ -104,8 +103,8 @@ public function testCreatingASpecificTag(): void */ public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void { - $fqsen = '\Tag'; - $resolver = m::mock(FqsenResolver::class) + $fqsen = '\Tag'; + $resolver = m::mock(FqsenResolver::class) ->shouldReceive('resolve') ->with('Tag', m::type(Context::class)) ->andReturn(new Fqsen($fqsen)) @@ -120,7 +119,7 @@ public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void $tag = $tagFactory->create('@see Tag'); $this->assertInstanceOf(See::class, $tag); - $this->assertSame($fqsen, (string)$tag->getReference()); + $this->assertSame($fqsen, (string) $tag->getReference()); } /** @@ -132,7 +131,7 @@ public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void */ public function testPassingYourOwnSetOfTagHandlers(): void { - $context = new Context(''); + $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]); /** @var Author $tag */ @@ -162,7 +161,7 @@ public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void */ public function testAddParameterToServiceLocator(): void { - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addParameter('myParam', 'myValue'); @@ -181,7 +180,7 @@ public function testAddServiceToServiceLocator(): void { $service = new PassthroughFormatter(); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addService($service); @@ -199,9 +198,9 @@ public function testAddServiceToServiceLocator(): void public function testInjectConcreteServiceForInterfaceToServiceLocator(): void { $interfaceName = Formatter::class; - $service = new PassthroughFormatter(); + $service = new PassthroughFormatter(); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addService($service, $interfaceName); @@ -221,7 +220,7 @@ public function testInjectConcreteServiceForInterfaceToServiceLocator(): void */ public function testRegisteringAHandlerForANewTag(): void { - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', Author::class); @@ -239,7 +238,7 @@ public function testRegisteringAHandlerForANewTag(): void public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class); } @@ -252,7 +251,7 @@ public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFu public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', ''); } @@ -265,7 +264,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', 'IDoNotExist'); } @@ -278,7 +277,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClas public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', 'stdClass'); } @@ -293,7 +292,7 @@ public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementThe */ public function testReturntagIsMappedCorrectly(): void { - $context = new Context(''); + $context = new Context(''); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index d16abdf7..56c26576 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -27,7 +27,6 @@ */ class CoversTest extends TestCase { - /** * Call Mockery::close after each test. */ @@ -114,7 +113,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); - $this->assertSame('\DateTime Description', (string)$fixture); + $this->assertSame('\DateTime Description', (string) $fixture); } /** @@ -141,7 +140,7 @@ public function testFactoryMethod(): void $fixture = Covers::create('DateTime My Description', $descriptionFactory, $resolver, $context); - $this->assertSame('\DateTime My Description', (string)$fixture); + $this->assertSame('\DateTime My Description', (string) $fixture); $this->assertSame($fqsen, $fixture->getReference()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index 706f4ce3..95607c98 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -111,7 +111,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Deprecated('1.0', new Description('Description')); - $this->assertSame('1.0 Description', (string)$fixture); + $this->assertSame('1.0 Description', (string) $fixture); } /** @@ -133,7 +133,7 @@ public function testFactoryMethod(): void $fixture = Deprecated::create('1.0 My Description', $descriptionFactory, $context); - $this->assertSame('1.0 My Description', (string)$fixture); + $this->assertSame('1.0 My Description', (string) $fixture); $this->assertSame($version, $fixture->getVersion()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/ExampleTest.php b/tests/unit/DocBlock/Tags/ExampleTest.php index 3b3239a2..ab9a3333 100644 --- a/tests/unit/DocBlock/Tags/ExampleTest.php +++ b/tests/unit/DocBlock/Tags/ExampleTest.php @@ -11,7 +11,6 @@ */ class ExampleTest extends TestCase { - /** * Call Mockery::close after each test. */ diff --git a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php index 1251f688..481e7999 100644 --- a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php @@ -50,14 +50,14 @@ public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): v $tags = [ new Param('foobar', new String_()), new Version('1.2.0'), - new Link('http://www.example.com', new Description('Examples')) + new Link('http://www.example.com', new Description('Examples')), ]; $fixture = new AlignFormatter($tags); $expected = [ '@param string $foobar', '@version 1.2.0', - '@link http://www.example.com Examples' + '@link http://www.example.com Examples', ]; foreach ($tags as $key => $tag) { diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index 1f257216..3605bc47 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -32,6 +32,7 @@ public function tearDown(): void { m::close(); } + /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description @@ -98,7 +99,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Generic('generic', new Description('Description')); - $this->assertSame('Description', (string)$fixture); + $this->assertSame('Description', (string) $fixture); } /** @@ -120,7 +121,7 @@ public function testFactoryMethod(): void $fixture = Generic::create('My Description', 'generic', $descriptionFactory, $context); - $this->assertSame('My Description', (string)$fixture); + $this->assertSame('My Description', (string) $fixture); $this->assertSame($generics, $fixture->getName()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/LinkTest.php b/tests/unit/DocBlock/Tags/LinkTest.php index 2322b399..47097d7c 100644 --- a/tests/unit/DocBlock/Tags/LinkTest.php +++ b/tests/unit/DocBlock/Tags/LinkTest.php @@ -111,7 +111,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Link('http://this.is.my/link', new Description('Description')); - $this->assertSame('http://this.is.my/link Description', (string)$fixture); + $this->assertSame('http://this.is.my/link Description', (string) $fixture); } /** @@ -133,7 +133,7 @@ public function testFactoryMethod(): void $fixture = Link::create('http://this.is.my/link My Description', $descriptionFactory, $context); - $this->assertSame('http://this.is.my/link My Description', (string)$fixture); + $this->assertSame('http://this.is.my/link My Description', (string) $fixture); $this->assertSame($links, $fixture->getLink()); $this->assertSame($description, $fixture->getDescription()); } @@ -152,7 +152,7 @@ public function testFactoryMethodCreatesEmptyLinkTag(): void $fixture = Link::create('', $descriptionFactory, new Context('')); - $this->assertSame('', (string)$fixture); + $this->assertSame('', (string) $fixture); $this->assertSame('', $fixture->getLink()); $this->assertSame(null, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index b4e65d4e..880a3cf3 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -66,7 +66,7 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], - ['name' => 'argument2', 'type' => new Object_()] + ['name' => 'argument2', 'type' => new Object_()], ]; $fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description')); @@ -111,7 +111,7 @@ public function testHasMethodName(): void public function testHasArguments(): void { $arguments = [ - [ 'name' => 'argument1', 'type' => new String_() ] + ['name' => 'argument1', 'type' => new String_()], ]; $fixture = new Method('myMethod', $arguments); @@ -127,7 +127,7 @@ public function testArgumentsMayBePassedAsString(): void { $arguments = ['argument1']; $expected = [ - [ 'name' => $arguments[0], 'type' => new Void_() ] + ['name' => $arguments[0], 'type' => new Void_()], ]; $fixture = new Method('myMethod', $arguments); @@ -141,9 +141,9 @@ public function testArgumentsMayBePassedAsString(): void */ public function testArgumentTypeCanBeInferredAsVoid(): void { - $arguments = [ [ 'name' => 'argument1' ] ]; + $arguments = [['name' => 'argument1']]; $expected = [ - [ 'name' => $arguments[0]['name'], 'type' => new Void_() ] + ['name' => $arguments[0]['name'], 'type' => new Void_()], ]; $fixture = new Method('myMethod', $arguments); @@ -160,15 +160,15 @@ public function testArgumentTypeCanBeInferredAsVoid(): void public function testRestArgumentIsParsedAsRegularArg(): void { $expected = [ - [ 'name' => 'arg1', 'type' => new Void_() ], - [ 'name' => 'rest', 'type' => new Void_() ], - [ 'name' => 'rest2', 'type' => new Array_() ], + ['name' => 'arg1', 'type' => new Void_()], + ['name' => 'rest', 'type' => new Void_()], + ['name' => 'rest2', 'type' => new Array_()], ]; $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); - $description = new Description(''); + $resolver = new TypeResolver(); + $context = new Context(''); + $description = new Description(''); $descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description); $fixture = Method::create( @@ -244,13 +244,13 @@ public function testStringRepresentationIsReturned(): void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], - ['name' => 'argument2', 'type' => new Object_()] + ['name' => 'argument2', 'type' => new Object_()], ]; $fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description')); $this->assertSame( 'static void myMethod(string $argument1, object $argument2) My Description', - (string)$fixture + (string) $fixture ); } @@ -266,13 +266,13 @@ public function testStringRepresentationIsReturned(): void public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $description = new Description('My Description'); + $description = new Description('My Description'); $expectedArguments = [ - [ 'name' => 'argument1', 'type' => new String_() ], - [ 'name' => 'argument2', 'type' => new Void_() ] + ['name' => 'argument1', 'type' => new String_()], + ['name' => 'argument2', 'type' => new Void_()], ]; $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -284,7 +284,7 @@ public function testFactoryMethod(): void $context ); - $this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string)$fixture); + $this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string) $fixture); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertEquals($expectedArguments, $fixture->getArguments()); $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); @@ -301,10 +301,10 @@ public function testFactoryMethod(): void public function testReturnTypeThis(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $description = new Description(''); + $description = new Description(''); $descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description); @@ -316,7 +316,7 @@ public function testReturnTypeThis(): void ); $this->assertTrue($fixture->isStatic()); - $this->assertSame('static $this myMethod()', (string)$fixture); + $this->assertSame('static $this myMethod()', (string) $fixture); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertInstanceOf(This::class, $fixture->getReturnType()); } @@ -334,15 +334,14 @@ public function collectionReturnTypesProvider() /** * @dataProvider collectionReturnTypesProvider * @covers ::create - * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: - * @uses \phpDocumentor\Reflection\DocBlock\Description - * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses \phpDocumentor\Reflection\TypeResolver - * @uses \phpDocumentor\Reflection\Types\Array_ - * @uses \phpDocumentor\Reflection\Types\Compound - * @uses \phpDocumentor\Reflection\Types\Integer - * @uses \phpDocumentor\Reflection\Types\Object_ - * @param string null $expectedKeyType + * @uses phpDocumentor\Reflection\DocBlock\Tags\Method:: + * @uses phpDocumentor\Reflection\DocBlock\Description + * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses phpDocumentor\Reflection\TypeResolver + * @uses phpDocumentor\Reflection\Types\Array_ + * @uses phpDocumentor\Reflection\Types\Compound + * @uses phpDocumentor\Reflection\Types\Integer + * @uses phpDocumentor\Reflection\Types\Object_ */ public function testCollectionReturnTypes( string $returnType, @@ -350,11 +349,11 @@ public function testCollectionReturnTypes( ?string $expectedValueType = null, ?string $expectedKeyType = null ): void { - $resolver = new TypeResolver(); + $resolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description('')); - $fixture = Method::create("$returnType myMethod(\$arg)", $resolver, $descriptionFactory); + $fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory); $returnType = $fixture->getReturnType(); $this->assertInstanceOf($expectedType, $returnType); @@ -433,7 +432,7 @@ public function testCreationFailsIfStaticIsNotBoolean(): void public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void { $this->expectException('InvalidArgumentException'); - new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); + new Method('body', [['name' => 'myName', 'unknown' => 'nah']]); } /** @@ -448,10 +447,10 @@ public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void public function testCreateMethodParenthesisMissing(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $description = new Description('My Description'); + $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -462,7 +461,7 @@ public function testCreateMethodParenthesisMissing(): void $context ); - $this->assertSame('static void myMethod() My Description', (string)$fixture); + $this->assertSame('static void myMethod() My Description', (string) $fixture); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertEquals([], $fixture->getArguments()); $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); @@ -482,10 +481,10 @@ public function testCreateMethodParenthesisMissing(): void public function testCreateWithoutReturnType(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $description = new Description(''); + $description = new Description(''); $descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description); @@ -496,7 +495,7 @@ public function testCreateWithoutReturnType(): void $context ); - $this->assertSame('void myMethod()', (string)$fixture); + $this->assertSame('void myMethod()', (string) $fixture); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertEquals([], $fixture->getArguments()); $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); @@ -519,8 +518,8 @@ public function testCreateWithoutReturnType(): void public function testCreateWithMixedReturnTypes(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $descriptionFactory->shouldReceive('create')->andReturn(new Description('')); @@ -531,7 +530,7 @@ public function testCreateWithMixedReturnTypes(): void $context ); - $this->assertSame('\MyClass[]|int[] myMethod()', (string)$fixture); + $this->assertSame('\MyClass[]|int[] myMethod()', (string) $fixture); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertEquals([], $fixture->getArguments()); diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index f6f90b65..45615c97 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -149,7 +149,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); - $this->assertSame('string ...$myParameter Description', (string)$fixture); + $this->assertSame('string ...$myParameter Description', (string) $fixture); } /** @@ -170,7 +170,7 @@ public function testFactoryMethod(): void $fixture = Param::create('string ...$myParameter My Description', $typeResolver, $descriptionFactory, $context); - $this->assertSame('string ...$myParameter My Description', (string)$fixture); + $this->assertSame('string ...$myParameter My Description', (string) $fixture); $this->assertSame('myParameter', $fixture->getVariableName()); $this->assertInstanceOf(String_::class, $fixture->getType()); $this->assertTrue($fixture->isVariadic()); diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index fde5df63..c69508c8 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -131,7 +131,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); - $this->assertSame('string $myProperty Description', (string)$fixture); + $this->assertSame('string $myProperty Description', (string) $fixture); } /** @@ -157,7 +157,7 @@ public function testFactoryMethod(): void $context ); - $this->assertSame('string $myProperty My Description', (string)$fixture); + $this->assertSame('string $myProperty My Description', (string) $fixture); $this->assertSame('myProperty', $fixture->getVariableName()); $this->assertInstanceOf(String_::class, $fixture->getType()); $this->assertSame($description, $fixture->getDescription()); diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index ff0ca1fd..f9e34b25 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -131,7 +131,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Property('myProperty', new String_(), new Description('Description')); - $this->assertSame('string $myProperty Description', (string)$fixture); + $this->assertSame('string $myProperty Description', (string) $fixture); } /** @@ -152,7 +152,7 @@ public function testFactoryMethod(): void $fixture = Property::create('string $myProperty My Description', $typeResolver, $descriptionFactory, $context); - $this->assertSame('string $myProperty My Description', (string)$fixture); + $this->assertSame('string $myProperty My Description', (string) $fixture); $this->assertSame('myProperty', $fixture->getVariableName()); $this->assertInstanceOf(String_::class, $fixture->getType()); $this->assertSame($description, $fixture->getDescription()); diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index b07c9873..65be7f97 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -131,7 +131,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); - $this->assertSame('string $myProperty Description', (string)$fixture); + $this->assertSame('string $myProperty Description', (string) $fixture); } /** @@ -157,7 +157,7 @@ public function testFactoryMethod(): void $context ); - $this->assertSame('string $myProperty My Description', (string)$fixture); + $this->assertSame('string $myProperty My Description', (string) $fixture); $this->assertSame('myProperty', $fixture->getVariableName()); $this->assertInstanceOf(String_::class, $fixture->getType()); $this->assertSame($description, $fixture->getDescription()); diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 845a210b..dd6c4b9e 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -113,7 +113,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Return_(new String_(), new Description('Description')); - $this->assertSame('string Description', (string)$fixture); + $this->assertSame('string Description', (string) $fixture); } /** @@ -137,7 +137,7 @@ public function testFactoryMethod(): void $fixture = Return_::create('string My Description', $resolver, $descriptionFactory, $context); - $this->assertSame('string My Description', (string)$fixture); + $this->assertSame('string My Description', (string) $fixture); $this->assertEquals($type, $fixture->getType()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index 4787fa1d..b876f696 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -126,7 +126,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description')); - $this->assertSame('\DateTime::format() Description', (string)$fixture); + $this->assertSame('\DateTime::format() Description', (string) $fixture); } /** @@ -154,9 +154,9 @@ public function testFactoryMethod(): void $fixture = See::create('DateTime My Description', $resolver, $descriptionFactory, $context); - $this->assertSame('\DateTime My Description', (string)$fixture); + $this->assertSame('\DateTime My Description', (string) $fixture); $this->assertInstanceOf(FqsenRef::class, $fixture->getReference()); - $this->assertSame((string)$fqsen, (string)$fixture->getReference()); + $this->assertSame((string) $fqsen, (string) $fixture->getReference()); $this->assertSame($description, $fixture->getDescription()); } @@ -184,9 +184,9 @@ public function testFactoryMethodWithUrl(): void $fixture = See::create('https://test.org My Description', $resolver, $descriptionFactory, $context); - $this->assertSame('https://test.org My Description', (string)$fixture); + $this->assertSame('https://test.org My Description', (string) $fixture); $this->assertInstanceOf(UrlRef::class, $fixture->getReference()); - $this->assertSame('https://test.org', (string)$fixture->getReference()); + $this->assertSame('https://test.org', (string) $fixture->getReference()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/SinceTest.php b/tests/unit/DocBlock/Tags/SinceTest.php index 7fce2cd9..f55364a9 100644 --- a/tests/unit/DocBlock/Tags/SinceTest.php +++ b/tests/unit/DocBlock/Tags/SinceTest.php @@ -25,7 +25,6 @@ */ class SinceTest extends TestCase { - /** * Call Mockery::close after each test. */ @@ -112,7 +111,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Since('1.0', new Description('Description')); - $this->assertSame('1.0 Description', (string)$fixture); + $this->assertSame('1.0 Description', (string) $fixture); } /** @@ -125,16 +124,16 @@ public function testStringRepresentationIsReturned(): void public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $version = '1.0'; + $version = '1.0'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); $fixture = Since::create('1.0 My Description', $descriptionFactory, $context); - $this->assertSame('1.0 My Description', (string)$fixture); + $this->assertSame('1.0 My Description', (string) $fixture); $this->assertSame($version, $fixture->getVersion()); $this->assertSame($description, $fixture->getDescription()); } @@ -153,7 +152,7 @@ public function testFactoryMethodCreatesEmptySinceTag(): void $fixture = Since::create('', $descriptionFactory, new Context('')); - $this->assertSame('', (string)$fixture); + $this->assertSame('', (string) $fixture); $this->assertSame(null, $fixture->getVersion()); $this->assertSame(null, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index c1fed44d..e1742edd 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -129,7 +129,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Source(1, 10, new Description('Description')); - $this->assertSame('1 10 Description', (string)$fixture); + $this->assertSame('1 10 Description', (string) $fixture); } /** @@ -142,14 +142,14 @@ public function testStringRepresentationIsReturned(): void public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); $fixture = Source::create('1 10 My Description', $descriptionFactory, $context); - $this->assertSame('1 10 My Description', (string)$fixture); + $this->assertSame('1 10 My Description', (string) $fixture); $this->assertSame(1, $fixture->getStartingLine()); $this->assertSame(10, $fixture->getLineCount()); $this->assertSame($description, $fixture->getDescription()); diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 3451a07e..33381271 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -113,7 +113,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Throws(new String_(), new Description('Description')); - $this->assertSame('string Description', (string)$fixture); + $this->assertSame('string Description', (string) $fixture); } /** @@ -128,16 +128,16 @@ public function testStringRepresentationIsReturned(): void public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $type = new String_(); + $type = new String_(); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); $fixture = Throws::create('string My Description', $resolver, $descriptionFactory, $context); - $this->assertSame('string My Description', (string)$fixture); + $this->assertSame('string My Description', (string) $fixture); $this->assertEquals($type, $fixture->getType()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index 92904a18..ee06863e 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -113,7 +113,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); - $this->assertSame('\DateTime Description', (string)$fixture); + $this->assertSame('\DateTime Description', (string) $fixture); } /** @@ -128,10 +128,10 @@ public function testStringRepresentationIsReturned(): void public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = m::mock(FqsenResolver::class); - $context = new Context(''); + $resolver = m::mock(FqsenResolver::class); + $context = new Context(''); - $fqsen = new Fqsen('\DateTime'); + $fqsen = new Fqsen('\DateTime'); $description = new Description('My Description'); $descriptionFactory @@ -140,7 +140,7 @@ public function testFactoryMethod(): void $fixture = Uses::create('DateTime My Description', $resolver, $descriptionFactory, $context); - $this->assertSame('\DateTime My Description', (string)$fixture); + $this->assertSame('\DateTime My Description', (string) $fixture); $this->assertSame($fqsen, $fixture->getReference()); $this->assertSame($description, $fixture->getDescription()); } diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 599b5e94..627b533e 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -142,7 +142,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); - $this->assertSame('string $myVariable Description', (string)$fixture); + $this->assertSame('string $myVariable Description', (string) $fixture); } /** @@ -154,16 +154,16 @@ public function testStringRepresentationIsReturned(): void */ public function testFactoryMethod(): void { - $typeResolver = new TypeResolver(); + $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); $fixture = Var_::create('string $myVariable My Description', $typeResolver, $descriptionFactory, $context); - $this->assertSame('string $myVariable My Description', (string)$fixture); + $this->assertSame('string $myVariable My Description', (string) $fixture); $this->assertSame('myVariable', $fixture->getVariableName()); $this->assertInstanceOf(String_::class, $fixture->getType()); $this->assertSame($description, $fixture->getDescription()); diff --git a/tests/unit/DocBlock/Tags/VersionTest.php b/tests/unit/DocBlock/Tags/VersionTest.php index 0302eed0..1eff1a62 100644 --- a/tests/unit/DocBlock/Tags/VersionTest.php +++ b/tests/unit/DocBlock/Tags/VersionTest.php @@ -111,7 +111,7 @@ public function testStringRepresentationIsReturned(): void { $fixture = new Version('1.0', new Description('Description')); - $this->assertSame('1.0 Description', (string)$fixture); + $this->assertSame('1.0 Description', (string) $fixture); } /** @@ -124,16 +124,16 @@ public function testStringRepresentationIsReturned(): void public function testFactoryMethod(): void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $version = '1.0'; + $version = '1.0'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); $fixture = Version::create('1.0 My Description', $descriptionFactory, $context); - $this->assertSame('1.0 My Description', (string)$fixture); + $this->assertSame('1.0 My Description', (string) $fixture); $this->assertSame($version, $fixture->getVersion()); $this->assertSame($description, $fixture->getDescription()); } @@ -152,7 +152,7 @@ public function testFactoryMethodCreatesEmptyVersionTag(): void $fixture = Version::create('', $descriptionFactory, new Context('')); - $this->assertSame('', (string)$fixture); + $this->assertSame('', (string) $fixture); $this->assertSame(null, $fixture->getVersion()); $this->assertSame(null, $fixture->getDescription()); } diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 6b3e8f6c..c9662fb3 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -60,7 +60,7 @@ public function testCreateDocBlockFromReflection(): void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); - $docBlock = '/** This is a DocBlock */'; + $docBlock = '/** This is a DocBlock */'; $classReflector = m::mock(\ReflectionClass::class); $classReflector->shouldReceive('getDocComment')->andReturn($docBlock); $docblock = $fixture->create($classReflector); @@ -121,7 +121,7 @@ public function testCreateDocBlockFromStringWithoutDocComment(): void public function testSummaryAndDescriptionAreSeparated($given, $summary, $description): void { $tagFactory = m::mock(TagFactory::class); - $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); + $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); $docblock = $fixture->create($given); @@ -138,7 +138,7 @@ public function testSummaryAndDescriptionAreSeparated($given, $summary, $descrip public function testDescriptionsRetainFormatting(): void { $tagFactory = m::mock(TagFactory::class); - $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); + $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); $given = <<shouldReceive('create')->with($tagString, m::type(Context::class))->andReturn($tag); @@ -202,7 +202,7 @@ public function provideSummaryAndDescriptions() [ 'This is a DocBlock. This should still be summary.', 'This is a DocBlock. This should still be summary.', - '' + '', ], [ <<expectException('InvalidArgumentException'); $tags = [ - null + null, ]; $fixture = new DocBlock('', null, $tags); } From a44d973f3d525a1ae56b3a83ce6cdb159b9eb40c Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:42:26 +0100 Subject: [PATCH 029/126] composer: drop ecs --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 276e395e..57a6e286 100644 --- a/composer.json +++ b/composer.json @@ -19,8 +19,7 @@ "mockery/mockery": "^1.0", "phpunit/phpunit": "^6.4", "doctrine/instantiator": "^1.0", - "phpstan/phpstan": "^0.9.0", - "symplify/easy-coding-standard": "^3.0" + "phpstan/phpstan": "^0.9.0" }, "autoload": { "psr-4": { From d613cfc6ea5933770c9fa741567debc3f1513e2d Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Tue, 2 Jan 2018 13:42:57 +0100 Subject: [PATCH 030/126] rebuild composer.lock --- composer.lock | 1676 +------------------------------------------------ 1 file changed, 32 insertions(+), 1644 deletions(-) diff --git a/composer.lock b/composer.lock index 8cd97a05..ce59c7be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "1ba35ca2206e8aed707c2db7be1d7951", + "content-hash": "ddbc2e7fc547b4ff06199c20ee406c72", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -157,136 +157,6 @@ } ], "packages-dev": [ - { - "name": "composer/semver", - "version": "1.4.2", - "source": { - "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", - "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.5 || ^5.0.5", - "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Composer\\Semver\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" - }, - { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" - }, - { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" - } - ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", - "keywords": [ - "semantic", - "semver", - "validation", - "versioning" - ], - "time": "2016-08-30T16:08:34+00:00" - }, - { - "name": "doctrine/annotations", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "reference": "c7f2050c68a9ab0bdb0f98567ec08d80ea7d24d5", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": "^7.1" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2017-12-06T07:11:42+00:00" - }, { "name": "doctrine/instantiator", "version": "1.1.0", @@ -341,190 +211,6 @@ ], "time": "2017-07-22T11:58:36+00:00" }, - { - "name": "doctrine/lexer", - "version": "v1.0.1", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09T13:34:57+00:00" - }, - { - "name": "friendsofphp/php-cs-fixer", - "version": "v2.9.0", - "source": { - "type": "git", - "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "454ddbe65da6a9297446f442bad244e8a99a9a38" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/454ddbe65da6a9297446f442bad244e8a99a9a38", - "reference": "454ddbe65da6a9297446f442bad244e8a99a9a38", - "shasum": "" - }, - "require": { - "composer/semver": "^1.4", - "doctrine/annotations": "^1.2", - "ext-json": "*", - "ext-tokenizer": "*", - "gecko-packages/gecko-php-unit": "^2.0 || ^3.0", - "php": "^5.6 || >=7.0 <7.3", - "php-cs-fixer/diff": "^1.2", - "symfony/console": "^3.2 || ^4.0", - "symfony/event-dispatcher": "^3.0 || ^4.0", - "symfony/filesystem": "^3.0 || ^4.0", - "symfony/finder": "^3.0 || ^4.0", - "symfony/options-resolver": "^3.0 || ^4.0", - "symfony/polyfill-php70": "^1.0", - "symfony/polyfill-php72": "^1.4", - "symfony/process": "^3.0 || ^4.0", - "symfony/stopwatch": "^3.0 || ^4.0" - }, - "conflict": { - "hhvm": "*" - }, - "require-dev": { - "johnkary/phpunit-speedtrap": "^1.1 || ^2.0@dev", - "justinrainbow/json-schema": "^5.0", - "mikey179/vfsstream": "^1.6", - "php-coveralls/php-coveralls": "^2.0", - "php-cs-fixer/accessible-object": "^1.0", - "phpunit/phpunit": "^5.7.23 || ^6.4.3", - "symfony/phpunit-bridge": "^3.2.2 || ^4.0" - }, - "suggest": { - "ext-mbstring": "For handling non-UTF8 characters in cache signature.", - "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." - }, - "bin": [ - "php-cs-fixer" - ], - "type": "application", - "autoload": { - "psr-4": { - "PhpCsFixer\\": "src/" - }, - "classmap": [ - "tests/Test/Assert/AssertTokensTrait.php", - "tests/Test/AbstractFixerTestCase.php", - "tests/Test/AbstractIntegrationTestCase.php", - "tests/Test/IntegrationCase.php", - "tests/Test/IntegrationCaseFactory.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Dariusz Rumiński", - "email": "dariusz.ruminski@gmail.com" - }, - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "A tool to automatically fix PHP code style", - "time": "2017-12-08T16:36:20+00:00" - }, - { - "name": "gecko-packages/gecko-php-unit", - "version": "v3.0", - "source": { - "type": "git", - "url": "https://github.com/GeckoPackages/GeckoPHPUnit.git", - "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GeckoPackages/GeckoPHPUnit/zipball/6a866551dffc2154c1b091bae3a7877d39c25ca3", - "reference": "6a866551dffc2154c1b091bae3a7877d39c25ca3", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-dom": "When testing with xml.", - "ext-libxml": "When testing with xml.", - "phpunit/phpunit": "This is an extension for it so make sure you have it some way." - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "GeckoPackages\\PHPUnit\\": "src/PHPUnit" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Additional PHPUnit asserts and constraints.", - "homepage": "https://github.com/GeckoPackages", - "keywords": [ - "extension", - "filesystem", - "phpunit" - ], - "time": "2017-08-23T07:46:41+00:00" - }, { "name": "hamcrest/hamcrest-php", "version": "v2.0.0", @@ -802,75 +488,6 @@ ], "time": "2017-08-20T17:36:59+00:00" }, - { - "name": "nette/caching", - "version": "v2.5.6", - "source": { - "type": "git", - "url": "https://github.com/nette/caching.git", - "reference": "1231735b5135ca02bd381b70482c052d2a90bdc9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/caching/zipball/1231735b5135ca02bd381b70482c052d2a90bdc9", - "reference": "1231735b5135ca02bd381b70482c052d2a90bdc9", - "shasum": "" - }, - "require": { - "nette/finder": "^2.2 || ~3.0.0", - "nette/utils": "^2.4 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "latte/latte": "^2.4", - "nette/di": "^2.4 || ~3.0.0", - "nette/tester": "^2.0", - "tracy/tracy": "^2.4" - }, - "suggest": { - "ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "⏱ Nette Caching: library with easy-to-use API and many cache backends.", - "homepage": "https://nette.org", - "keywords": [ - "cache", - "journal", - "memcached", - "nette", - "sqlite" - ], - "time": "2017-08-30T12:12:25+00:00" - }, { "name": "nette/di", "version": "v2.4.10", @@ -1357,72 +974,24 @@ "time": "2017-11-24T11:07:03+00:00" }, { - "name": "paragonie/random_compat", - "version": "v2.0.11", + "name": "phar-io/manifest", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/paragonie/random_compat.git", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", - "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", "shasum": "" }, "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "type": "library", - "autoload": { - "files": [ - "lib/random.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "pseudorandom", - "random" - ], - "time": "2017-09-27T21:40:39+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" }, "type": "library", "extra": { @@ -1506,54 +1075,6 @@ "description": "Library for handling version information and constraints", "time": "2017-03-05T17:38:23+00:00" }, - { - "name": "php-cs-fixer/diff", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://github.com/PHP-CS-Fixer/diff.git", - "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/f0ef6133d674137e902fdf8a6f2e8e97e14a087b", - "reference": "f0ef6133d674137e902fdf8a6f2e8e97e14a087b", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.4.3", - "symfony/process": "^3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "SpacePossum" - } - ], - "description": "sebastian/diff v2 backport support for PHP5.6", - "homepage": "https://github.com/PHP-CS-Fixer", - "keywords": [ - "diff" - ], - "time": "2017-10-19T09:58:18+00:00" - }, { "name": "phpspec/prophecy", "version": "1.7.3", @@ -2109,102 +1630,6 @@ ], "time": "2017-12-10T08:01:53+00:00" }, - { - "name": "psr/container", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Container\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", - "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" - ], - "time": "2017-02-14T16:28:37+00:00" - }, - { - "name": "psr/log", - "version": "1.0.2", - "source": { - "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\Log\\": "Psr/Log/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", - "keywords": [ - "log", - "psr", - "psr-3" - ], - "time": "2016-10-10T12:19:37+00:00" - }, { "name": "sebastian/code-unit-reverse-lookup", "version": "1.0.1", @@ -2764,154 +2189,6 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2016-10-03T07:35:21+00:00" }, - { - "name": "slevomat/coding-standard", - "version": "4.1.0", - "source": { - "type": "git", - "url": "https://github.com/slevomat/coding-standard.git", - "reference": "3992f968313fdd42fd174210731dd949b3487148" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/3992f968313fdd42fd174210731dd949b3487148", - "reference": "3992f968313fdd42fd174210731dd949b3487148", - "shasum": "" - }, - "require": { - "php": "^7.1", - "squizlabs/php_codesniffer": "^3.0.1" - }, - "require-dev": { - "jakub-onderka/php-parallel-lint": "0.9.2", - "phing/phing": "2.16", - "phpstan/phpstan": "0.9.1", - "phpunit/phpunit": "6.5.5" - }, - "type": "phpcodesniffer-standard", - "autoload": { - "psr-4": { - "SlevomatCodingStandard\\": "SlevomatCodingStandard" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", - "time": "2017-12-19T12:51:07+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.2.2", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/d7c00c3000ac0ce79c96fcbfef86b49a71158cd1", - "reference": "d7c00c3000ac0ce79c96fcbfef86b49a71158cd1", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "http://www.squizlabs.com/php-codesniffer", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2017-12-19T21:44:46+00:00" - }, - { - "name": "symfony/config", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/config.git", - "reference": "0356e6d5298e9e72212c0bad65c2f1b49e42d622" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/0356e6d5298e9e72212c0bad65c2f1b49e42d622", - "reference": "0356e6d5298e9e72212c0bad65c2f1b49e42d622", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/filesystem": "~3.4|~4.0" - }, - "conflict": { - "symfony/finder": "<3.4" - }, - "require-dev": { - "symfony/finder": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/yaml": "To use the yaml reference dumper" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Config\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Config Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, { "name": "symfony/console", "version": "v4.0.2", @@ -2981,28 +2258,21 @@ "time": "2017-12-14T19:48:22+00:00" }, { - "name": "symfony/debug", + "name": "symfony/finder", "version": "v4.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/debug.git", - "reference": "8c3e709209ce3b952a31c0f4a31ac7703c3d0226" + "url": "https://github.com/symfony/finder.git", + "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/8c3e709209ce3b952a31c0f4a31ac7703c3d0226", - "reference": "8c3e709209ce3b952a31c0f4a31ac7703c3d0226", + "url": "https://api.github.com/repos/symfony/finder/zipball/c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", + "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", "shasum": "" }, "require": { - "php": "^7.1.3", - "psr/log": "~1.0" - }, - "conflict": { - "symfony/http-kernel": "<3.4" - }, - "require-dev": { - "symfony/http-kernel": "~3.4|~4.0" + "php": "^7.1.3" }, "type": "library", "extra": { @@ -3012,7 +2282,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Component\\Debug\\": "" + "Symfony\\Component\\Finder\\": "" }, "exclude-from-classmap": [ "/Tests/" @@ -3032,570 +2302,30 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Debug Component", + "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-12-12T08:41:51+00:00" + "time": "2017-11-07T14:45:01+00:00" }, { - "name": "symfony/dependency-injection", - "version": "v4.0.2", + "name": "symfony/polyfill-mbstring", + "version": "v1.6.0", "source": { "type": "git", - "url": "https://github.com/symfony/dependency-injection.git", - "reference": "d2fa088b5fd7d429974a36bf1a9846b912d9d124" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/d2fa088b5fd7d429974a36bf1a9846b912d9d124", - "reference": "d2fa088b5fd7d429974a36bf1a9846b912d9d124", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/container": "^1.0" - }, - "conflict": { - "symfony/config": "<3.4", - "symfony/finder": "<3.4", - "symfony/proxy-manager-bridge": "<3.4", - "symfony/yaml": "<3.4" - }, - "provide": { - "psr/container-implementation": "1.0" - }, - "require-dev": { - "symfony/config": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/yaml": "~3.4|~4.0" - }, - "suggest": { - "symfony/config": "", - "symfony/expression-language": "For using expressions in service container configuration", - "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", - "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", - "symfony/yaml": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\DependencyInjection\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony DependencyInjection Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/event-dispatcher", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "d4face19ed8002eec8280bc1c5ec18130472bf43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d4face19ed8002eec8280bc1c5ec18130472bf43", - "reference": "d4face19ed8002eec8280bc1c5ec18130472bf43", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "conflict": { - "symfony/dependency-injection": "<3.4" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0" - }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\EventDispatcher\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony EventDispatcher Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/filesystem", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/filesystem.git", - "reference": "8c2868641d0c4885eee9c12a89c2b695eb1985cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/8c2868641d0c4885eee9c12a89c2b695eb1985cd", - "reference": "8c2868641d0c4885eee9c12a89c2b695eb1985cd", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Filesystem\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Filesystem Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", - "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2017-11-07T14:45:01+00:00" - }, - { - "name": "symfony/http-foundation", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-foundation.git", - "reference": "aba96bd07be7796c81ca0ceafa7d48a6fef036c8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/aba96bd07be7796c81ca0ceafa7d48a6fef036c8", - "reference": "aba96bd07be7796c81ca0ceafa7d48a6fef036c8", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.1" - }, - "require-dev": { - "symfony/expression-language": "~3.4|~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpFoundation\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpFoundation Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/http-kernel", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/http-kernel.git", - "reference": "f2ea7461cdcad837b8bc6022b59d5eb8c9618aa5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f2ea7461cdcad837b8bc6022b59d5eb8c9618aa5", - "reference": "f2ea7461cdcad837b8bc6022b59d5eb8c9618aa5", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "psr/log": "~1.0", - "symfony/debug": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/http-foundation": "~3.4|~4.0" - }, - "conflict": { - "symfony/config": "<3.4", - "symfony/dependency-injection": "<3.4", - "symfony/var-dumper": "<3.4", - "twig/twig": "<1.34|<2.4,>=2" - }, - "provide": { - "psr/log-implementation": "1.0" - }, - "require-dev": { - "psr/cache": "~1.0", - "symfony/browser-kit": "~3.4|~4.0", - "symfony/config": "~3.4|~4.0", - "symfony/console": "~3.4|~4.0", - "symfony/css-selector": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/dom-crawler": "~3.4|~4.0", - "symfony/expression-language": "~3.4|~4.0", - "symfony/finder": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0", - "symfony/routing": "~3.4|~4.0", - "symfony/stopwatch": "~3.4|~4.0", - "symfony/templating": "~3.4|~4.0", - "symfony/translation": "~3.4|~4.0", - "symfony/var-dumper": "~3.4|~4.0" - }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "", - "symfony/var-dumper": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\HttpKernel\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony HttpKernel Component", - "homepage": "https://symfony.com", - "time": "2017-12-15T03:06:17+00:00" - }, - { - "name": "symfony/options-resolver", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/options-resolver.git", - "reference": "75fdda335eb0adbd464089e8a0184c61097808e0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/75fdda335eb0adbd464089e8a0184c61097808e0", - "reference": "75fdda335eb0adbd464089e8a0184c61097808e0", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\OptionsResolver\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony OptionsResolver Component", - "homepage": "https://symfony.com", - "keywords": [ - "config", - "configuration", - "options" - ], - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/polyfill-php70", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", - "reference": "0442b9c0596610bd24ae7b5f0a6cdbbc16d9fcff", - "shasum": "" - }, - "require": { - "paragonie/random_compat": "~1.0|~2.0", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php70\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "symfony/polyfill-php72", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/6de4f4884b97abbbed9f0a84a95ff2ff77254254", - "reference": "6de4f4884b97abbbed9f0a84a95ff2ff77254254", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", + "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-mbstring": "For best performance" + }, "type": "library", "extra": { "branch-alias": { @@ -3604,7 +2334,7 @@ }, "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" + "Symfony\\Polyfill\\Mbstring\\": "" }, "files": [ "bootstrap.php" @@ -3624,359 +2354,17 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", + "description": "Symfony polyfill for the Mbstring extension", "homepage": "https://symfony.com", "keywords": [ "compatibility", + "mbstring", "polyfill", "portable", "shim" ], "time": "2017-10-11T12:05:26+00:00" }, - { - "name": "symfony/process", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/process.git", - "reference": "18d1953068e72262830bad593f0366fa62c93fb7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/18d1953068e72262830bad593f0366fa62c93fb7", - "reference": "18d1953068e72262830bad593f0366fa62c93fb7", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Process\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Process Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/stopwatch", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/stopwatch.git", - "reference": "ac0e49150555c703fef6b696d8eaba1db7a3ca03" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/ac0e49150555c703fef6b696d8eaba1db7a3ca03", - "reference": "ac0e49150555c703fef6b696d8eaba1db7a3ca03", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Stopwatch\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Stopwatch Component", - "homepage": "https://symfony.com", - "time": "2017-11-09T12:45:29+00:00" - }, - { - "name": "symfony/yaml", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "a5ee52d155f06ad23b19eb63c31228ff56ad1116" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/a5ee52d155f06ad23b19eb63c31228ff56ad1116", - "reference": "a5ee52d155f06ad23b19eb63c31228ff56ad1116", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "conflict": { - "symfony/console": "<3.4" - }, - "require-dev": { - "symfony/console": "~3.4|~4.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Yaml\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "https://symfony.com", - "time": "2017-12-12T08:41:51+00:00" - }, - { - "name": "symplify/coding-standard", - "version": "v3.0.8", - "source": { - "type": "git", - "url": "https://github.com/Symplify/CodingStandard.git", - "reference": "9a8151cce1be35a66514006005ffbca605d80012" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Symplify/CodingStandard/zipball/9a8151cce1be35a66514006005ffbca605d80012", - "reference": "9a8151cce1be35a66514006005ffbca605d80012", - "shasum": "" - }, - "require": { - "friendsofphp/php-cs-fixer": "^2.9", - "nette/finder": "^2.4", - "nette/utils": "^2.4", - "php": "^7.1", - "squizlabs/php_codesniffer": "^3.2", - "symplify/token-runner": "^3.0" - }, - "require-dev": { - "nette/application": "^2.4", - "phpunit/phpunit": "^6.5", - "symplify/easy-coding-standard": "^3.0", - "symplify/package-builder": "^3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1-dev" - } - }, - "autoload": { - "psr-4": { - "Symplify\\CodingStandard\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Set of Symplify rules for PHP_CodeSniffer.", - "time": "2017-12-19T16:38:40+00:00" - }, - { - "name": "symplify/easy-coding-standard", - "version": "v3.0.8", - "source": { - "type": "git", - "url": "https://github.com/Symplify/EasyCodingStandard.git", - "reference": "f9813d1458213745814929b21d0fe8f728ac17a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Symplify/EasyCodingStandard/zipball/f9813d1458213745814929b21d0fe8f728ac17a1", - "reference": "f9813d1458213745814929b21d0fe8f728ac17a1", - "shasum": "" - }, - "require": { - "friendsofphp/php-cs-fixer": "^2.9", - "nette/caching": "^2.4|^3.0", - "nette/di": "^2.4|^3.0", - "nette/neon": "^2.4|^3.0", - "nette/robot-loader": "^2.4|^3.0.1", - "nette/utils": "^2.4|^3.0", - "php": "^7.1", - "slevomat/coding-standard": "^4.0", - "squizlabs/php_codesniffer": "^3.2", - "symfony/config": "^4.0", - "symfony/console": "^4.0", - "symfony/dependency-injection": "^4.0", - "symfony/finder": "^4.0", - "symfony/http-kernel": "^4.0", - "symfony/yaml": "^4.0", - "symplify/coding-standard": "^3.0", - "symplify/package-builder": "^3.0", - "symplify/token-runner": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.4" - }, - "bin": [ - "bin/easy-coding-standard", - "bin/ecs", - "bin/easy-coding-standard.php" - ], - "type": "library", - "autoload": { - "psr-4": { - "Symplify\\EasyCodingStandard\\": "src", - "Symplify\\EasyCodingStandard\\ChangedFilesDetector\\": "packages/ChangedFilesDetector/src", - "Symplify\\EasyCodingStandard\\Configuration\\": "packages/Configuration/src", - "Symplify\\EasyCodingStandard\\FixerRunner\\": "packages/FixerRunner/src", - "Symplify\\EasyCodingStandard\\SniffRunner\\": "packages/SniffRunner/src", - "Symplify\\EasyCodingStandard\\Performance\\": "packages/Performance/src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Use Coding Standard with 0-knowledge of PHP-CS-Fixer and PHP_CodeSniffer.", - "time": "2017-12-19T16:54:31+00:00" - }, - { - "name": "symplify/package-builder", - "version": "v3.0.8", - "source": { - "type": "git", - "url": "https://github.com/Symplify/PackageBuilder.git", - "reference": "f3a1c72d6c48812c8784475d625c54af5052f3bd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Symplify/PackageBuilder/zipball/f3a1c72d6c48812c8784475d625c54af5052f3bd", - "reference": "f3a1c72d6c48812c8784475d625c54af5052f3bd", - "shasum": "" - }, - "require": { - "nette/di": "^2.4|^3.0", - "nette/neon": "^2.4|^3.0", - "php": "^7.1", - "symfony/config": "^4.0", - "symfony/console": "^4.0", - "symfony/dependency-injection": "^4.0", - "symfony/finder": "^4.0", - "symfony/http-kernel": "^4.0", - "symfony/yaml": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.4", - "tracy/tracy": "^2.4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symplify\\PackageBuilder\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Dependency Injection, Console and Kernel toolkit for Symplify packages.", - "time": "2017-12-25T18:47:52+00:00" - }, - { - "name": "symplify/token-runner", - "version": "v3.0.8", - "source": { - "type": "git", - "url": "https://github.com/Symplify/TokenRunner.git", - "reference": "eeb21bce8ac048410dbbce69d584c74644ca6add" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Symplify/TokenRunner/zipball/eeb21bce8ac048410dbbce69d584c74644ca6add", - "reference": "eeb21bce8ac048410dbbce69d584c74644ca6add", - "shasum": "" - }, - "require": { - "friendsofphp/php-cs-fixer": "^2.9", - "nette/finder": "^2.4", - "nette/utils": "^2.4", - "php": "^7.1", - "phpdocumentor/reflection-docblock": "^4.2", - "squizlabs/php_codesniffer": "^3.2", - "symplify/package-builder": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5" - }, - "type": "library", - "autoload": { - "psr-4": { - "Symplify\\TokenRunner\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Set of utils for PHP_CodeSniffer and PHP CS Fixer.", - "time": "2017-12-25T20:32:49+00:00" - }, { "name": "theseer/tokenizer", "version": "1.1.0", From 2f482c78b0f77cfee33ded0862c9148b8429b7f1 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sun, 7 Jan 2018 08:50:54 -0600 Subject: [PATCH 031/126] add tests for bug #63; --- .../integration/InterpretingDocBlocksTest.php | 25 +++++++++++++++++++ tests/unit/DocBlockTest.php | 15 +++++++++++ 2 files changed, 40 insertions(+) diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index b2ec5ea0..6492eeab 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -33,6 +33,31 @@ public function tearDown(): void m::close(); } + public function testInterpretingSummaryWithEllipsis(): void + { + $docblock = <<create($docblock); + + $summary = 'This is a short (...) description.'; + $description = 'This is a long description.'; + + $this->assertInstanceOf(DocBlock::class, $phpdoc); + $this->assertSame($summary, $phpdoc->getSummary()); + $this->assertSame($description, $phpdoc->getDescription()->render()); + $this->assertCount(1, $phpdoc->getTags()); + $this->assertTrue($phpdoc->hasTag('return')); + } + public function testInterpretingASimpleDocBlock(): void { /** diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index 7374e6f7..d03fb0d2 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -48,6 +48,21 @@ public function testDocBlockCanHaveASummary(): void $this->assertSame($summary, $fixture->getSummary()); } + /** + * @covers ::__construct + * @covers ::getSummary + * + * @uses \phpDocumentor\Reflection\DocBlock\Description + */ + public function testDocBlockCanHaveEllipsisInSummary(): void + { + $summary = 'This is a short (...) description.'; + + $fixture = new DocBlock($summary); + + $this->assertSame($summary, $fixture->getSummary()); + } + /** * @covers ::__construct * @covers ::getDescription From fb948e8a524d9a096c8e480255a39b371f448ab1 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sun, 7 Jan 2018 08:51:10 -0600 Subject: [PATCH 032/126] regex fix for ellipsis in summary text; --- src/DocBlockFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index ca16bf65..67c147fe 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -166,7 +166,7 @@ private function splitDocBlock(string $comment) [^\n.]+ (?: (?! \. \n | \n{2} ) # End summary upon a dot followed by newline or two newlines - [\n.] (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line + [\n.]* (?! [ \t]* @\pL ) # End summary when an @ is found as first character on a new line [^\n.]+ # Include anything else )* \.? From 7bd0e7e4a1dcc565b703a4bfa07f4ad81cd89640 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sun, 7 Jan 2018 09:09:21 -0600 Subject: [PATCH 033/126] extra space --- tests/integration/InterpretingDocBlocksTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index 6492eeab..099e40a1 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -45,7 +45,7 @@ public function testInterpretingSummaryWithEllipsis(): void */ DOCBLOCK; - $factory = DocBlockFactory::createInstance(); + $factory = DocBlockFactory::createInstance(); $phpdoc = $factory->create($docblock); $summary = 'This is a short (...) description.'; From 17333cc0960c8e9f75428e17d81b08418e6c88f8 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Sun, 7 Jan 2018 09:19:13 -0600 Subject: [PATCH 034/126] update travis build; add appveyor --- .travis.yml | 55 +++++++++++++++++++++++++++++++++------------------- appveyor.yml | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 20 deletions(-) create mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml index 153880f9..b1fccf7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,6 @@ language: php - -php: - - 7.1 - - 7.2 +php: [7.1, 7.2, nightly ] +sudo: false matrix: include: @@ -11,26 +9,43 @@ matrix: - php: 7.1 env: PHPSTAN=true -cache: - directories: - - $HOME/.composer/cache +env: + global: + - VERSION=$(echo $TRAVIS_TAG | cut -c 2-10) install: - - composer install --no-interaction - - if [[ $ECS != "" ]]; then composer create-project symplify/easy-coding-standard temp/ecs; fi +- composer install --no-interaction --prefer-dist -o +- if [[ $ECS != "" ]]; then composer create-project symplify/easy-coding-standard temp/ecs; fi + +jobs: + include: + - stage: Test + script: + - vendor/bin/phpunit + - if [[ $ECS != "" ]]; then temp/ecs/bin/ecs check src tests; fi + - if [[ $PHPSTAN != "" ]]; then vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; fi + + - stage: Coverage + php: 7.1 + script: + - vendor/bin/phpunit + after_script: + - wget https://scrutinizer-ci.com/ocular.phar + - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; + - php coveralls.phar --verbose; -script: - - vendor/bin/phpunit --coverage-clover=coverage.xml -v - - if [[ $ECS != "" ]]; then temp/ecs/bin/ecs check src tests; fi - - if [[ $PHPSTAN != "" ]]; then vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; fi + allow_failures: + - php: nightly -after_script: - - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; - - php coveralls.phar --verbose; +cache: + directories: + - $HOME/.composer/cache/files notifications: - irc: "irc.freenode.org#phpdocumentor" + irc: irc.freenode.org#phpdocumentor + slack: + secure: fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg= email: - - mike.vanriel@naenius.com - - ashnazg@php.net - - boen.robot@gmail.com + - me@mikevanriel.com + - ashnazg@php.net diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..83f4468f --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,54 @@ +build: false +clone_folder: c:\reflectiondocblock +max_jobs: 3 +platform: x86 +pull_requests: + do_not_increment_build_number: true +version: '{build}.{branch}' +skip_tags: true +branches: + only: + - master + +environment: + matrix: + - PHP_VERSION: '7.1.13' + VC_VERSION: 'VC14' + - PHP_VERSION: '7.2.1' + VC_VERSION: 'VC15' +matrix: + fast_finish: false + +cache: + - c:\php -> appveyor.yml + - '%LOCALAPPDATA%\Composer\files' + +init: + - SET PATH=c:\php\%PHP_VERSION%;%PATH% + +install: + - IF NOT EXIST c:\php mkdir c:\php + - IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION% + - cd c:\php\%PHP_VERSION% + - IF NOT EXIST php-installed.txt appveyor DownloadFile http://windows.php.net/downloads/releases/php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip + - IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip -y >nul + - IF NOT EXIST php-installed.txt del /Q *.zip + - IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini + - IF NOT EXIST php-installed.txt echo max_execution_time=1200 >> php.ini + - IF NOT EXIST php-installed.txt echo date.timezone="UTC" >> php.ini + - IF NOT EXIST php-installed.txt echo extension_dir=ext >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_curl.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_openssl.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_mbstring.dll >> php.ini + - IF NOT EXIST php-installed.txt echo extension=php_fileinfo.dll >> php.ini + - IF NOT EXIST php-installed.txt echo zend.assertions=1 >> php.ini + - IF NOT EXIST php-installed.txt echo assert.exception=On >> php.ini + - IF NOT EXIST php-installed.txt appveyor DownloadFile https://getcomposer.org/composer.phar + - IF NOT EXIST php-installed.txt echo @php %%~dp0composer.phar %%* > composer.bat + - IF NOT EXIST php-installed.txt type nul >> php-installed.txt + - cd c:\reflectiondocblock + - composer install --no-interaction --prefer-dist --no-progress + +test_script: + - cd c:\reflectiondocblock + - vendor/bin/phpunit From 355187b692ee5b174d917f7c5a759b6c790a5777 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 07:06:44 -0600 Subject: [PATCH 035/126] move ECS & phpstan into a stage --- .travis.yml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index b1fccf7b..ef6266bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,28 +2,27 @@ language: php php: [7.1, 7.2, nightly ] sudo: false -matrix: - include: - - php: 7.1 - env: ECS=true - - php: 7.1 - env: PHPSTAN=true - env: global: - VERSION=$(echo $TRAVIS_TAG | cut -c 2-10) install: - composer install --no-interaction --prefer-dist -o -- if [[ $ECS != "" ]]; then composer create-project symplify/easy-coding-standard temp/ecs; fi jobs: include: - stage: Test script: - vendor/bin/phpunit - - if [[ $ECS != "" ]]; then temp/ecs/bin/ecs check src tests; fi - - if [[ $PHPSTAN != "" ]]; then vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; fi + + - stage: lint + php: 7.1 + script: vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; + + - stage lint + php: 7.1 + script: temp/ecs/bin/ecs check src tests; + before_script: composer create-project symplify/easy-coding-standard temp/ecs; - stage: Coverage php: 7.1 From 09489084f8785d26fcc07dd691c7e8c6869f7742 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 07:09:15 -0600 Subject: [PATCH 036/126] target php not allowed in lint stage? --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef6266bb..3ba7dfe6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,11 +16,9 @@ jobs: - vendor/bin/phpunit - stage: lint - php: 7.1 script: vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; - stage lint - php: 7.1 script: temp/ecs/bin/ecs check src tests; before_script: composer create-project symplify/easy-coding-standard temp/ecs; From da5670bae5e03e66b5ee0970e33992448079d302 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 07:14:21 -0600 Subject: [PATCH 037/126] missing colon --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3ba7dfe6..9f504c7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,7 +18,7 @@ jobs: - stage: lint script: vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; - - stage lint + - stage: lint script: temp/ecs/bin/ecs check src tests; before_script: composer create-project symplify/easy-coding-standard temp/ecs; From 751934cd9a7d09d9b42edb8f322149a4ebd5a6ff Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 12:09:54 -0600 Subject: [PATCH 038/126] expand gitignore --- .gitignore | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c368807d..7db1e886 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,16 @@ +# IDE Shizzle; it is recommended to use a global .gitignore for this but since this is an OSS project we want to make +# it easy to contribute .idea -vendor -/build -/temp +/nbproject/private/ +.buildpath +.project +.settings + +# Build folder and vendor folder are generated code; no need to version this +build/* +temp/* +vendor/* +composer.phar + +# By default the phpunit.xml.dist is provided; you can override this using a local config file +phpunit.xml From bd3b8fe05a15b31ef2ccc680ba95cd80a48ab7cd Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 13:08:32 -0600 Subject: [PATCH 039/126] add badges --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 71227480..b07c97eb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -The ReflectionDocBlock Component [![Build Status](https://secure.travis-ci.org/phpDocumentor/ReflectionDocBlock.png)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) +[![Travis Status](https://travis-ci.org/phpDocumentor/ReflectionDocBlock.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) +[![Appveyor Status](https://ci.appveyor.com/api/projects/status/03a9euxrcse7orgu/branch/master?svg=true)](https://ci.appveyor.com/project/phpDocumentor/reflectiondocblock/branch/master) +[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) +[![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) + + +The ReflectionDocBlock Component ================================ Introduction From 1d7fe61bc1649e38290ae7eefc62769496b6a20d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:32:38 -0600 Subject: [PATCH 040/126] travis docs imply quotes necessary are here --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9f504c7a..2c4ab059 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,9 +40,9 @@ cache: - $HOME/.composer/cache/files notifications: - irc: irc.freenode.org#phpdocumentor + irc: "irc.freenode.org#phpdocumentor" slack: - secure: fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg= + secure: "fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg=" email: - me@mikevanriel.com - ashnazg@php.net From 66e1fd3837d97b977fc3423c82ef8b50e7e0d2ca Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:34:10 -0600 Subject: [PATCH 041/126] unstaged scripts default to 'test' stage; --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2c4ab059..b1659378 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,11 +9,11 @@ env: install: - composer install --no-interaction --prefer-dist -o +script: + - vendor/bin/phpunit + jobs: include: - - stage: Test - script: - - vendor/bin/phpunit - stage: lint script: vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; From cda86e1f1758f88677002aeb7023a7f998cd27c2 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:34:47 -0600 Subject: [PATCH 042/126] VERSION not needed in this package build --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index b1659378..3c2cbd79 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ php: [7.1, 7.2, nightly ] sudo: false env: - global: - - VERSION=$(echo $TRAVIS_TAG | cut -c 2-10) install: - composer install --no-interaction --prefer-dist -o From f845cf656713851a6dfcad98dd798a67b0489ff6 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:35:36 -0600 Subject: [PATCH 043/126] put lint stages together --- .travis.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3c2cbd79..fad68343 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,13 +12,13 @@ script: jobs: include: - - - stage: lint - script: vendor/bin/phpstan analyse src --level max --configuration phpstan.neon; - - stage: lint - script: temp/ecs/bin/ecs check src tests; - before_script: composer create-project symplify/easy-coding-standard temp/ecs; + php: 7.1 + before_script: + - composer create-project symplify/easy-coding-standard temp/ecs + script: + - temp/ecs/bin/ecs check src tests + - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon - stage: Coverage php: 7.1 From a7d3aca8683ea2a6d40858e7cc56aa2efea2fc51 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:36:22 -0600 Subject: [PATCH 044/126] use matrix for allow_failures; add fast_finish; --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index fad68343..2d683e03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,10 @@ php: [7.1, 7.2, nightly ] sudo: false env: +matrix: + fast_finish: true + allow_failures: + - php: nightly install: - composer install --no-interaction --prefer-dist -o @@ -30,8 +34,6 @@ jobs: - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; - php coveralls.phar --verbose; - allow_failures: - - php: nightly cache: directories: From 41266d5ef50ad1e29e835a4ff01423ee36d26fe7 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:36:40 -0600 Subject: [PATCH 045/126] add coveralls --- .travis.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d683e03..4ec73e00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,9 +31,8 @@ jobs: after_script: - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar; - - php coveralls.phar --verbose; - + - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar + - php coveralls.phar --verbose cache: directories: From 43f7d784e710c802c6e824e4bb0c3b9805bc08c7 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 14:37:09 -0600 Subject: [PATCH 046/126] use php section layout from travis docs; --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4ec73e00..3b1b4b86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: php -php: [7.1, 7.2, nightly ] +php: + - 7.1 + - 7.2 + - nightly sudo: false env: @@ -9,7 +12,7 @@ matrix: - php: nightly install: -- composer install --no-interaction --prefer-dist -o + - composer install --no-interaction --prefer-dist --optimize-autoloader script: - vendor/bin/phpunit From 74a79e1014d3178af765aa2050ee79d8a1df9b5b Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 15:02:42 -0600 Subject: [PATCH 047/126] add coveralls --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b07c97eb..3799df5e 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ [![Travis Status](https://travis-ci.org/phpDocumentor/ReflectionDocBlock.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) [![Appveyor Status](https://ci.appveyor.com/api/projects/status/03a9euxrcse7orgu/branch/master?svg=true)](https://ci.appveyor.com/project/phpDocumentor/reflectiondocblock/branch/master) -[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) +[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) +[![Coverage Status](https://coveralls.io/repos/github/phpDocumentor/ReflectionDocBlock/badge.svg?branch=master)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) The ReflectionDocBlock Component From 99338f3687fd08a978df7e28b6612a9f4372337e Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 15:12:29 -0600 Subject: [PATCH 048/126] no coverage needed in test stage --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3b1b4b86..122eb09a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ install: - composer install --no-interaction --prefer-dist --optimize-autoloader script: - - vendor/bin/phpunit + - vendor/bin/phpunit --no-coverage jobs: include: From 09f8c7c6b6331e1f88fdec73f751ad793946c154 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 15:23:40 -0600 Subject: [PATCH 049/126] try disabling xdebug for test stage only --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 122eb09a..32607a7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,9 +11,9 @@ matrix: allow_failures: - php: nightly -install: +before_script: + - phpenv config-rm xdebug.ini - composer install --no-interaction --prefer-dist --optimize-autoloader - script: - vendor/bin/phpunit --no-coverage From c4fcd7458405f2a3a2d999f9a2c3d3204e2921e3 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 16:14:16 -0600 Subject: [PATCH 050/126] add more badges --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 3799df5e..028ab3ab 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Travis Status](https://travis-ci.org/phpDocumentor/ReflectionDocBlock.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) [![Appveyor Status](https://ci.appveyor.com/api/projects/status/03a9euxrcse7orgu/branch/master?svg=true)](https://ci.appveyor.com/project/phpDocumentor/reflectiondocblock/branch/master) [![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Coverage Status](https://coveralls.io/repos/github/phpDocumentor/ReflectionDocBlock/badge.svg?branch=master)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) +[![PHPStan](https://img.shieldss.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) The ReflectionDocBlock Component From 15a808b6a820bd54ab933f96b193160019bc65e8 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 16:28:20 -0600 Subject: [PATCH 051/126] xdebug removal proves complicated --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 32607a7f..e8805f94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,6 @@ matrix: - php: nightly before_script: - - phpenv config-rm xdebug.ini - composer install --no-interaction --prefer-dist --optimize-autoloader script: - vendor/bin/phpunit --no-coverage From fe337a20d66adf34e9fa562767c2cc29857d4a2d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 17:01:56 -0600 Subject: [PATCH 052/126] some steps belong together --- .travis.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8805f94..728f1217 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,10 +31,8 @@ jobs: script: - vendor/bin/phpunit after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar - - php coveralls.phar --verbose + - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && php coveralls.phar --verbose cache: directories: From 90a60e6406f4a08bdde35aa9e3048855e470df40 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 17:03:21 -0600 Subject: [PATCH 053/126] put test stage back together --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 728f1217..ec1391a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,11 +13,13 @@ matrix: before_script: - composer install --no-interaction --prefer-dist --optimize-autoloader -script: - - vendor/bin/phpunit --no-coverage jobs: include: + - stage: test + script: + - vendor/bin/phpunit --no-coverage + - stage: lint php: 7.1 before_script: From ff49ab6be78054616d74c67dd3fba86d474d0ceb Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 8 Jan 2018 17:03:37 -0600 Subject: [PATCH 054/126] see if install makes it persist into stages --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ec1391a0..0f5bd614 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,12 +6,13 @@ php: sudo: false env: + matrix: fast_finish: true allow_failures: - php: nightly -before_script: +install: - composer install --no-interaction --prefer-dist --optimize-autoloader jobs: From e6fb1cbc9bb737746272e0175cb42ea51921e0df Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 9 Jan 2018 12:25:08 -0600 Subject: [PATCH 055/126] add scrunitizer --- .scrutinizer.yml | 43 +++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 2 +- phpmd.xml.dist | 23 +++++++++++++++++++++++ 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 .scrutinizer.yml create mode 100644 phpmd.xml.dist diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000..8b22db87 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,43 @@ +before_commands: + - "composer install --no-dev --prefer-source" + +tools: + external_code_coverage: + enabled: true + timeout: 300 + filter: + excluded_paths: ["examples", "tests", "vendor"] + php_code_sniffer: + enabled: true + config: + standard: PSR2 + filter: + paths: ["src/*", "tests/*"] + excluded_paths: [] + php_cpd: + enabled: true + excluded_dirs: ["examples", "tests", "vendor"] + php_cs_fixer: + enabled: true + config: + level: all + filter: + paths: ["src/*", "tests/*"] + php_loc: + enabled: true + excluded_dirs: ["examples", "tests", "vendor"] + php_mess_detector: + enabled: true + config: + ruleset: phpmd.xml.dist + design_rules: { eval_expression: false } + filter: + paths: ["src/*"] + php_pdepend: + enabled: true + excluded_dirs: ["examples", "tests", "vendor"] + php_analyzer: + enabled: true + filter: + paths: ["src/*", "tests/*"] + sensiolabs_security_checker: true diff --git a/.travis.yml b/.travis.yml index 0f5bd614..1bfa78d1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ jobs: - temp/ecs/bin/ecs check src tests - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon - - stage: Coverage + - stage: coverage php: 7.1 script: - vendor/bin/phpunit diff --git a/phpmd.xml.dist b/phpmd.xml.dist new file mode 100644 index 00000000..9abf85cf --- /dev/null +++ b/phpmd.xml.dist @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + 40 + + + From 4f81271c85115e9b0d0ebbc121844e514a7104d5 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 9 Jan 2018 12:58:19 -0600 Subject: [PATCH 056/126] run coverage before lint --- .travis.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1bfa78d1..269ffd05 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,14 +21,6 @@ jobs: script: - vendor/bin/phpunit --no-coverage - - stage: lint - php: 7.1 - before_script: - - composer create-project symplify/easy-coding-standard temp/ecs - script: - - temp/ecs/bin/ecs check src tests - - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon - - stage: coverage php: 7.1 script: @@ -37,6 +29,14 @@ jobs: - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && php coveralls.phar --verbose + - stage: lint + php: 7.1 + before_script: + - composer create-project symplify/easy-coding-standard temp/ecs + script: + - temp/ecs/bin/ecs check src tests + - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon + cache: directories: - $HOME/.composer/cache/files From 264e58724ea35dfb848cf5ab73abd30134770d7b Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 9 Jan 2018 14:20:11 -0600 Subject: [PATCH 057/126] url typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 028ab3ab..746816f4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Coverage Status](https://coveralls.io/repos/github/phpDocumentor/ReflectionDocBlock/badge.svg?branch=master)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) -[![PHPStan](https://img.shieldss.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) +[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) The ReflectionDocBlock Component From 36c15f4a8382d79afecb2948c762c6240d0c0fae Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:18:12 -0600 Subject: [PATCH 058/126] use shields for badges --- README.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 746816f4..35d1a1a8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Travis Status](https://travis-ci.org/phpDocumentor/ReflectionDocBlock.svg?branch=master)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) -[![Appveyor Status](https://ci.appveyor.com/api/projects/status/03a9euxrcse7orgu/branch/master?svg=true)](https://ci.appveyor.com/project/phpDocumentor/reflectiondocblock/branch/master) -[![Code Quality](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) -[![Code Coverage](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) -[![Coverage Status](https://coveralls.io/repos/github/phpDocumentor/ReflectionDocBlock/badge.svg?branch=master)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) -[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan) +[![Travis Status](https://img.shields.io/travis/phpDocumentor/ReflectionDocBlock.svg?label=Linux)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) +[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/ReflectionDocBlock.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/ReflectionDocBlock/branch/master) +[![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/ReflectionDocBlock.svg)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) +[![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) +[![Stable Version](https://img.shields.io/packagist/v/phpDocumentor/ReflectionDocBlock.svg)](https://packagist.org/packages/phpDocumentor/ReflectionDocBlock) +[![Unstable Version](https://img.shields.io/packagist/vpre/phpDocumentor/ReflectionDocBlock.svg)](https://packagist.org/packages/phpDocumentor/ReflectionDocBlock) -The ReflectionDocBlock Component -================================ +ReflectionDocBlock +================== Introduction ------------ From 14416207a8becb08359c163dbd552da6975a0ff0 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:18:31 -0600 Subject: [PATCH 059/126] don't analyze phpstan --- .scrutinizer.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 8b22db87..4c5f9511 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,6 +1,11 @@ before_commands: - "composer install --no-dev --prefer-source" +checks: + php: + excluded_dependencies: + - phpstan/phpstan + tools: external_code_coverage: enabled: true From 4a1e4dec73a9915ef21b8fc19dca132937d814bb Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:18:38 -0600 Subject: [PATCH 060/126] no coverage for phpunit here --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 83f4468f..c2a1a5d4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,4 +51,4 @@ install: test_script: - cd c:\reflectiondocblock - - vendor/bin/phpunit + - vendor/bin/phpunit --no-coverage From 168df99062151026b31fdfdf8ced898d6a885ba1 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Mon, 29 Jan 2018 20:58:22 +0100 Subject: [PATCH 061/126] Use package name in link to packagist --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 35d1a1a8..265da362 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,8 @@ [![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/ReflectionDocBlock.svg)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) [![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) -[![Stable Version](https://img.shields.io/packagist/v/phpDocumentor/ReflectionDocBlock.svg)](https://packagist.org/packages/phpDocumentor/ReflectionDocBlock) -[![Unstable Version](https://img.shields.io/packagist/vpre/phpDocumentor/ReflectionDocBlock.svg)](https://packagist.org/packages/phpDocumentor/ReflectionDocBlock) - +[![Stable Version](https://img.shields.io/packagist/v/phpdocumentor/reflection-docblock.svg)](https://packagist.org/packages/phpdocumentor/reflection-docblock) +[![Unstable Version](https://img.shields.io/packagist/vpre/phpdocumentor/reflection-docblock.svg)](https://packagist.org/packages/phpdocumentor/reflection-docblock) ReflectionDocBlock ================== From 8323f1a50a5fcf3b8c3a10ae36f8d2a6b064c6c8 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 11 Jan 2018 07:19:06 -0600 Subject: [PATCH 062/126] no need for converalls cfg --- .coveralls.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .coveralls.yml diff --git a/.coveralls.yml b/.coveralls.yml deleted file mode 100644 index c512a3d5..00000000 --- a/.coveralls.yml +++ /dev/null @@ -1,3 +0,0 @@ -service_name: travis-ci -coverage_clover: coverage.xml -json_path: coverage.json From 746bf9762b543c596481f2b65c9d3cd748c9af0a Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 15 Jan 2018 13:25:15 -0600 Subject: [PATCH 063/126] use phive and phars for tools --- .gitignore | 9 +- .travis.yml | 29 +- composer.json | 7 +- composer.lock | 2085 +------------------------------------------------ phive.xml | 5 + 5 files changed, 28 insertions(+), 2107 deletions(-) create mode 100644 phive.xml diff --git a/.gitignore b/.gitignore index 7db1e886..4a0e4355 100644 --- a/.gitignore +++ b/.gitignore @@ -7,10 +7,11 @@ .settings # Build folder and vendor folder are generated code; no need to version this -build/* -temp/* -vendor/* -composer.phar +build/ +temp/ +tools/ +vendor/ +*.phar # By default the phpunit.xml.dist is provided; you can override this using a local config file phpunit.xml diff --git a/.travis.yml b/.travis.yml index 269ffd05..a6871e3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,5 @@ language: php -php: - - 7.1 - - 7.2 - - nightly +php: [ 7.1, 7.2, nightly ] sudo: false env: @@ -13,33 +10,35 @@ matrix: - php: nightly install: - - composer install --no-interaction --prefer-dist --optimize-autoloader + - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader + - travis_retry wget https://phar.io/releases/phive.phar + - travis_retry composer require --dev phpunit/phpunit # cannot trust phpunit.phar, because this package is itself in that phar..." + +script: + - ./vendor/bin/phpunit --no-coverage jobs: include: - - stage: test - script: - - vendor/bin/phpunit --no-coverage - - stage: coverage php: 7.1 script: - - vendor/bin/phpunit + - ./vendor/bin/phpunit after_script: - - wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar && php coveralls.phar --verbose + - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose + - travis_retry wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - stage: lint php: 7.1 before_script: - - composer create-project symplify/easy-coding-standard temp/ecs + - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan script: - - temp/ecs/bin/ecs check src tests - - vendor/bin/phpstan analyse src --level max --configuration phpstan.neon + - ./tools/phpstan analyse src --level max --configuration phpstan.neon + - composer create-project symplify/easy-coding-standard temp/ecs && temp/ecs/bin/ecs check src tests cache: directories: - $HOME/.composer/cache/files + - $HOME/.phive notifications: irc: "irc.freenode.org#phpdocumentor" diff --git a/composer.json b/composer.json index 57a6e286..e51f9fbd 100644 --- a/composer.json +++ b/composer.json @@ -10,16 +10,13 @@ } ], "require": { - "php": "^7.1", - "phpdocumentor/reflection-common": "^1.0", + "php": ">=7.1", "phpdocumentor/type-resolver": "^0.5", "webmozart/assert": "^1.0" }, "require-dev": { "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4", - "doctrine/instantiator": "^1.0", - "phpstan/phpstan": "^0.9.0" + "doctrine/instantiator": "^1.0" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ce59c7be..591a0d65 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "ddbc2e7fc547b4ff06199c20ee406c72", + "content-hash": "4da4bf855fcd911619ef36a909ba6579", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -259,49 +259,6 @@ ], "time": "2016-01-20T08:20:44+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", - "reference": "3c8487fdd6c750ff3f10c32ddfdd2a7803c1d461", - "shasum": "" - }, - "require": { - "ocramius/package-versions": "^1.2.0", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A wrapper for ocramius/pretty-package-versions to get pretty versions strings", - "keywords": [ - "package versions" - ], - "time": "2017-11-30T22:02:29+00:00" - }, { "name": "mockery/mockery", "version": "1.0", @@ -366,2044 +323,6 @@ "testing" ], "time": "2017-10-06T16:20:43+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.7.0", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^4.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2017-10-19T19:58:43+00:00" - }, - { - "name": "nette/bootstrap", - "version": "v2.4.5", - "source": { - "type": "git", - "url": "https://github.com/nette/bootstrap.git", - "reference": "804925787764d708a7782ea0d9382a310bb21968" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/bootstrap/zipball/804925787764d708a7782ea0d9382a310bb21968", - "reference": "804925787764d708a7782ea0d9382a310bb21968", - "shasum": "" - }, - "require": { - "nette/di": "~2.4.7", - "nette/utils": "~2.4", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "latte/latte": "~2.2", - "nette/application": "~2.3", - "nette/caching": "~2.3", - "nette/database": "~2.3", - "nette/forms": "~2.3", - "nette/http": "~2.4.0", - "nette/mail": "~2.3", - "nette/robot-loader": "^2.4.2 || ^3.0", - "nette/safe-stream": "~2.2", - "nette/security": "~2.3", - "nette/tester": "~2.0", - "tracy/tracy": "^2.4.1" - }, - "suggest": { - "nette/robot-loader": "to use Configurator::createRobotLoader()", - "tracy/tracy": "to use Configurator::enableTracy()" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🅱 Nette Bootstrap: the simple way to configure and bootstrap your Nette application.", - "homepage": "https://nette.org", - "keywords": [ - "bootstrapping", - "configurator", - "nette" - ], - "time": "2017-08-20T17:36:59+00:00" - }, - { - "name": "nette/di", - "version": "v2.4.10", - "source": { - "type": "git", - "url": "https://github.com/nette/di.git", - "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/di/zipball/a4b3be935b755f23aebea1ce33d7e3c832cdff98", - "reference": "a4b3be935b755f23aebea1ce33d7e3c832cdff98", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/neon": "^2.3.3 || ~3.0.0", - "nette/php-generator": "^2.6.1 || ~3.0.0", - "nette/utils": "^2.4.3 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/bootstrap": "<2.4", - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "💎 Nette Dependency Injection Container: Flexible, compiled and full-featured DIC with perfectly usable autowiring and support for all new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "compiled", - "di", - "dic", - "factory", - "ioc", - "nette", - "static" - ], - "time": "2017-08-31T22:42:00+00:00" - }, - { - "name": "nette/finder", - "version": "v2.4.1", - "source": { - "type": "git", - "url": "https://github.com/nette/finder.git", - "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/finder/zipball/4d43a66d072c57d585bf08a3ef68d3587f7e9547", - "reference": "4d43a66d072c57d585bf08a3ef68d3587f7e9547", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4 || ~3.0.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "Nette Finder: Files Searching", - "homepage": "https://nette.org", - "time": "2017-07-10T23:47:08+00:00" - }, - { - "name": "nette/neon", - "version": "v2.4.2", - "source": { - "type": "git", - "url": "https://github.com/nette/neon.git", - "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/neon/zipball/9eacd50553b26b53a3977bfb2fea2166d4331622", - "reference": "9eacd50553b26b53a3977bfb2fea2166d4331622", - "shasum": "" - }, - "require": { - "ext-iconv": "*", - "ext-json": "*", - "php": ">=5.6.0" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "Nette NEON: parser & generator for Nette Object Notation", - "homepage": "http://ne-on.org", - "time": "2017-07-11T18:29:08+00:00" - }, - { - "name": "nette/php-generator", - "version": "v3.0.1", - "source": { - "type": "git", - "url": "https://github.com/nette/php-generator.git", - "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/php-generator/zipball/eb2dbc9c3409e9db40568109ca4994d51373b60c", - "reference": "eb2dbc9c3409e9db40568109ca4994d51373b60c", - "shasum": "" - }, - "require": { - "nette/utils": "^2.4.2 || ~3.0.0", - "php": ">=7.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 7.1 features.", - "homepage": "https://nette.org", - "keywords": [ - "code", - "nette", - "php", - "scaffolding" - ], - "time": "2017-07-11T19:07:13+00:00" - }, - { - "name": "nette/robot-loader", - "version": "v3.0.2", - "source": { - "type": "git", - "url": "https://github.com/nette/robot-loader.git", - "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/robot-loader/zipball/b703b4f5955831b0bcaacbd2f6af76021b056826", - "reference": "b703b4f5955831b0bcaacbd2f6af76021b056826", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "nette/finder": "^2.3 || ^3.0", - "nette/utils": "^2.4 || ^3.0", - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "^2.0", - "tracy/tracy": "^2.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.", - "homepage": "https://nette.org", - "keywords": [ - "autoload", - "class", - "interface", - "nette", - "trait" - ], - "time": "2017-07-18T00:09:56+00:00" - }, - { - "name": "nette/utils", - "version": "v2.4.8", - "source": { - "type": "git", - "url": "https://github.com/nette/utils.git", - "reference": "f1584033b5af945b470533b466b81a789d532034" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/f1584033b5af945b470533b466b81a789d532034", - "reference": "f1584033b5af945b470533b466b81a789d532034", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "conflict": { - "nette/nette": "<2.2" - }, - "require-dev": { - "nette/tester": "~2.0", - "tracy/tracy": "^2.3" - }, - "suggest": { - "ext-gd": "to use Image", - "ext-iconv": "to use Strings::webalize() and toAscii()", - "ext-intl": "for script transliteration in Strings::webalize() and toAscii()", - "ext-json": "to use Nette\\Utils\\Json", - "ext-mbstring": "to use Strings::lower() etc...", - "ext-xml": "to use Strings::length() etc. when mbstring is not available" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.4-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause", - "GPL-2.0", - "GPL-3.0" - ], - "authors": [ - { - "name": "David Grudl", - "homepage": "https://davidgrudl.com" - }, - { - "name": "Nette Community", - "homepage": "https://nette.org/contributors" - } - ], - "description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.", - "homepage": "https://nette.org", - "keywords": [ - "array", - "core", - "datetime", - "images", - "json", - "nette", - "paginator", - "password", - "slugify", - "string", - "unicode", - "utf-8", - "utility", - "validation" - ], - "time": "2017-08-20T17:32:29+00:00" - }, - { - "name": "nikic/php-parser", - "version": "v3.1.3", - "source": { - "type": "git", - "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/579f4ce846734a1cf55d6a531d00ca07a43e3cda", - "reference": "579f4ce846734a1cf55d6a531d00ca07a43e3cda", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "~4.0|~5.0" - }, - "bin": [ - "bin/php-parse" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "PhpParser\\": "lib/PhpParser" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Nikita Popov" - } - ], - "description": "A PHP parser written in PHP", - "keywords": [ - "parser", - "php" - ], - "time": "2017-12-26T14:43:21+00:00" - }, - { - "name": "ocramius/package-versions", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/Ocramius/PackageVersions.git", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/ad8a245decad4897cc6b432743913dad0d69753c", - "reference": "ad8a245decad4897cc6b432743913dad0d69753c", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": "~7.0" - }, - "require-dev": { - "composer/composer": "^1.3", - "ext-zip": "*", - "humbug/humbug": "dev-master", - "phpunit/phpunit": "^6.4" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "PackageVersions\\": "src/PackageVersions" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" - } - ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", - "time": "2017-11-24T11:07:03+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", - "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^1.0.1", - "php": "^5.6 || ^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2017-03-05T18:14:27+00:00" - }, - { - "name": "phar-io/version", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", - "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2017-03-05T17:38:23+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.7.3", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", - "reference": "e4ed002c67da8eceb0eb8ddb8b3847bb53c5c2bf", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2017-11-24T13:59:53+00:00" - }, - { - "name": "phpstan/phpdoc-parser", - "version": "0.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/08d714b2f0bc0a2bf9407255d5bb634669b7065c", - "reference": "08d714b2f0bc0a2bf9407255d5bb634669b7065c", - "shasum": "" - }, - "require": { - "php": "~7.0" - }, - "require-dev": { - "consistence/coding-standard": "^2.0.0", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan": "^0.9", - "phpunit/phpunit": "^6.3", - "slevomat/coding-standard": "^3.3.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "PHPStan\\PhpDocParser\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPDoc parser with support for nullable, intersection and generic types", - "time": "2017-11-22T10:46:07+00:00" - }, - { - "name": "phpstan/phpstan", - "version": "0.9.1", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan.git", - "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ef60e5cc0a32ddb2637523dafef966e0aac1e16f", - "reference": "ef60e5cc0a32ddb2637523dafef966e0aac1e16f", - "shasum": "" - }, - "require": { - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^3.1", - "php": "~7.0", - "phpstan/phpdoc-parser": "^0.1", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" - }, - "require-dev": { - "consistence/coding-standard": "2.2.1", - "jakub-onderka/php-parallel-lint": "^0.9.2", - "phing/phing": "^2.16.0", - "phpstan/phpstan-php-parser": "^0.9", - "phpstan/phpstan-phpunit": "^0.9", - "phpstan/phpstan-strict-rules": "^0.9", - "phpunit/phpunit": "^6.5.2", - "slevomat/coding-standard": "4.0.0" - }, - "bin": [ - "bin/phpstan" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.9-dev" - } - }, - "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/", - "build/PHPStan" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan - PHP Static Analysis Tool", - "time": "2017-12-02T19:34:06+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "5.3.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/661f34d0bd3f1a7225ef491a70a020ad23a057a1", - "reference": "661f34d0bd3f1a7225ef491a70a020ad23a057a1", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.0", - "phpunit/php-file-iterator": "^1.4.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^2.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^3.0", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-xdebug": "^2.5.5" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.3.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2017-12-06T09:29:45+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.4.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", - "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.4.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2017-11-27T13:52:08+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.9", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2017-02-26T11:10:40+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "791198a2c6254db10131eecfe8c06670700904db" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/791198a2c6254db10131eecfe8c06670700904db", - "reference": "791198a2c6254db10131eecfe8c06670700904db", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2017-11-27T05:48:46+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "6.5.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "83d27937a310f2984fd575686138597147bdc7df" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83d27937a310f2984fd575686138597147bdc7df", - "reference": "83d27937a310f2984fd575686138597147bdc7df", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "myclabs/deep-copy": "^1.6.1", - "phar-io/manifest": "^1.0.1", - "phar-io/version": "^1.0", - "php": "^7.0", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^5.3", - "phpunit/php-file-iterator": "^1.4.3", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^1.0.9", - "phpunit/phpunit-mock-objects": "^5.0.5", - "sebastian/comparator": "^2.1", - "sebastian/diff": "^2.0", - "sebastian/environment": "^3.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^2.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^1.0", - "sebastian/version": "^2.0.1" - }, - "conflict": { - "phpdocumentor/reflection-docblock": "3.0.2", - "phpunit/dbunit": "<3.0" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-xdebug": "*", - "phpunit/php-invoker": "^1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "6.5.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2017-12-17T06:31:19+00:00" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "5.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "283b9f4f670e3a6fd6c4ff95c51a952eb5c75933" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/283b9f4f670e3a6fd6c4ff95c51a952eb5c75933", - "reference": "283b9f4f670e3a6fd6c4ff95c51a952eb5c75933", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.5", - "php": "^7.0", - "phpunit/php-text-template": "^1.2.1", - "sebastian/exporter": "^3.1" - }, - "conflict": { - "phpunit/phpunit": "<6.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.5" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "5.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2017-12-10T08:01:53+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "2.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/b11c729f95109b56a0fe9650c6a63a0fcd8c439f", - "reference": "b11c729f95109b56a0fe9650c6a63a0fcd8c439f", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/diff": "^2.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2017-12-22T14:50:35+00:00" - }, - { - "name": "sebastian/diff", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "reference": "347c1d8b49c5c3ee30c7040ea6fc446790e6bddd", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2017-08-03T08:09:46+00:00" - }, - { - "name": "sebastian/environment", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2017-07-01T08:51:00+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "2.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2017-04-27T15:39:26+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "1.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", - "shasum": "" - }, - "require": { - "php": ">=5.6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2015-07-28T20:34:47+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "symfony/console", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "de8cf039eacdec59d83f7def67e3b8ff5ed46714" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/de8cf039eacdec59d83f7def67e3b8ff5ed46714", - "reference": "de8cf039eacdec59d83f7def67e3b8ff5ed46714", - "shasum": "" - }, - "require": { - "php": "^7.1.3", - "symfony/polyfill-mbstring": "~1.0" - }, - "conflict": { - "symfony/dependency-injection": "<3.4", - "symfony/process": "<3.3" - }, - "require-dev": { - "psr/log": "~1.0", - "symfony/config": "~3.4|~4.0", - "symfony/dependency-injection": "~3.4|~4.0", - "symfony/event-dispatcher": "~3.4|~4.0", - "symfony/lock": "~3.4|~4.0", - "symfony/process": "~3.4|~4.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Console\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Console Component", - "homepage": "https://symfony.com", - "time": "2017-12-14T19:48:22+00:00" - }, - { - "name": "symfony/finder", - "version": "v4.0.2", - "source": { - "type": "git", - "url": "https://github.com/symfony/finder.git", - "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", - "reference": "c9cdda4dc4a3182d8d6daeebce4a25fef078ea4c", - "shasum": "" - }, - "require": { - "php": "^7.1.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.0-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Component\\Finder\\": "" - }, - "exclude-from-classmap": [ - "/Tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony Finder Component", - "homepage": "https://symfony.com", - "time": "2017-11-07T14:45:01+00:00" - }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.6.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "reference": "2ec8b39c38cb16674bbf3fea2b6ce5bf117e1296", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.6-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "time": "2017-10-11T12:05:26+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.0", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2017-04-07T12:08:54+00:00" } ], "aliases": [], @@ -2412,7 +331,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.1" + "php": ">=7.1" }, "platform-dev": [] } diff --git a/phive.xml b/phive.xml new file mode 100644 index 00000000..24b708d5 --- /dev/null +++ b/phive.xml @@ -0,0 +1,5 @@ + + + + + From ffc8cc1f9cc2e8a72e06a04560ae6a01d61a0a49 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 15 Jan 2018 14:01:13 -0600 Subject: [PATCH 064/126] remove dupe checker --- easy-coding-standard.neon | 4 ---- 1 file changed, 4 deletions(-) diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon index e0e7b3eb..8260402a 100644 --- a/easy-coding-standard.neon +++ b/easy-coding-standard.neon @@ -3,10 +3,6 @@ includes: - temp/ecs/config/psr2.neon - temp/ecs/config/common.neon -checkers: - PhpCsFixer\Fixer\Operator\ConcatSpaceFixer: - spacing: one - parameters: exclude_checkers: # from temp/ecs/config/common.neon From d9952bd11415890b0e9e1b21bdedade6cf167d03 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Mon, 15 Jan 2018 14:01:51 -0600 Subject: [PATCH 065/126] initialize variables before include, so that var tag usage is normal --- .../integration/InterpretingDocBlocksTest.php | 45 +++++++++++-------- .../ReconstitutingADocBlockTest.php | 9 ++-- tests/integration/UsingTagsTest.php | 12 ++--- 3 files changed, 39 insertions(+), 27 deletions(-) diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index 099e40a1..ffec7ad9 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -60,11 +60,13 @@ public function testInterpretingSummaryWithEllipsis(): void public function testInterpretingASimpleDocBlock(): void { - /** - * @var DocBlock $docblock - * @var string $summary - * @var Description $description - */ + /** @var DocBlock $docblock */ + $docblock; + /** @var string $summary */ + $summary; + /** @var Description $description */ + $description; + include(__DIR__ . '/../../examples/01-interpreting-a-simple-docblock.php'); $descriptionText = <<assertTrue($hasSeeTag); @@ -105,15 +110,19 @@ public function testInterpretingTags(): void public function testDescriptionsCanEscapeAtSignsAndClosingBraces(): void { - /** - * @var string $docComment - * @var DocBlock $docblock - * @var Description $description - * @var string $receivedDocComment - * @var string $foundDescription - */ + /** @var string $docComment */ + $docComment; + /** @var DocBlock $docblock */ + $docblock; + /** @var Description $description */ + $description; + /** @var string $receivedDocComment */ + $receivedDocComment; + /** @var string $foundDescription */ + $foundDescription; include(__DIR__ . '/../../examples/playing-with-descriptions/02-escaping.php'); + $this->assertSame( <<<'DESCRIPTION' You can escape the @-sign by surrounding it with braces, for example: @. And escape a closing brace within an diff --git a/tests/integration/ReconstitutingADocBlockTest.php b/tests/integration/ReconstitutingADocBlockTest.php index 9d99f674..c8eda66f 100644 --- a/tests/integration/ReconstitutingADocBlockTest.php +++ b/tests/integration/ReconstitutingADocBlockTest.php @@ -31,10 +31,11 @@ public function tearDown(): void public function testReconstituteADocBlock(): void { - /** - * @var string $docComment - * @var string $reconstitutedDocComment - */ + /** @var string $docComment */ + $docComment; + /** @var string $reconstitutedDocComment */ + $reconstitutedDocComment; + include(__DIR__ . '/../../examples/03-reconstituting-a-docblock.php'); $this->assertSame($docComment, $reconstitutedDocComment); diff --git a/tests/integration/UsingTagsTest.php b/tests/integration/UsingTagsTest.php index 101cbf86..eb5d4295 100644 --- a/tests/integration/UsingTagsTest.php +++ b/tests/integration/UsingTagsTest.php @@ -33,11 +33,13 @@ public function tearDown(): void public function testAddingYourOwnTagUsingAStaticMethodAsFactory(): void { - /** - * @var object[] $customTagObjects - * @var string $docComment - * @var string $reconstitutedDocComment - */ + /** @var object[] $customTagObjects */ + $customTagObjects; + /** @var string $docComment */ + $docComment; + /** @var string $reconstitutedDocComment */ + $reconstitutedDocComment; + include(__DIR__ . '/../../examples/04-adding-your-own-tag.php'); $this->assertInstanceOf(\MyTag::class, $customTagObjects[0]); From 1a799237e13027f02f29a13d24cbfe7c90c8ed76 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 30 Jan 2018 12:30:43 -0600 Subject: [PATCH 066/126] try using global phpunit --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a6871e3c..43d540ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,18 +11,18 @@ matrix: install: - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader + - travis_retry composer global require phpunit/phpunit # cannot use phpunit.phar or require-dev, because this package is a phpunit dep - travis_retry wget https://phar.io/releases/phive.phar - - travis_retry composer require --dev phpunit/phpunit # cannot trust phpunit.phar, because this package is itself in that phar..." script: - - ./vendor/bin/phpunit --no-coverage + - /home/travis/.composer/vendor/bin/phpunit --no-coverage jobs: include: - stage: coverage php: 7.1 script: - - ./vendor/bin/phpunit + - /home/travis/.composer/vendor/bin/phpunit after_script: - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose - travis_retry wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml From a6069276fd1ff5f67f628bae1c8a21bbc95e5f1d Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 30 Jan 2018 13:00:44 -0600 Subject: [PATCH 067/126] bump deps to get library alphas --- composer.json | 9 +++++---- composer.lock | 49 ++++++++++++++++++++++--------------------------- 2 files changed, 27 insertions(+), 31 deletions(-) diff --git a/composer.json b/composer.json index e51f9fbd..f8492cba 100644 --- a/composer.json +++ b/composer.json @@ -9,14 +9,15 @@ "email": "me@mikevanriel.com" } ], + "minimum-stability": "alpha", "require": { "php": ">=7.1", - "phpdocumentor/type-resolver": "^0.5", - "webmozart/assert": "^1.0" + "phpdocumentor/type-resolver": "^0", + "webmozart/assert": "^1" }, "require-dev": { - "mockery/mockery": "^1.0", - "doctrine/instantiator": "^1.0" + "mockery/mockery": "^1", + "doctrine/instantiator": "^1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index 591a0d65..f210736e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,27 +4,27 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "4da4bf855fcd911619ef36a909ba6579", + "content-hash": "cb7ecdcb52e627755275cf273bcdd249", "packages": [ { "name": "phpdocumentor/reflection-common", - "version": "1.0.1", + "version": "2.0.0-alpha1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", + "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", "shasum": "" }, "require": { - "php": ">=5.5" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^4.6" + "phpunit/phpunit": "^6.5" }, "type": "library", "extra": { @@ -58,36 +58,31 @@ "reflection", "static analysis" ], - "time": "2017-09-11T18:02:19+00:00" + "time": "2018-01-18T22:08:35+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.5.0", + "version": "0.6.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "7159da1ff4ab5de0c033bab91c9d3f52dd9a7a02" + "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7159da1ff4ab5de0c033bab91c9d3f52dd9a7a02", - "reference": "7159da1ff4ab5de0c033bab91c9d3f52dd9a7a02", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", + "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0" + "php": ">=7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "phpunit/phpunit": "^6.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": "src" @@ -103,20 +98,20 @@ "email": "me@mikevanriel.com" } ], - "time": "2017-11-15T21:30:06+00:00" + "time": "2018-01-26T19:53:18+00:00" }, { "name": "webmozart/assert", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f" + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/2db61e59ff05fe5126d152bd0655c9ea113e550f", - "reference": "2db61e59ff05fe5126d152bd0655c9ea113e550f", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", "shasum": "" }, "require": { @@ -153,7 +148,7 @@ "check", "validate" ], - "time": "2016-11-23T20:04:58+00:00" + "time": "2018-01-29T19:49:41+00:00" } ], "packages-dev": [ @@ -326,7 +321,7 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "alpha", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, From 9073dd28d0325d13918f942bd5b918599d5ad840 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 30 Jan 2018 13:17:34 -0600 Subject: [PATCH 068/126] quieter wget --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 43d540ff..24e1060f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: install: - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader - travis_retry composer global require phpunit/phpunit # cannot use phpunit.phar or require-dev, because this package is a phpunit dep - - travis_retry wget https://phar.io/releases/phive.phar + - travis_retry wget --no-verbose https://phar.io/releases/phive.phar script: - /home/travis/.composer/vendor/bin/phpunit --no-coverage @@ -25,7 +25,7 @@ jobs: - /home/travis/.composer/vendor/bin/phpunit after_script: - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose - - travis_retry wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml + - travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - stage: lint php: 7.1 From 00c87ba426588f9c0e3bf4d415406ab02d021502 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Tue, 30 Jan 2018 13:25:44 -0600 Subject: [PATCH 069/126] adjust appveyor for global phpunit --- appveyor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index c2a1a5d4..25ef5c8d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,7 +48,9 @@ install: - IF NOT EXIST php-installed.txt type nul >> php-installed.txt - cd c:\reflectiondocblock - composer install --no-interaction --prefer-dist --no-progress + - composer global require phpunit/phpunit + - composer global config bin-dir --absolute test_script: - cd c:\reflectiondocblock - - vendor/bin/phpunit --no-coverage + - c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage From 5ea3cbf8cfc5d6d51fd56d85a1d455fba891b5f0 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 08:57:30 -0600 Subject: [PATCH 070/126] add missing typehints and return types; --- src/DocBlock.php | 4 ++-- src/DocBlock/Description.php | 2 +- src/DocBlock/DescriptionFactory.php | 2 +- src/DocBlock/StandardTagFactory.php | 8 ++++---- src/DocBlock/Tags/Example.php | 2 +- src/DocBlock/Tags/Method.php | 10 +++++----- src/DocBlock/Tags/Reference/Url.php | 2 +- src/DocBlockFactory.php | 4 ++-- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 13cb3834..55eb7ae8 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -133,7 +133,7 @@ public function isTemplateEnd(): bool * * @return Tag[] */ - public function getTags() + public function getTags(): array { return $this->tags; } @@ -146,7 +146,7 @@ public function getTags() * * @return Tag[] */ - public function getTagsByName(string $name) + public function getTagsByName(string $name): array { $result = []; diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index a83efcbe..bf13504d 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -72,7 +72,7 @@ public function __construct(string $bodyTemplate, array $tags = []) * * @return Tag[] */ - public function getTags() + public function getTags(): array { return $this->tags; } diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 5da07e12..bda6c5e0 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -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); diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 106b6b4b..2c349948 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -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)) { @@ -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) { @@ -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'); @@ -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, diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 437a2271..9685bf48 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -81,7 +81,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)) { diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 2862731b..e2ffb010 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -92,12 +92,12 @@ public static function create( )? # Return type (?: - ( + ( (?:[\w\|_\\\\]*\$this[\w\|_\\\\]*) | (?: (?:[\w\|_\\\\]+) - # array notation + # array notation (?:\[\])* )* ) @@ -170,7 +170,7 @@ public function getMethodName(): string /** * @return string[] */ - public function getArguments() + public function getArguments(): array { return $this->arguments; } @@ -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)) { @@ -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)); diff --git a/src/DocBlock/Tags/Reference/Url.php b/src/DocBlock/Tags/Reference/Url.php index 847423b6..698d0321 100644 --- a/src/DocBlock/Tags/Reference/Url.php +++ b/src/DocBlock/Tags/Reference/Url.php @@ -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; diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 67c147fe..4383bc53 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -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 @@ -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) { From ff287a453fea565b08af4bd62b6492ff34faee33 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 08:58:03 -0600 Subject: [PATCH 071/126] remove unused imports; --- src/DocBlock/Tags/Example.php | 1 - src/DocBlock/Tags/Since.php | 1 - 2 files changed, 2 deletions(-) diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 9685bf48..baa437ca 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Tag; use Webmozart\Assert\Assert; diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index de714c57..5af7dc24 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -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; From cc0998e4718557adcaa16501eafeb5ca53470c5c Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 31 Jan 2018 08:58:25 -0600 Subject: [PATCH 072/126] add self return type; --- src/DocBlock/Tags/Covers.php | 2 +- src/DocBlock/Tags/Deprecated.php | 2 +- src/DocBlock/Tags/Generic.php | 2 +- src/DocBlock/Tags/Param.php | 2 +- src/DocBlock/Tags/Property.php | 2 +- src/DocBlock/Tags/PropertyRead.php | 2 +- src/DocBlock/Tags/PropertyWrite.php | 2 +- src/DocBlock/Tags/Return_.php | 2 +- src/DocBlock/Tags/See.php | 2 +- src/DocBlock/Tags/Source.php | 2 +- src/DocBlock/Tags/Throws.php | 2 +- src/DocBlock/Tags/Uses.php | 2 +- src/DocBlock/Tags/Var_.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 30c0a3eb..162d14de 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -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); diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 914ffa54..0c9ff12a 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -59,7 +59,7 @@ public static function create( ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) { + ): self { if (empty($body)) { return new static(); } diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index d50f9968..06ad38db 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -49,7 +49,7 @@ public static function create( string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) { + ): self { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 75d50012..5ebf1e8e 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -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]); diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 29daefec..c1316be8 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -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]); diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index b168ffa1..e1dd1cb1 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -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]); diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 89f93721..846e30aa 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -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]); diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index fd908929..ae1d2e1e 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -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); diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index a6fb3a29..bc98297b 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -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); diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index b2420d1b..d63fb8af 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -49,7 +49,7 @@ public static function create( string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ) { + ): self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 5e851842..3e357083 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -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); diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index ff7774fd..50fb36d5 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -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); diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index dbb25957..eb7d41c0 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -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]); From 3eb278bd0e9b2cd24c2d3fb2524b7a210a2e681a Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 07:53:04 -0600 Subject: [PATCH 073/126] type-resolver update --- composer.lock | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f210736e..4808fe4f 100644 --- a/composer.lock +++ b/composer.lock @@ -62,16 +62,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "0.6.0", + "version": "0.6.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2" + "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", - "reference": "6b6613f1aa77d42eaf8569feefe7b904e4b4acb2", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2870950c8eb446517e2e29acf8bbc209ed3ab0e4", + "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4", "shasum": "" }, "require": { @@ -83,6 +83,11 @@ "phpunit/phpunit": "^6.5" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.x-dev" + } + }, "autoload": { "psr-4": { "phpDocumentor\\Reflection\\": "src" @@ -98,7 +103,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2018-01-26T19:53:18+00:00" + "time": "2018-02-12T14:33:22+00:00" }, { "name": "webmozart/assert", From 238565e7a83e6ef517649d116fc2c5f2064ab660 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 08:02:37 -0600 Subject: [PATCH 074/126] limit global phpunit to v6 --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 24e1060f..5b821424 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,7 +11,7 @@ matrix: install: - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader - - travis_retry composer global require phpunit/phpunit # cannot use phpunit.phar or require-dev, because this package is a phpunit dep + - travis_retry composer global require phpunit/phpunit ^6 # cannot use phpunit.phar or require-dev, because this package is a phpunit dep - travis_retry wget --no-verbose https://phar.io/releases/phive.phar script: diff --git a/appveyor.yml b/appveyor.yml index 25ef5c8d..4ceb6ce2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -48,7 +48,7 @@ install: - IF NOT EXIST php-installed.txt type nul >> php-installed.txt - cd c:\reflectiondocblock - composer install --no-interaction --prefer-dist --no-progress - - composer global require phpunit/phpunit + - composer global require phpunit/phpunit ^6 - composer global config bin-dir --absolute test_script: From 2de1b36556e8a948f1ff43b9c4a1b279870516d4 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 08:05:46 -0600 Subject: [PATCH 075/126] bump php versions --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 4ceb6ce2..33010b2d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,9 +12,9 @@ branches: environment: matrix: - - PHP_VERSION: '7.1.13' + - PHP_VERSION: '7.1.14' VC_VERSION: 'VC14' - - PHP_VERSION: '7.2.1' + - PHP_VERSION: '7.2.2' VC_VERSION: 'VC15' matrix: fast_finish: false From 182609736818dc750d42470c0be2a5ed74bad3bd Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 14 Feb 2018 13:00:58 -0600 Subject: [PATCH 076/126] bump reflection-common --- composer.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 4808fe4f..a5e2268f 100644 --- a/composer.lock +++ b/composer.lock @@ -8,28 +8,28 @@ "packages": [ { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-alpha1", + "version": "2.0.0-alpha2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca" + "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", - "reference": "e8e68dc40f300e50f5a3b254bd7b41eecdc4ddca", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", + "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^6.5" + "phpunit/phpunit": "^6" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "2.x-dev" } }, "autoload": { @@ -58,7 +58,7 @@ "reflection", "static analysis" ], - "time": "2018-01-18T22:08:35+00:00" + "time": "2018-02-14T18:51:33+00:00" }, { "name": "phpdocumentor/type-resolver", From 9e752643591afcf2d8225f4f403c5b43bb5c0f95 Mon Sep 17 00:00:00 2001 From: Jakub Zalas Date: Thu, 19 Apr 2018 08:58:50 +0100 Subject: [PATCH 077/126] Update the branch alias for 5.x releases It's time to update the branch alias since BC breaking changes were merged and the first 5.0.0-alpha1 release has been made. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f8492cba..788ed981 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ }, "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } } } From 4b73412a9d629d3ef58d218ffec0519cec3f10a3 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 07:34:33 -0500 Subject: [PATCH 078/126] bump to next type-resolver alpha --- composer.lock | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/composer.lock b/composer.lock index a5e2268f..29b1328a 100644 --- a/composer.lock +++ b/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-alpha2", + "version": "2.0.0-alpha3", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511" + "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", - "reference": "b775523cbbcbbcdd54f6a9dc0902ebe8c76ff511", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/eedd98e8bc9cfd924f056b4b5847066d4a250d2f", + "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f", "shasum": "" }, "require": { @@ -58,25 +58,25 @@ "reflection", "static analysis" ], - "time": "2018-02-14T18:51:33+00:00" + "time": "2018-06-13T21:44:20+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.6.1", + "version": "0.6.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4" + "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2870950c8eb446517e2e29acf8bbc209ed3ab0e4", - "reference": "2870950c8eb446517e2e29acf8bbc209ed3ab0e4", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e81ce9e82df06b49b2d0e0a2393a08955aeda05b", + "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b", "shasum": "" }, "require": { "php": ">=7.1", - "phpdocumentor/reflection-common": "^2.0" + "phpdocumentor/reflection-common": "^2" }, "require-dev": { "mockery/mockery": "^1.0", @@ -103,7 +103,7 @@ "email": "me@mikevanriel.com" } ], - "time": "2018-02-12T14:33:22+00:00" + "time": "2018-06-14T12:29:58+00:00" }, { "name": "webmozart/assert", @@ -261,16 +261,16 @@ }, { "name": "mockery/mockery", - "version": "1.0", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38" + "reference": "99e29d3596b16dabe4982548527d5ddf90232e99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/1bac8c362b12f522fdd1f1fa3556284c91affa38", - "reference": "1bac8c362b12f522fdd1f1fa3556284c91affa38", + "url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99", + "reference": "99e29d3596b16dabe4982548527d5ddf90232e99", "shasum": "" }, "require": { @@ -279,7 +279,8 @@ "php": ">=5.6.0" }, "require-dev": { - "phpunit/phpunit": "~5.7|~6.1" + "phpdocumentor/phpdocumentor": "^2.9", + "phpunit/phpunit": "~5.7.10|~6.5" }, "type": "library", "extra": { @@ -308,8 +309,8 @@ "homepage": "http://davedevelopment.co.uk" } ], - "description": "Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succinct API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.", - "homepage": "http://github.com/mockery/mockery", + "description": "Mockery is a simple yet flexible PHP mock object framework", + "homepage": "https://github.com/mockery/mockery", "keywords": [ "BDD", "TDD", @@ -322,7 +323,7 @@ "test double", "testing" ], - "time": "2017-10-06T16:20:43+00:00" + "time": "2018-05-08T08:54:48+00:00" } ], "aliases": [], From 688e9d1e5499e32df93c930cd8f0fac38b54b51f Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 07:35:11 -0500 Subject: [PATCH 079/126] update appveyor config format --- appveyor.yml | 50 +++++++++++++++++++++++--------------------------- 1 file changed, 23 insertions(+), 27 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 33010b2d..2e5eea34 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,10 +12,8 @@ branches: environment: matrix: - - PHP_VERSION: '7.1.14' - VC_VERSION: 'VC14' - - PHP_VERSION: '7.2.2' - VC_VERSION: 'VC15' + - php_ver_target: 7.1 + - php_ver_target: 7.2 matrix: fast_finish: false @@ -24,33 +22,31 @@ cache: - '%LOCALAPPDATA%\Composer\files' init: - - SET PATH=c:\php\%PHP_VERSION%;%PATH% + - SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH% + - SET COMPOSER_NO_INTERACTION=1 + - SET PHP=1 + - SET ANSICON=121x90 (121x90) + install: - - IF NOT EXIST c:\php mkdir c:\php - - IF NOT EXIST c:\php\%PHP_VERSION% mkdir c:\php\%PHP_VERSION% - - cd c:\php\%PHP_VERSION% - - IF NOT EXIST php-installed.txt appveyor DownloadFile http://windows.php.net/downloads/releases/php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip - - IF NOT EXIST php-installed.txt 7z x php-%PHP_VERSION%-Win32-%VC_VERSION%-x86.zip -y >nul - - IF NOT EXIST php-installed.txt del /Q *.zip - - IF NOT EXIST php-installed.txt copy /Y php.ini-development php.ini - - IF NOT EXIST php-installed.txt echo max_execution_time=1200 >> php.ini - - IF NOT EXIST php-installed.txt echo date.timezone="UTC" >> php.ini - - IF NOT EXIST php-installed.txt echo extension_dir=ext >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_curl.dll >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_openssl.dll >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_mbstring.dll >> php.ini - - IF NOT EXIST php-installed.txt echo extension=php_fileinfo.dll >> php.ini - - IF NOT EXIST php-installed.txt echo zend.assertions=1 >> php.ini - - IF NOT EXIST php-installed.txt echo assert.exception=On >> php.ini - - IF NOT EXIST php-installed.txt appveyor DownloadFile https://getcomposer.org/composer.phar - - IF NOT EXIST php-installed.txt echo @php %%~dp0composer.phar %%* > composer.bat - - IF NOT EXIST php-installed.txt type nul >> php-installed.txt + - IF EXIST c:\tools\php (SET PHP=0) + - ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') + - cd c:\tools\php + - IF %PHP%==1 copy /Y php.ini-development php.ini + - IF %PHP%==1 echo max_execution_time=1200 >> php.ini + - IF %PHP%==1 echo date.timezone="UTC" >> php.ini + - IF %PHP%==1 echo extension_dir=ext >> php.ini + - IF %PHP%==1 echo extension=php_curl.dll >> php.ini + - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini + - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini + - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini + - IF %PHP%==1 echo zend.assertions=1 >> php.ini + - IF %PHP%==1 echo assert.exception=On >> php.ini + - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat + - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar - cd c:\reflectiondocblock - composer install --no-interaction --prefer-dist --no-progress - - composer global require phpunit/phpunit ^6 - - composer global config bin-dir --absolute test_script: - cd c:\reflectiondocblock - - c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage + - vendor\bin\phpunit --no-coverage From 26a37cf245be1809e9be637933ac03dc71fb63b8 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 07:43:12 -0500 Subject: [PATCH 080/126] restore global phpunit --- appveyor.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 2e5eea34..2a650d99 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -46,7 +46,9 @@ install: - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar - cd c:\reflectiondocblock - composer install --no-interaction --prefer-dist --no-progress + - composer global require phpunit/phpunit ^6 + - composer global config bin-dir --absolute test_script: - cd c:\reflectiondocblock - - vendor\bin\phpunit --no-coverage + - c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage From d31c40a6a1238dbf06bb2a063ab5b0373b903fd5 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Thu, 14 Jun 2018 11:01:00 -0500 Subject: [PATCH 081/126] use ecs v3.x --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5b821424..0113d538 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ jobs: - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan script: - ./tools/phpstan analyse src --level max --configuration phpstan.neon - - composer create-project symplify/easy-coding-standard temp/ecs && temp/ecs/bin/ecs check src tests + - composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests cache: directories: From a29cd5c528ececde017f66054656703f6338b4c3 Mon Sep 17 00:00:00 2001 From: Chuck Burgess Date: Wed, 20 Jun 2018 09:15:29 -0500 Subject: [PATCH 082/126] initialize line count to an int; --- src/DocBlock/Tags/Example.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index baa437ca..d43fe83d 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -42,10 +42,11 @@ final class Example extends BaseTag */ private $lineCount; - public function __construct(string $filePath, bool $isURI, int $startingLine, $lineCount, $description) + public function __construct(string $filePath, bool $isURI, int $startingLine, int $lineCount, $description) { Assert::notEmpty($filePath); Assert::greaterThanEq($startingLine, 0); + Assert::greaterThanEq($lineCount, 0); $this->filePath = $filePath; $this->startingLine = $startingLine; @@ -96,7 +97,7 @@ public static function create(string $body): ?Tag } $startingLine = 1; - $lineCount = null; + $lineCount = 0; $description = null; if (array_key_exists(3, $matches)) { From 6929bd488108eb6e646bc640fa35c7c435e3b6dd Mon Sep 17 00:00:00 2001 From: Andrey Bolonin Date: Tue, 30 Oct 2018 02:05:21 +0200 Subject: [PATCH 083/126] add php 7.3 to travis --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0113d538..050bab94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: php -php: [ 7.1, 7.2, nightly ] +php: [ 7.1, 7.2, 7.3, nightly ] sudo: false env: From 095cf6d37a33da2b64d45802cb81be9476a07de6 Mon Sep 17 00:00:00 2001 From: Michael Knappe Date: Tue, 30 Apr 2019 13:21:57 +0200 Subject: [PATCH 084/126] fixed generic tag to parse description with `0` as expected --- src/DocBlock/Tags/Generic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index 06ad38db..444bad43 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -53,7 +53,7 @@ public static function create( Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); - $description = $descriptionFactory && $body ? $descriptionFactory->create($body, $context) : null; + $description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null; return new static($name, $description); } From 6907decc71103f95f5b93b746c1f284dafc529d2 Mon Sep 17 00:00:00 2001 From: Michael Knappe Date: Tue, 30 Apr 2019 13:22:06 +0200 Subject: [PATCH 085/126] added test for generic tag to parse description with `0` as expected --- tests/integration/DocblocksWithAnnotationsTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/integration/DocblocksWithAnnotationsTest.php b/tests/integration/DocblocksWithAnnotationsTest.php index 06e50815..139248b6 100644 --- a/tests/integration/DocblocksWithAnnotationsTest.php +++ b/tests/integration/DocblocksWithAnnotationsTest.php @@ -44,4 +44,18 @@ public function testDocblockWithAnnotations(): void $this->assertCount(3, $docblock->getTags()); } + + public function testDocblockWithAnnotationHavingZeroValue(): void + { + $docComment = <<create($docComment); + + $this->assertSame(0, printf('%i', $docblock->getTagsByName('my-tag'))); + } } From 8fcadfe5f85c38705151c9ab23b4781f23e6a70e Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Sat, 15 Jun 2019 22:45:01 +0200 Subject: [PATCH 086/126] No longer bubble tag exceptions to the top When a tag has an invalid component to it it would cause a whole file to fail to parse. Instead we should consider invalid tags a nuisance but not worth breaking the whole parsing over. In this change I have added a try..catch that will prevent invalid tags from breaking the whole parsing process. --- src/DocBlock/StandardTagFactory.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 2c349948..b466cfce 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -191,7 +191,11 @@ private function createTag(string $body, string $name, TypeContext $context): ?T $this->getServiceLocatorWithDynamicParameters($context, $name, $body) ); - return call_user_func_array([$handlerClassName, 'create'], $arguments); + try { + return call_user_func_array([$handlerClassName, 'create'], $arguments); + } catch (\InvalidArgumentException $e) { + return null; + } } /** From aee984014b2ff59ae33c3b05a11904b29790aae9 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 20 Sep 2019 10:54:12 +0200 Subject: [PATCH 087/126] Apply new code style --- phpcs.xml.dist | 30 +++ src/DocBlock.php | 38 ++-- src/DocBlock/Description.php | 15 +- src/DocBlock/DescriptionFactory.php | 33 ++- src/DocBlock/ExampleFinder.php | 35 ++-- src/DocBlock/Serializer.php | 86 +++++--- src/DocBlock/StandardTagFactory.php | 119 ++++++----- src/DocBlock/Tag.php | 12 +- src/DocBlock/TagFactory.php | 61 +++--- src/DocBlock/Tags/Author.php | 29 ++- src/DocBlock/Tags/BaseTag.php | 15 +- src/DocBlock/Tags/Covers.php | 18 +- src/DocBlock/Tags/Deprecated.php | 20 +- src/DocBlock/Tags/Example.php | 62 +++--- src/DocBlock/Tags/Factory/StaticMethod.php | 6 +- src/DocBlock/Tags/Factory/Strategy.php | 19 -- src/DocBlock/Tags/Formatter.php | 8 +- .../Tags/Formatter/AlignFormatter.php | 21 +- .../Tags/Formatter/PassthroughFormatter.php | 11 +- src/DocBlock/Tags/Generic.php | 25 +-- src/DocBlock/Tags/Link.php | 33 +-- src/DocBlock/Tags/Method.php | 65 ++++-- src/DocBlock/Tags/Param.php | 55 +++-- src/DocBlock/Tags/Property.php | 32 +-- src/DocBlock/Tags/PropertyRead.php | 32 +-- src/DocBlock/Tags/PropertyWrite.php | 32 +-- src/DocBlock/Tags/Reference/Fqsen.php | 19 +- src/DocBlock/Tags/Reference/Reference.php | 12 +- src/DocBlock/Tags/Reference/Url.php | 19 +- src/DocBlock/Tags/Return_.php | 18 +- src/DocBlock/Tags/See.php | 21 +- src/DocBlock/Tags/Since.php | 20 +- src/DocBlock/Tags/Source.php | 31 +-- src/DocBlock/Tags/Throws.php | 18 +- src/DocBlock/Tags/Uses.php | 18 +- src/DocBlock/Tags/Var_.php | 28 ++- src/DocBlock/Tags/Version.php | 26 +-- src/DocBlockFactory.php | 73 ++++--- src/DocBlockFactoryInterface.php | 9 +- .../DocblocksWithAnnotationsTest.php | 6 +- .../integration/InterpretingDocBlocksTest.php | 6 +- .../ReconstitutingADocBlockTest.php | 6 +- tests/integration/UsingTagsTest.php | 6 +- .../unit/DocBlock/DescriptionFactoryTest.php | 82 ++++---- tests/unit/DocBlock/DescriptionTest.php | 51 ++--- tests/unit/DocBlock/ExampleFinderTest.php | 17 +- tests/unit/DocBlock/SerializerTest.php | 64 +++--- .../unit/DocBlock/StandardTagFactoryTest.php | 159 ++++++++------- tests/unit/DocBlock/Tags/AuthorTest.php | 37 ++-- tests/unit/DocBlock/Tags/CoversTest.php | 42 ++-- tests/unit/DocBlock/Tags/DeprecatedTest.php | 48 +++-- tests/unit/DocBlock/Tags/ExampleTest.php | 36 ++-- .../Tags/Formatter/AlignFormatterTest.php | 32 +-- .../Formatter/PassthroughFormatterTest.php | 22 +- tests/unit/DocBlock/Tags/GenericTest.php | 42 ++-- tests/unit/DocBlock/Tags/LinkTest.php | 43 ++-- tests/unit/DocBlock/Tags/MethodTest.php | 192 +++++++++--------- tests/unit/DocBlock/Tags/ParamTest.php | 56 ++--- tests/unit/DocBlock/Tags/PropertyReadTest.php | 54 ++--- tests/unit/DocBlock/Tags/PropertyTest.php | 54 ++--- .../unit/DocBlock/Tags/PropertyWriteTest.php | 54 ++--- tests/unit/DocBlock/Tags/ReturnTest.php | 46 +++-- tests/unit/DocBlock/Tags/SeeTest.php | 60 +++--- tests/unit/DocBlock/Tags/SinceTest.php | 45 ++-- tests/unit/DocBlock/Tags/SourceTest.php | 54 ++--- tests/unit/DocBlock/Tags/ThrowsTest.php | 46 +++-- tests/unit/DocBlock/Tags/UsesTest.php | 46 +++-- tests/unit/DocBlock/Tags/VarTest.php | 57 +++--- tests/unit/DocBlock/Tags/VersionTest.php | 45 ++-- tests/unit/DocBlockFactoryTest.php | 111 +++++----- tests/unit/DocBlockTest.php | 100 ++++----- 71 files changed, 1659 insertions(+), 1284 deletions(-) create mode 100644 phpcs.xml.dist delete mode 100644 src/DocBlock/Tags/Factory/Strategy.php diff --git a/phpcs.xml.dist b/phpcs.xml.dist new file mode 100644 index 00000000..c030e8de --- /dev/null +++ b/phpcs.xml.dist @@ -0,0 +1,30 @@ + + + The coding standard for phpDocumentor. + + src + tests/unit + */tests/unit/Types/ContextFactoryTest.php + + + *\.php + + + + + + + + */src/*_.php + + + + */src/*/Abstract*.php + + + + + + + + diff --git a/src/DocBlock.php b/src/DocBlock.php index 55eb7ae8..a5b9f5ce 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -41,8 +41,8 @@ final class DocBlock /** * @param DocBlock\Tag[] $tags - * @param Types\Context $context The context in which the DocBlock occurs. - * @param Location $location The location within the file that this DocBlock occurs in. + * @param Types\Context $context The context in which the DocBlock occurs. + * @param Location $location The location within the file that this DocBlock occurs in. */ public function __construct( string $summary = '', @@ -55,25 +55,25 @@ public function __construct( ) { Assert::allIsInstanceOf($tags, Tag::class); - $this->summary = $summary; + $this->summary = $summary; $this->description = $description ?: new DocBlock\Description(''); foreach ($tags as $tag) { $this->addTag($tag); } - $this->context = $context; + $this->context = $context; $this->location = $location; - $this->isTemplateEnd = $isTemplateEnd; + $this->isTemplateEnd = $isTemplateEnd; $this->isTemplateStart = $isTemplateStart; } - public function getSummary(): string + public function getSummary() : string { return $this->summary; } - public function getDescription(): DocBlock\Description + public function getDescription() : DocBlock\Description { return $this->description; } @@ -81,7 +81,7 @@ public function getDescription(): DocBlock\Description /** * Returns the current context. */ - public function getContext(): ?Types\Context + public function getContext() : ?Types\Context { return $this->context; } @@ -89,7 +89,7 @@ public function getContext(): ?Types\Context /** * Returns the current location. */ - public function getLocation(): ?Location + public function getLocation() : ?Location { return $this->location; } @@ -113,7 +113,7 @@ public function getLocation(): ?Location * * @see self::isTemplateEnd() for the check whether a closing marker was provided. */ - public function isTemplateStart(): bool + public function isTemplateStart() : bool { return $this->isTemplateStart; } @@ -123,7 +123,7 @@ public function isTemplateStart(): bool * * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. */ - public function isTemplateEnd(): bool + public function isTemplateEnd() : bool { return $this->isTemplateEnd; } @@ -133,7 +133,7 @@ public function isTemplateEnd(): bool * * @return Tag[] */ - public function getTags(): array + public function getTags() : array { return $this->tags; } @@ -146,7 +146,7 @@ public function getTags(): array * * @return Tag[] */ - public function getTagsByName(string $name): array + public function getTagsByName(string $name) : array { $result = []; @@ -167,7 +167,7 @@ public function getTagsByName(string $name): array * * @param string $name Tag name to check for. */ - public function hasTag(string $name): bool + public function hasTag(string $name) : bool { /** @var Tag $tag */ foreach ($this->getTags() as $tag) { @@ -184,7 +184,7 @@ public function hasTag(string $name): bool * * @param Tag $tagToRemove The tag to remove. */ - public function removeTag(Tag $tagToRemove): void + public function removeTag(Tag $tagToRemove) : void { foreach ($this->tags as $key => $tag) { if ($tag === $tagToRemove) { @@ -199,7 +199,7 @@ public function removeTag(Tag $tagToRemove): void * * @param Tag $tag The tag to add. */ - private function addTag(Tag $tag): void + private function addTag(Tag $tag) : void { $this->tags[] = $tag; } diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index bf13504d..40299fc3 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -15,6 +15,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; +use function vsprintf; /** * Object representing to description for a DocBlock. @@ -64,7 +65,7 @@ class Description public function __construct(string $bodyTemplate, array $tags = []) { $this->bodyTemplate = $bodyTemplate; - $this->tags = $tags; + $this->tags = $tags; } /** @@ -72,7 +73,7 @@ public function __construct(string $bodyTemplate, array $tags = []) * * @return Tag[] */ - public function getTags(): array + public function getTags() : array { return $this->tags; } @@ -81,7 +82,7 @@ public function getTags(): array * Renders this description as a string where the provided formatter will format the tags in the expected string * format. */ - public function render(?Formatter $formatter = null): string + public function render(?Formatter $formatter = null) : string { if ($formatter === null) { $formatter = new PassthroughFormatter(); @@ -98,7 +99,7 @@ public function render(?Formatter $formatter = null): string /** * Returns a plain string representation of this description. */ - public function __toString(): string + public function __toString() : string { return $this->render(); } diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index bda6c5e0..458fac72 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Types\Context as TypeContext; +use const PREG_SPLIT_DELIM_CAPTURE; +use function count; +use function explode; +use function implode; +use function ltrim; +use function min; +use function preg_split; +use function str_replace; +use function strlen; +use function strpos; +use function substr; +use function trim; /** * Creates a new Description object given a body of text. @@ -48,7 +60,7 @@ public function __construct(TagFactory $tagFactory) /** * Returns the parsed text of this description. */ - public function create(string $contents, ?TypeContext $context = null): Description + public function create(string $contents, ?TypeContext $context = null) : Description { [$text, $tags] = $this->parse($this->lex($contents), $context); @@ -58,10 +70,9 @@ public function create(string $contents, ?TypeContext $context = null): Descript /** * Strips the contents from superfluous whitespace and splits the description into a series of tokens. * - * * @return string[] A series of tokens of which the description text is composed. */ - private function lex(string $contents): array + private function lex(string $contents) : array { $contents = $this->removeSuperfluousStartingWhitespace($contents); @@ -108,14 +119,14 @@ private function lex(string $contents): array * * @return string[]|Tag[] */ - private function parse($tokens, ?TypeContext $context = null): array + private function parse(array $tokens, ?TypeContext $context = null) : array { - $count = count($tokens); + $count = count($tokens); $tagCount = 0; - $tags = []; + $tags = []; for ($i = 1; $i < $count; $i += 2) { - $tags[] = $this->tagFactory->create($tokens[$i], $context); + $tags[] = $this->tagFactory->create($tokens[$i], $context); $tokens[$i] = '%' . ++$tagCount . '$s'; } @@ -144,7 +155,7 @@ private function parse($tokens, ?TypeContext $context = null): array * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent * lines and this may cause rendering issues when, for example, using a Markdown converter. */ - private function removeSuperfluousStartingWhitespace(string $contents): string + private function removeSuperfluousStartingWhitespace(string $contents) : string { $lines = explode("\n", $contents); diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index b147e52e..227894ce 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock\Tags\Example; +use const DIRECTORY_SEPARATOR; +use function array_slice; +use function file; +use function getcwd; +use function implode; +use function is_readable; +use function rtrim; +use function sprintf; +use function trim; /** * Class used to find an example file's location based on a given ExampleDescriptor. @@ -29,13 +38,13 @@ class ExampleFinder /** * Attempts to find the example contents for the given descriptor. */ - public function find(Example $example): string + public function find(Example $example) : string { $filename = $example->getFilePath(); $file = $this->getExampleFileContents($filename); if (!$file) { - return "** File not found : {$filename} **"; + return sprintf('** File not found : %s **', $filename); } return implode('', array_slice($file, $example->getStartingLine() - 1, $example->getLineCount())); @@ -44,7 +53,7 @@ public function find(Example $example): string /** * Registers the project's root directory where an 'examples' folder can be expected. */ - public function setSourceDirectory(string $directory = ''): void + public function setSourceDirectory(string $directory = '') : void { $this->sourceDirectory = $directory; } @@ -52,7 +61,7 @@ public function setSourceDirectory(string $directory = ''): void /** * Returns the project's root directory where an 'examples' folder can be expected. */ - public function getSourceDirectory(): string + public function getSourceDirectory() : string { return $this->sourceDirectory; } @@ -62,7 +71,7 @@ public function getSourceDirectory(): string * * @param string[] $directories */ - public function setExampleDirectories(array $directories): void + public function setExampleDirectories(array $directories) : void { $this->exampleDirectories = $directories; } @@ -72,7 +81,7 @@ public function setExampleDirectories(array $directories): void * * @return string[] */ - public function getExampleDirectories() + public function getExampleDirectories() : array { return $this->exampleDirectories; } @@ -88,7 +97,7 @@ public function getExampleDirectories() * 3. Checks the 'examples' folder in the current working directory for examples * 4. Checks the path relative to the current working directory for the given filename */ - private function getExampleFileContents(string $filename): ?string + private function getExampleFileContents(string $filename) : ?string { $normalizedPath = null; @@ -116,7 +125,7 @@ private function getExampleFileContents(string $filename): ?string /** * Get example filepath based on the example directory inside your project. */ - private function getExamplePathFromExampleDirectory(string $file): string + private function getExamplePathFromExampleDirectory(string $file) : string { return getcwd() . DIRECTORY_SEPARATOR . 'examples' . DIRECTORY_SEPARATOR . $file; } @@ -124,7 +133,7 @@ private function getExamplePathFromExampleDirectory(string $file): string /** * Returns a path to the example file in the given directory.. */ - private function constructExamplePath(string $directory, string $file): string + private function constructExamplePath(string $directory, string $file) : string { return rtrim($directory, '\\/') . DIRECTORY_SEPARATOR . $file; } @@ -132,7 +141,7 @@ private function constructExamplePath(string $directory, string $file): string /** * Get example filepath based on sourcecode. */ - private function getExamplePathFromSource(string $file): string + private function getExamplePathFromSource(string $file) : string { return sprintf( '%s%s%s', diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index d9cb0757..e8a5c647 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\DocBlock; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; +use function sprintf; +use function str_repeat; +use function str_replace; +use function strlen; +use function wordwrap; /** * Converts a DocBlock back from an object to a complete DocComment including Asterisks. @@ -32,25 +39,30 @@ class Serializer /** @var int|null The max length of a line. */ protected $lineLength; - /** @var DocBlock\Tags\Formatter A custom tag formatter. */ + /** @var Formatter A custom tag formatter. */ protected $tagFormatter; /** * Create a Serializer instance. * - * @param int $indent The number of times the indent string is repeated. - * @param string $indentString The string to indent the comment with. - * @param bool $indentFirstLine Whether to indent the first line. - * @param int|null $lineLength The max length of a line or NULL to disable line wrapping. - * @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. + * @param int $indent The number of times the indent string is repeated. + * @param string $indentString The string to indent the comment with. + * @param bool $indentFirstLine Whether to indent the first line. + * @param int|null $lineLength The max length of a line or NULL to disable line wrapping. + * @param Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. */ - public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, ?int $lineLength = null, ?DocBlock\Tags\Formatter $tagFormatter = null) - { - $this->indent = $indent; - $this->indentString = $indentString; + public function __construct( + int $indent = 0, + string $indentString = ' ', + bool $indentFirstLine = true, + ?int $lineLength = null, + ?Formatter $tagFormatter = null + ) { + $this->indent = $indent; + $this->indentString = $indentString; $this->isFirstLineIndented = $indentFirstLine; - $this->lineLength = $lineLength; - $this->tagFormatter = $tagFormatter ?: new DocBlock\Tags\Formatter\PassthroughFormatter(); + $this->lineLength = $lineLength; + $this->tagFormatter = $tagFormatter ?: new PassthroughFormatter(); } /** @@ -60,9 +72,9 @@ public function __construct(int $indent = 0, string $indentString = ' ', bool $i * * @return string The serialized doc block. */ - public function getDocComment(DocBlock $docblock): string + public function getDocComment(DocBlock $docblock) : string { - $indent = str_repeat($this->indentString, $this->indent); + $indent = str_repeat($this->indentString, $this->indent); $firstIndent = $this->isFirstLineIndented ? $indent : ''; // 3 === strlen(' * ') $wrapLength = $this->lineLength ? $this->lineLength - strlen($indent) - 3 : null; @@ -75,35 +87,41 @@ public function getDocComment(DocBlock $docblock): string ) ); - $comment = "{$firstIndent}/**\n"; + $comment = $firstIndent . "/**\n"; if ($text) { - $comment .= "{$indent} * {$text}\n"; - $comment .= "{$indent} *\n"; + $comment .= $indent . ' * ' . $text . "\n"; + $comment .= $indent . " *\n"; } $comment = $this->addTagBlock($docblock, $wrapLength, $indent, $comment); - $comment .= $indent . ' */'; - - return $comment; + return $comment . $indent . ' */'; } /** * @return mixed */ - private function removeTrailingSpaces($indent, $text) + private function removeTrailingSpaces(string $indent, string $text) { - return str_replace("\n{$indent} * \n", "\n{$indent} *\n", $text); + return str_replace( + sprintf("\n%s * \n", $indent), + sprintf("\n%s *\n", $indent), + $text + ); } /** * @return mixed */ - private function addAsterisksForEachLine($indent, $text) + private function addAsterisksForEachLine(string $indent, string $text) { - return str_replace("\n", "\n{$indent} * ", $text); + return str_replace( + "\n", + sprintf("\n%s * ", $indent), + $text + ); } - private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string + private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, ?int $wrapLength) : string { $text = $docblock->getSummary() . ((string) $docblock->getDescription() ? "\n\n" . $docblock->getDescription() : ''); @@ -115,7 +133,7 @@ private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLeng return $text; } - private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment): string + private function addTagBlock(DocBlock $docblock, ?int $wrapLength, string $indent, string $comment) : string { foreach ($docblock->getTags() as $tag) { $tagText = $this->tagFormatter->format($tag); @@ -123,9 +141,13 @@ private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment) $tagText = wordwrap($tagText, $wrapLength); } - $tagText = str_replace("\n", "\n{$indent} * ", $tagText); + $tagText = str_replace( + "\n", + sprintf("\n%s * ", $indent), + $tagText + ); - $comment .= "{$indent} * {$tagText}\n"; + $comment .= sprintf("%s * %s\n", $indent, $tagText); } return $comment; diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index b466cfce..b26f7610 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; +use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; use phpDocumentor\Reflection\DocBlock\Tags\Generic; use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; +use ReflectionMethod; +use ReflectionParameter; use Webmozart\Assert\Assert; +use function array_merge; +use function array_slice; +use function call_user_func_array; +use function count; +use function get_class; +use function preg_match; +use function strpos; /** * Creates a Tag object given the contents of a tag. @@ -42,7 +52,8 @@ final class StandardTagFactory implements TagFactory public const REGEX_TAGNAME = '[\w\-\_\\\\]+'; /** - * @var string[] An array with a tag as a key, and an FQCN to a class that handles it as an array value. + * @var string[] An array with a tag as a key, and an + * FQCN to a class that handles it as an array value. */ private $tagHandlerMappings = [ 'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author', @@ -67,13 +78,18 @@ final class StandardTagFactory implements TagFactory ]; /** - * @var \ReflectionParameter[][] a lazy-loading cache containing parameters for each tagHandler that has been used. + * @var string[] An array with a anotation s a key, and an + * FQCN to a class that handles it as an array value. */ - private $tagHandlerParameterCache = []; + private $annotationMappings = []; /** - * @var FqsenResolver + * @var ReflectionParameter[][] a lazy-loading cache containing parameters + * for each tagHandler that has been used. */ + private $tagHandlerParameterCache = []; + + /** @var FqsenResolver */ private $fqsenResolver; /** @@ -88,9 +104,9 @@ final class StandardTagFactory implements TagFactory * If no tag handlers are provided than the default list in the {@see self::$tagHandlerMappings} property * is used. * - * @param string[] $tagHandlers - * * @see self::registerTagHandler() to add a new tag handler to the existing default list. + * + * @param string[] $tagHandlers */ public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers = null) { @@ -105,16 +121,16 @@ public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers = /** * {@inheritDoc} */ - public function create(string $tagLine, ?TypeContext $context = null): ?Tag + public function create(string $tagLine, ?TypeContext $context = null) : ?Tag { - if (! $context) { + if (!$context) { $context = new TypeContext(''); } [$tagName, $tagBody] = $this->extractTagParts($tagLine); - if ($tagBody !== '' && $tagBody[0] === '[') { - throw new \InvalidArgumentException( + if ($tagBody !== '' && strpos($tagBody, '[') === 0) { + throw new InvalidArgumentException( 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' ); } @@ -125,7 +141,7 @@ public function create(string $tagLine, ?TypeContext $context = null): ?Tag /** * {@inheritDoc} */ - public function addParameter(string $name, $value): void + public function addParameter(string $name, $value) : void { $this->serviceLocator[$name] = $value; } @@ -133,7 +149,7 @@ public function addParameter(string $name, $value): void /** * {@inheritDoc} */ - public function addService($service, $alias = null): void + public function addService($service, $alias = null) : void { $this->serviceLocator[$alias ?: get_class($service)] = $service; } @@ -141,7 +157,7 @@ public function addService($service, $alias = null): void /** * {@inheritDoc} */ - public function registerTagHandler(string $tagName, string $handler): void + public function registerTagHandler(string $tagName, string $handler) : void { Assert::stringNotEmpty($tagName); Assert::stringNotEmpty($handler); @@ -149,7 +165,7 @@ public function registerTagHandler(string $tagName, string $handler): void Assert::implementsInterface($handler, StaticMethod::class); if (strpos($tagName, '\\') && $tagName[0] !== '\\') { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'A namespaced tag must have a leading backslash as it must be fully qualified' ); } @@ -160,14 +176,13 @@ public function registerTagHandler(string $tagName, string $handler): void /** * Extracts all components for a tag. * - * * @return string[] */ - private function extractTagParts(string $tagLine): array + private function extractTagParts(string $tagLine) : array { $matches = []; - if (! preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { - throw new \InvalidArgumentException( + 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' ); } @@ -183,35 +198,35 @@ private function extractTagParts(string $tagLine): array * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. */ - private function createTag(string $body, string $name, TypeContext $context): ?Tag + private function createTag(string $body, string $name, TypeContext $context) : ?Tag { $handlerClassName = $this->findHandlerClassName($name, $context); - $arguments = $this->getArgumentsForParametersFromWiring( + $arguments = $this->getArgumentsForParametersFromWiring( $this->fetchParametersForHandlerFactoryMethod($handlerClassName), $this->getServiceLocatorWithDynamicParameters($context, $name, $body) ); try { return call_user_func_array([$handlerClassName, 'create'], $arguments); - } catch (\InvalidArgumentException $e) { + } catch (InvalidArgumentException $e) { return null; - } + } } /** * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). */ - private function findHandlerClassName(string $tagName, TypeContext $context): string + private function findHandlerClassName(string $tagName, TypeContext $context) : string { $handlerClassName = Generic::class; if (isset($this->tagHandlerMappings[$tagName])) { $handlerClassName = $this->tagHandlerMappings[$tagName]; } elseif ($this->isAnnotation($tagName)) { // TODO: Annotation support is planned for a later stage and as such is disabled for now - // $tagName = (string)$this->fqsenResolver->resolve($tagName, $context); - // if (isset($this->annotationMappings[$tagName])) { - // $handlerClassName = $this->annotationMappings[$tagName]; - // } + $tagName = (string) $this->fqsenResolver->resolve($tagName, $context); + if (isset($this->annotationMappings[$tagName])) { + $handlerClassName = $this->annotationMappings[$tagName]; + } } return $handlerClassName; @@ -220,16 +235,16 @@ private function findHandlerClassName(string $tagName, TypeContext $context): st /** * Retrieves the arguments that need to be passed to the Factory Method with the given Parameters. * - * @param \ReflectionParameter[] $parameters - * @param mixed[] $locator + * @param ReflectionParameter[] $parameters + * @param mixed[] $locator * * @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): array + private function getArgumentsForParametersFromWiring(array $parameters, array $locator) : array { $arguments = []; - foreach ($parameters as $index => $parameter) { + foreach ($parameters as $parameter) { $typeHint = $parameter->getClass() ? $parameter->getClass()->getName() : null; if (isset($locator[$typeHint])) { $arguments[] = $locator[$typeHint]; @@ -252,13 +267,12 @@ private function getArgumentsForParametersFromWiring($parameters, $locator): arr * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given * tag handler class name. * - * - * @return \ReflectionParameter[] + * @return ReflectionParameter[] */ - private function fetchParametersForHandlerFactoryMethod(string $handlerClassName): array + private function fetchParametersForHandlerFactoryMethod(string $handlerClassName) : array { - if (! isset($this->tagHandlerParameterCache[$handlerClassName])) { - $methodReflection = new \ReflectionMethod($handlerClassName, 'create'); + if (!isset($this->tagHandlerParameterCache[$handlerClassName])) { + $methodReflection = new ReflectionMethod($handlerClassName, 'create'); $this->tagHandlerParameterCache[$handlerClassName] = $methodReflection->getParameters(); } @@ -266,18 +280,24 @@ private function fetchParametersForHandlerFactoryMethod(string $handlerClassName } /** - * Returns a copy of this class' Service Locator with added dynamic parameters, such as the tag's name, body and - * Context. + * Returns a copy of this class' Service Locator with added dynamic parameters, + * such as the tag's name, body and Context. * - * @param TypeContext $context The Context (namespace and aliasses) that may be passed and is used to resolve FQSENs. - * @param string $tagName The name of the tag that may be passed onto the factory method of the Tag class. - * @param string $tagBody The body of the tag that may be passed onto the factory method of the Tag class. + * @param TypeContext $context The Context (namespace and aliasses) that may be + * passed and is used to resolve FQSENs. + * @param string $tagName The name of the tag that may be + * passed onto the factory method of the Tag class. + * @param string $tagBody The body of the tag that may be + * passed onto the factory method of the Tag class. * * @return mixed[] */ - private function getServiceLocatorWithDynamicParameters(TypeContext $context, string $tagName, string $tagBody): array - { - $locator = array_merge( + private function getServiceLocatorWithDynamicParameters( + TypeContext $context, + string $tagName, + string $tagBody + ) : array { + return array_merge( $this->serviceLocator, [ 'name' => $tagName, @@ -285,17 +305,14 @@ private function getServiceLocatorWithDynamicParameters(TypeContext $context, st TypeContext::class => $context, ] ); - - return $locator; } /** * Returns whether the given tag belongs to an annotation. * - * * @todo this method should be populated once we implement Annotation notation support. */ - private function isAnnotation(string $tagContent): bool + private function isAnnotation(string $tagContent) : bool { // 1. Contains a namespace separator // 2. Contains parenthesis diff --git a/src/DocBlock/Tag.php b/src/DocBlock/Tag.php index 76244b27..647f018f 100644 --- a/src/DocBlock/Tag.php +++ b/src/DocBlock/Tag.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -17,14 +17,14 @@ interface Tag { - public function getName(): string; + public function getName() : string; /** * @return Tag|mixed Class that implements Tag */ public static function create(string $body); - public function render(?Formatter $formatter = null): string; + public function render(?Formatter $formatter = null) : string; - public function __toString(): string; + public function __toString() : string; } diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 23425dc3..e52e88d7 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; +use InvalidArgumentException; use phpDocumentor\Reflection\Types\Context as TypeContext; interface TagFactory @@ -35,51 +36,49 @@ interface TagFactory * * These parameters are injected at the last moment and will override any existing parameter with those names. * - * @param mixed $value + * @param mixed $value */ - public function addParameter(string $name, $value): void; + public function addParameter(string $name, $value) : void; /** - * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. + * Factory method responsible for instantiating the correct sub type. * - * When calling a tag's "create" method we always check the signature for dependencies to inject. If a parameter - * has a typehint then the ServiceLocator is queried to see if a Service is registered for that typehint. + * @param string $tagLine The text for this tag, including description. * - * Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the - * interface is passed as alias then every time that interface is requested the provided service will be returned. + * @return Tag A new tag object. * - * @param object $service + * @throws InvalidArgumentException If an invalid tag line was presented. */ - public function addService($service): void; + public function create(string $tagLine, ?TypeContext $context = null) : ?Tag; /** - * Factory method responsible for instantiating the correct sub type. - * - * @param string $tagLine The text for this tag, including description. + * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. * - * @throws \InvalidArgumentException if an invalid tag line was presented. + * When calling a tag's "create" method we always check the signature for dependencies to inject. If a parameter + * has a typehint then the ServiceLocator is queried to see if a Service is registered for that typehint. * - * @return Tag A new tag object. + * Because interfaces are regularly used as type-hints this method provides an alias parameter; if the FQCN of the + * interface is passed as alias then every time that interface is requested the provided service will be returned. */ - public function create(string $tagLine, ?TypeContext $context = null): ?Tag; + public function addService(object $service) : void; /** * Registers a handler for tags. * - * If you want to use your own tags then you can use this method to instruct the TagFactory to register the name - * of a tag with the FQCN of a 'Tag Handler'. The Tag handler should implement the {@see Tag} interface (and thus - * the create method). + * If you want to use your own tags then you can use this method to instruct the TagFactory + * to register the name of a tag with the FQCN of a 'Tag Handler'. The Tag handler should implement + * the {@see Tag} interface (and thus the create method). * - * @param string $tagName Name of tag to register a handler for. When registering a namespaced tag, the full - * name, along with a prefixing slash MUST be provided. + * @param string $tagName Name of tag to register a handler for. When registering a namespaced tag, + * the full name, along with a prefixing slash MUST be provided. * @param string $handler FQCN of handler. * - * @throws \InvalidArgumentException if the tag name is not a string - * @throws \InvalidArgumentException if the tag name is namespaced (contains backslashes) but does not start with - * a backslash - * @throws \InvalidArgumentException if the handler is not a string - * @throws \InvalidArgumentException if the handler is not an existing class - * @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface + * @throws InvalidArgumentException If the tag name is not a string. + * @throws InvalidArgumentException If the tag name is namespaced (contains backslashes) but + * does not start with a backslash. + * @throws InvalidArgumentException If the handler is not a string. + * @throws InvalidArgumentException If the handler is not an existing class. + * @throws InvalidArgumentException If the handler does not implement the {@see Tag} interface. */ - public function registerTagHandler(string $tagName, string $handler): void; + public function registerTagHandler(string $tagName, string $handler) : void; } diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index 60f082cb..4bebe494 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; +use InvalidArgumentException; +use const FILTER_VALIDATE_EMAIL; +use function filter_var; +use function preg_match; +use function strlen; +use function trim; + /** * Reflection class for an {@}author tag in a Docblock. */ @@ -33,10 +40,10 @@ final class Author extends BaseTag implements Factory\StaticMethod public function __construct(string $authorName, string $authorEmail) { if ($authorEmail && !filter_var($authorEmail, FILTER_VALIDATE_EMAIL)) { - throw new \InvalidArgumentException('The author tag does not have a valid e-mail address'); + throw new InvalidArgumentException('The author tag does not have a valid e-mail address'); } - $this->authorName = $authorName; + $this->authorName = $authorName; $this->authorEmail = $authorEmail; } @@ -45,7 +52,7 @@ public function __construct(string $authorName, string $authorEmail) * * @return string The author's name. */ - public function getAuthorName(): string + public function getAuthorName() : string { return $this->authorName; } @@ -55,7 +62,7 @@ public function getAuthorName(): string * * @return string The author's email. */ - public function getEmail(): string + public function getEmail() : string { return $this->authorEmail; } @@ -63,7 +70,7 @@ public function getEmail(): string /** * Returns this tag in string form. */ - public function __toString(): string + public function __toString() : string { return $this->authorName . (strlen($this->authorEmail) ? ' <' . $this->authorEmail . '>' : ''); } @@ -71,7 +78,7 @@ public function __toString(): string /** * Attempts to create a new Author object based on †he tag body. */ - public static function create(string $body): ?self + public static function create(string $body) : ?self { $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); if (!$splitTagContent) { @@ -79,7 +86,7 @@ public static function create(string $body): ?self } $authorName = trim($matches[1]); - $email = isset($matches[2]) ? trim($matches[2]) : ''; + $email = isset($matches[2]) ? trim($matches[2]) : ''; return new static($authorName, $email); } diff --git a/src/DocBlock/Tags/BaseTag.php b/src/DocBlock/Tags/BaseTag.php index d844ed16..7a1b9492 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; @@ -32,17 +32,20 @@ abstract class BaseTag implements DocBlock\Tag * * @return string The name of this tag. */ - public function getName(): string + public function getName() : string { return $this->name; } + /** + * @return Description|string|null + */ public function getDescription() { return $this->description; } - public function render(?Formatter $formatter = null): string + public function render(?Formatter $formatter = null) : string { if ($formatter === null) { $formatter = new Formatter\PassthroughFormatter(); diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 162d14de..2a1ebf14 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; @@ -19,12 +19,14 @@ use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_split; /** * Reflection class for a @covers tag in a Docblock. */ final class Covers extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'covers'; /** @var Fqsen */ @@ -35,7 +37,7 @@ final class Covers extends BaseTag implements Factory\StaticMethod */ public function __construct(Fqsen $refers, ?Description $description = null) { - $this->refers = $refers; + $this->refers = $refers; $this->description = $description; } @@ -47,7 +49,7 @@ public static function create( ?DescriptionFactory $descriptionFactory = null, ?FqsenResolver $resolver = null, ?TypeContext $context = null - ): self { + ) : self { Assert::notEmpty($body); $parts = preg_split('/\s+/Su', $body, 2); @@ -61,7 +63,7 @@ public static function create( /** * Returns the structural element this tag refers to. */ - public function getReference(): Fqsen + public function getReference() : Fqsen { return $this->refers; } @@ -69,7 +71,7 @@ public function getReference(): Fqsen /** * Returns a string representation of this tag. */ - public function __toString(): string + public function __toString() : string { return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 0c9ff12a..98834145 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -17,12 +17,14 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_match; /** * Reflection class for a {@}deprecated tag in a Docblock. */ final class Deprecated extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'deprecated'; /** @@ -44,11 +46,11 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod /** @var string The version vector. */ private $version = ''; - public function __construct($version = null, ?Description $description = null) + public function __construct(?string $version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); - $this->version = $version; + $this->version = $version; $this->description = $description; } @@ -59,7 +61,7 @@ public static function create( ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { if (empty($body)) { return new static(); } @@ -68,7 +70,7 @@ public static function create( if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { return new static( null, - null !== $descriptionFactory ? $descriptionFactory->create($body, $context) : null + $descriptionFactory !== null ? $descriptionFactory->create($body, $context) : null ); } @@ -81,7 +83,7 @@ public static function create( /** * Gets the version section of the tag. */ - public function getVersion(): ?string + public function getVersion() : ?string { return $this->version; } @@ -89,7 +91,7 @@ public function getVersion(): ?string /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return $this->version . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index d43fe83d..122d6d34 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; +use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Tag; use Webmozart\Assert\Assert; +use function array_key_exists; +use function preg_match; +use function rawurlencode; +use function str_replace; +use function strpos; +use function trim; /** * Reflection class for a {@}example tag in a Docblock. */ final class Example extends BaseTag { - /** - * @var string Path to a file to use as an example. May also be an absolute URI. - */ + /** @var string Path to a file to use as an example. May also be an absolute URI. */ private $filePath; /** @@ -32,26 +37,25 @@ final class Example extends BaseTag */ private $isURI = false; - /** - * @var int - */ + /** @var int */ private $startingLine; - /** - * @var int - */ + /** @var int */ private $lineCount; + /** + * @param string|Description|null $description + */ public function __construct(string $filePath, bool $isURI, int $startingLine, int $lineCount, $description) { Assert::notEmpty($filePath); Assert::greaterThanEq($startingLine, 0); Assert::greaterThanEq($lineCount, 0); - $this->filePath = $filePath; + $this->filePath = $filePath; $this->startingLine = $startingLine; - $this->lineCount = $lineCount; - $this->name = 'example'; + $this->lineCount = $lineCount; + $this->name = 'example'; if ($description !== null) { $this->description = trim((string) $description); } @@ -64,7 +68,7 @@ public function __construct(string $filePath, bool $isURI, int $startingLine, in */ public function getContent() { - if (null === $this->description) { + if ($this->description === null) { $filePath = '"' . $this->filePath . '"'; if ($this->isURI) { $filePath = $this->isUriRelative($this->filePath) @@ -81,24 +85,24 @@ public function getContent() /** * {@inheritdoc} */ - public static function create(string $body): ?Tag + 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)) { + if (!preg_match('/^(?:\"([^\"]+)\"|(\S+))(?:\s+(.*))?$/sux', $body, $matches)) { return null; } $filePath = null; - $fileUri = null; - if ('' !== $matches[1]) { + $fileUri = null; + if ($matches[1] !== '') { $filePath = $matches[1]; } else { $fileUri = $matches[2]; } $startingLine = 1; - $lineCount = 0; - $description = null; + $lineCount = 0; + $description = null; if (array_key_exists(3, $matches)) { $description = $matches[3]; @@ -117,7 +121,7 @@ public static function create(string $body): ?Tag } return new static( - $filePath !== null ? $filePath : $fileUri, + $filePath ?? $fileUri, $fileUri !== null, $startingLine, $lineCount, @@ -131,7 +135,7 @@ public static function create(string $body): ?Tag * @return string Path to a file to use as an example. * May also be an absolute URI. */ - public function getFilePath(): string + public function getFilePath() : string { return $this->filePath; } @@ -139,7 +143,7 @@ public function getFilePath(): string /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return $this->filePath . ($this->description ? ' ' . $this->description : ''); } @@ -147,17 +151,17 @@ public function __toString(): string /** * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). */ - private function isUriRelative(string $uri): bool + private function isUriRelative(string $uri) : bool { - return false === strpos($uri, ':'); + return strpos($uri, ':') === false; } - public function getStartingLine(): int + public function getStartingLine() : int { return $this->startingLine; } - public function getLineCount(): int + public function getLineCount() : int { return $this->lineCount; } diff --git a/src/DocBlock/Tags/Factory/StaticMethod.php b/src/DocBlock/Tags/Factory/StaticMethod.php index 753985ac..b21a3f02 100644 --- a/src/DocBlock/Tags/Factory/StaticMethod.php +++ b/src/DocBlock/Tags/Factory/StaticMethod.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/src/DocBlock/Tags/Factory/Strategy.php b/src/DocBlock/Tags/Factory/Strategy.php deleted file mode 100644 index d1d5a271..00000000 --- a/src/DocBlock/Tags/Factory/Strategy.php +++ /dev/null @@ -1,19 +0,0 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org - */ - -namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; - -interface Strategy -{ - public function create($body): void; -} diff --git a/src/DocBlock/Tags/Formatter.php b/src/DocBlock/Tags/Formatter.php index 68ff419c..92fb9e6c 100644 --- a/src/DocBlock/Tags/Formatter.php +++ b/src/DocBlock/Tags/Formatter.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -20,5 +20,5 @@ interface Formatter /** * Formats a tag into a string representation according to a specific format, such as Markdown. */ - public function format(Tag $tag): string; + public function format(Tag $tag) : string; } diff --git a/src/DocBlock/Tags/Formatter/AlignFormatter.php b/src/DocBlock/Tags/Formatter/AlignFormatter.php index 6a47f5df..b1a406c0 100644 --- a/src/DocBlock/Tags/Formatter/AlignFormatter.php +++ b/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -1,4 +1,6 @@ - - * @copyright 2018 Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -16,6 +15,9 @@ use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use function max; +use function str_repeat; +use function strlen; class AlignFormatter implements Formatter { @@ -23,8 +25,6 @@ class AlignFormatter implements Formatter protected $maxLen = 0; /** - * Constructor. - * * @param Tag[] $tags All tags that should later be aligned with the formatter. */ public function __construct(array $tags) @@ -37,8 +37,13 @@ public function __construct(array $tags) /** * Formats the given tag to return a simple plain text version. */ - public function format(Tag $tag): string + public function format(Tag $tag) : string { - return '@' . $tag->getName() . str_repeat(' ', $this->maxLen - strlen($tag->getName()) + 1) . (string) $tag; + return '@' . $tag->getName() . + str_repeat( + ' ', + $this->maxLen - strlen($tag->getName()) + 1 + ) . + $tag; } } diff --git a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php index a143afa7..f26d22fb 100644 --- a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php +++ b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -15,14 +15,15 @@ use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; +use function trim; class PassthroughFormatter implements Formatter { /** * Formats the given tag to return a simple plain text version. */ - public function format(Tag $tag): string + public function format(Tag $tag) : string { - return trim('@' . $tag->getName() . ' ' . (string) $tag); + return trim('@' . $tag->getName() . ' ' . $tag); } } diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index 444bad43..713a10ca 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; +use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_match; /** * Parses a tag definition for a DocBlock. @@ -27,21 +29,20 @@ class Generic extends BaseTag implements Factory\StaticMethod /** * Parses a tag and populates the member variables. * - * @param string $name Name of the tag. + * @param string $name Name of the tag. * @param Description $description The contents of the given tag. */ public function __construct(string $name, ?Description $description = null) { $this->validateTagName($name); - $this->name = $name; + $this->name = $name; $this->description = $description; } /** * Creates a new tag that represents any unknown tag type. * - * * @return static */ public static function create( @@ -49,11 +50,11 @@ public static function create( string $name = '', ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); - $description = $descriptionFactory && $body !== "" ? $descriptionFactory->create($body, $context) : null; + $description = $descriptionFactory && $body !== '' ? $descriptionFactory->create($body, $context) : null; return new static($name, $description); } @@ -61,7 +62,7 @@ public static function create( /** * Returns the tag as a serialized string */ - public function __toString(): string + public function __toString() : string { return $this->description ? $this->description->render() : ''; } @@ -69,10 +70,10 @@ public function __toString(): string /** * Validates if the tag name matches the expected format, otherwise throws an exception. */ - private function validateTagName(string $name): void + private function validateTagName(string $name) : void { - if (! preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { - throw new \InvalidArgumentException( + if (!preg_match('/^' . StandardTagFactory::REGEX_TAGNAME . '$/u', $name)) { + throw new InvalidArgumentException( 'The tag name "' . $name . '" is not wellformed. Tags may only consist of letters, underscores, ' . 'hyphens and backslashes.' ); diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 45953ede..475357fd 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -1,14 +1,14 @@ - - * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; @@ -17,34 +17,39 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_split; /** * Reflection class for a @link tag in a Docblock. */ final class Link extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'link'; /** @var string */ - private $link = ''; + private $link; /** * Initializes a link to a URL. */ public function __construct(string $link, ?Description $description = null) { - $this->link = $link; + $this->link = $link; $this->description = $description; } /** * {@inheritdoc} */ - public static function create(string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null): self - { + public static function create( + string $body, + ?DescriptionFactory $descriptionFactory = null, + ?TypeContext $context = null + ) : self { Assert::notNull($descriptionFactory); - $parts = preg_split('/\s+/Su', $body, 2); + $parts = preg_split('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; return new static($parts[0], $description); @@ -53,7 +58,7 @@ public static function create(string $body, ?DescriptionFactory $descriptionFact /** * Gets the link */ - public function getLink(): string + public function getLink() : string { return $this->link; } @@ -61,7 +66,7 @@ public function getLink(): string /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return $this->link . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index e2ffb010..251cf039 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; +use InvalidArgumentException; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Type; @@ -20,12 +21,24 @@ use phpDocumentor\Reflection\Types\Context as TypeContext; use phpDocumentor\Reflection\Types\Void_; use Webmozart\Assert\Assert; +use function array_keys; +use function explode; +use function implode; +use function is_string; +use function preg_match; +use function sort; +use function strlen; +use function strpos; +use function substr; +use function trim; +use function var_export; /** * Reflection class for an {@}method in a Docblock. */ final class Method extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'method'; /** @var string */ @@ -40,11 +53,14 @@ final class Method extends BaseTag implements Factory\StaticMethod /** @var Type */ private $returnType; + /** + * @param mixed[][] $arguments $arguments + */ public function __construct( - $methodName, + string $methodName, array $arguments = [], ?Type $returnType = null, - $static = false, + bool $static = false, ?Description $description = null ) { Assert::stringNotEmpty($methodName); @@ -54,10 +70,10 @@ public function __construct( $returnType = new Void_(); } - $this->methodName = $methodName; - $this->arguments = $this->filterArguments($arguments); - $this->returnType = $returnType; - $this->isStatic = $static; + $this->methodName = $methodName; + $this->arguments = $this->filterArguments($arguments); + $this->returnType = $returnType; + $this->isStatic = $static; $this->description = $description; } @@ -69,7 +85,7 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): ?self { + ) : ?self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); @@ -131,7 +147,7 @@ public static function create( $returnType = 'void'; } - $returnType = $typeResolver->resolve($returnType, $context); + $returnType = $typeResolver->resolve($returnType, $context); $description = $descriptionFactory->create($description, $context); if (is_string($arguments) && strlen($arguments) > 0) { @@ -145,7 +161,7 @@ public static function create( $argumentType = $typeResolver->resolve($argument[0], $context); $argumentName = ''; if (isset($argument[1])) { - $argument[1] = self::stripRestArg($argument[1]); + $argument[1] = self::stripRestArg($argument[1]); $argumentName = substr($argument[1], 1); } } @@ -162,7 +178,7 @@ public static function create( /** * Retrieves the method name. */ - public function getMethodName(): string + public function getMethodName() : string { return $this->methodName; } @@ -170,7 +186,7 @@ public function getMethodName(): string /** * @return string[] */ - public function getArguments(): array + public function getArguments() : array { return $this->arguments; } @@ -180,17 +196,17 @@ public function getArguments(): array * * @return bool TRUE if the method declaration is for a static method, FALSE otherwise. */ - public function isStatic(): bool + public function isStatic() : bool { return $this->isStatic; } - public function getReturnType(): Type + public function getReturnType() : Type { return $this->returnType; } - public function __toString(): string + public function __toString() : string { $arguments = []; foreach ($this->arguments as $argument) { @@ -204,21 +220,26 @@ public function __toString(): string . ($this->description ? ' ' . $this->description->render() : '')); } - private function filterArguments(array $arguments = []): array + /** + * @param mixed[][] $arguments + * + * @return mixed[][] + */ + private function filterArguments(array $arguments = []) : array { foreach ($arguments as &$argument) { if (is_string($argument)) { $argument = ['name' => $argument]; } - if (! isset($argument['type'])) { + if (!isset($argument['type'])) { $argument['type'] = new Void_(); } $keys = array_keys($argument); sort($keys); if ($keys !== ['name', 'type']) { - throw new \InvalidArgumentException( + throw new InvalidArgumentException( 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) ); } @@ -227,7 +248,7 @@ private function filterArguments(array $arguments = []): array return $arguments; } - private static function stripRestArg(string $argument): string + private static function stripRestArg(string $argument) : string { if (strpos($argument, '...') === 0) { $argument = trim(substr($argument, 3)); diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 5ebf1e8e..5d02cb6b 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,6 +19,13 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use const PREG_SPLIT_DELIM_CAPTURE; +use function array_shift; +use function implode; +use function preg_split; +use function strlen; +use function strpos; +use function substr; /** * Reflection class for the {@}param tag in a Docblock. @@ -37,12 +44,16 @@ final class Param extends BaseTag implements Factory\StaticMethod /** @var bool determines whether this is a variadic argument */ private $isVariadic = false; - public function __construct(string $variableName, ?Type $type = null, bool $isVariadic = false, ?Description $description = null) - { + public function __construct( + string $variableName, + ?Type $type = null, + bool $isVariadic = false, + ?Description $description = null + ) { $this->variableName = $variableName; - $this->type = $type; - $this->isVariadic = $isVariadic; - $this->description = $description; + $this->type = $type; + $this->isVariadic = $isVariadic; + $this->description = $description; } /** @@ -53,14 +64,14 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; - $isVariadic = false; + $isVariadic = false; // if the first item that is encountered is not a variable; it is a type if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { @@ -69,12 +80,14 @@ public static function create( } // if the next item starts with a $ or ...$ it must be the variable name - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$' || substr($parts[0], 0, 4) === '...$')) { + if (isset($parts[0]) && (strlen($parts[0]) > 0) && + (strpos($parts[0], '$') === 0 || strpos($parts[0], '...$') === 0) + ) { $variableName = array_shift($parts); array_shift($parts); if (substr($variableName, 0, 3) === '...') { - $isVariadic = true; + $isVariadic = true; $variableName = substr($variableName, 3); } @@ -91,7 +104,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName(): string + public function getVariableName() : string { return $this->variableName; } @@ -99,7 +112,7 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. */ - public function getType(): ?Type + public function getType() : ?Type { return $this->type; } @@ -107,7 +120,7 @@ public function getType(): ?Type /** * Returns whether this tag is variadic. */ - public function isVariadic(): bool + public function isVariadic() : bool { return $this->isVariadic; } @@ -115,11 +128,11 @@ public function isVariadic(): bool /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . ($this->isVariadic() ? '...' : '') - . '$' . $this->variableName - . ($this->description ? ' ' . $this->description : ''); + . ($this->isVariadic() ? '...' : '') + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index c1316be8..a81b3f05 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,6 +19,12 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use const PREG_SPLIT_DELIM_CAPTURE; +use function array_shift; +use function implode; +use function preg_split; +use function strlen; +use function substr; /** * Reflection class for a {@}property tag in a Docblock. @@ -37,8 +43,8 @@ class Property extends BaseTag implements Factory\StaticMethod public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -49,12 +55,12 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type @@ -81,7 +87,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName(): string + public function getVariableName() : string { return $this->variableName; } @@ -89,7 +95,7 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. */ - public function getType(): ?Type + public function getType() : ?Type { return $this->type; } @@ -97,10 +103,10 @@ public function getType(): ?Type /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . '$' . $this->variableName - . ($this->description ? ' ' . $this->description : ''); + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index e1dd1cb1..f98e3322 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,6 +19,12 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use const PREG_SPLIT_DELIM_CAPTURE; +use function array_shift; +use function implode; +use function preg_split; +use function strlen; +use function substr; /** * Reflection class for a {@}property-read tag in a Docblock. @@ -37,8 +43,8 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -49,12 +55,12 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type @@ -81,7 +87,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName(): string + public function getVariableName() : string { return $this->variableName; } @@ -89,7 +95,7 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. */ - public function getType(): ?Type + public function getType() : ?Type { return $this->type; } @@ -97,10 +103,10 @@ public function getType(): ?Type /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . '$' . $this->variableName - . ($this->description ? ' ' . $this->description : ''); + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 846e30aa..8e45ab84 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,6 +19,12 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use const PREG_SPLIT_DELIM_CAPTURE; +use function array_shift; +use function implode; +use function preg_split; +use function strlen; +use function substr; /** * Reflection class for a {@}property-write tag in a Docblock. @@ -37,8 +43,8 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -49,12 +55,12 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type @@ -81,7 +87,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName(): string + public function getVariableName() : string { return $this->variableName; } @@ -89,7 +95,7 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. */ - public function getType(): ?Type + public function getType() : ?Type { return $this->type; } @@ -97,10 +103,10 @@ public function getType(): ?Type /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . '$' . $this->variableName - . ($this->description ? ' ' . $this->description : ''); + . '$' . $this->variableName + . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/Reference/Fqsen.php b/src/DocBlock/Tags/Reference/Fqsen.php index 748ea3cc..cede74c1 100644 --- a/src/DocBlock/Tags/Reference/Fqsen.php +++ b/src/DocBlock/Tags/Reference/Fqsen.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; @@ -16,18 +16,13 @@ use phpDocumentor\Reflection\Fqsen as RealFqsen; /** - * Fqsen reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See} + * Fqsen reference used by {@see \phpDocumentor\Reflection\DocBlock\Tags\See} */ final class Fqsen implements Reference { - /** - * @var RealFqsen - */ + /** @var RealFqsen */ private $fqsen; - /** - * Fqsen constructor. - */ public function __construct(RealFqsen $fqsen) { $this->fqsen = $fqsen; @@ -36,7 +31,7 @@ public function __construct(RealFqsen $fqsen) /** * @return string string representation of the referenced fqsen */ - public function __toString(): string + public function __toString() : string { return (string) $this->fqsen; } diff --git a/src/DocBlock/Tags/Reference/Reference.php b/src/DocBlock/Tags/Reference/Reference.php index 39501967..5eedcbc3 100644 --- a/src/DocBlock/Tags/Reference/Reference.php +++ b/src/DocBlock/Tags/Reference/Reference.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; /** - * Interface for references in {@see phpDocumentor\Reflection\DocBlock\Tags\See} + * Interface for references in {@see \phpDocumentor\Reflection\DocBlock\Tags\See} */ interface Reference { - public function __toString(): string; + public function __toString() : string; } diff --git a/src/DocBlock/Tags/Reference/Url.php b/src/DocBlock/Tags/Reference/Url.php index 698d0321..1b2374b9 100644 --- a/src/DocBlock/Tags/Reference/Url.php +++ b/src/DocBlock/Tags/Reference/Url.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; @@ -16,25 +16,20 @@ use Webmozart\Assert\Assert; /** - * Url reference used by {@see phpDocumentor\Reflection\DocBlock\Tags\See} + * Url reference used by {@see \phpDocumentor\Reflection\DocBlock\Tags\See} */ final class Url implements Reference { - /** - * @var string - */ + /** @var string */ private $uri; - /** - * Url constructor. - */ public function __construct(string $uri) { Assert::stringNotEmpty($uri); $this->uri = $uri; } - public function __toString(): string + public function __toString() : string { return $this->uri; } diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index ae1d2e1e..dac50365 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,12 +19,14 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_split; /** * Reflection class for a {@}return tag in a Docblock. */ final class Return_ extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'return'; /** @var Type */ @@ -32,7 +34,7 @@ final class Return_ extends BaseTag implements Factory\StaticMethod public function __construct(Type $type, ?Description $description = null) { - $this->type = $type; + $this->type = $type; $this->description = $description; } @@ -44,12 +46,12 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::allNotNull([$typeResolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); - $type = $typeResolver->resolve($parts[0] ?? '', $context); + $type = $typeResolver->resolve($parts[0] ?? '', $context); $description = $descriptionFactory->create($parts[1] ?? '', $context); return new static($type, $description); @@ -58,12 +60,12 @@ public static function create( /** * Returns the type section of the variable. */ - public function getType(): Type + public function getType() : Type { return $this->type; } - public function __toString(): string + public function __toString() : string { return $this->type . ' ' . $this->description; } diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index bc98297b..218309e0 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; @@ -21,12 +21,15 @@ use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_match; +use function preg_split; /** * Reflection class for an {@}see tag in a Docblock. */ class See extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'see'; /** @var Reference */ @@ -37,7 +40,7 @@ class See extends BaseTag implements Factory\StaticMethod */ public function __construct(Reference $refers, ?Description $description = null) { - $this->refers = $refers; + $this->refers = $refers; $this->description = $description; } @@ -49,10 +52,10 @@ public static function create( ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::allNotNull([$resolver, $descriptionFactory]); - $parts = preg_split('/\s+/Su', $body, 2); + $parts = preg_split('/\s+/Su', $body, 2); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; // https://tools.ietf.org/html/rfc2396#section-3 @@ -66,7 +69,7 @@ public static function create( /** * Returns the ref of this tag. */ - public function getReference(): Reference + public function getReference() : Reference { return $this->refers; } @@ -74,7 +77,7 @@ public function getReference(): Reference /** * Returns a string representation of this tag. */ - public function __toString(): string + public function __toString() : string { return $this->refers . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 5af7dc24..4b967961 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -17,12 +17,14 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_match; /** * Reflection class for a {@}since tag in a Docblock. */ final class Since extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'since'; /** @@ -44,11 +46,11 @@ final class Since extends BaseTag implements Factory\StaticMethod /** @var string The version vector. */ private $version = ''; - public function __construct($version = null, ?Description $description = null) + public function __construct(?string $version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); - $this->version = $version; + $this->version = $version; $this->description = $description; } @@ -56,13 +58,13 @@ public static function create( ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): ?self { + ) : ?self { if (empty($body)) { return new static(); } $matches = []; - if (! preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { + if (!preg_match('/^(' . self::REGEX_VECTOR . ')\s*(.+)?$/sux', $body, $matches)) { return null; } @@ -75,7 +77,7 @@ public static function create( /** * Gets the version section of the tag. */ - public function getVersion(): ?string + public function getVersion() : ?string { return $this->version; } @@ -83,7 +85,7 @@ public function getVersion(): ?string /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return $this->version . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index d63fb8af..c6286fde 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -17,6 +17,7 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_match; /** * Reflection class for a {@}source tag in a Docblock. @@ -32,14 +33,18 @@ final class Source extends BaseTag implements Factory\StaticMethod /** @var int|null The number of lines, relative to the starting line. NULL means "to the end". */ private $lineCount; + /** + * @param int|string $startingLine should be a to int convertible value + * @param int|string|null $lineCount should be a to int convertible value + */ public function __construct($startingLine, $lineCount = null, ?Description $description = null) { Assert::integerish($startingLine); Assert::nullOrIntegerish($lineCount); $this->startingLine = (int) $startingLine; - $this->lineCount = $lineCount !== null ? (int) $lineCount : null; - $this->description = $description; + $this->lineCount = $lineCount !== null ? (int) $lineCount : null; + $this->description = $description; } /** @@ -49,13 +54,13 @@ public static function create( string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($body); Assert::notNull($descriptionFactory); $startingLine = 1; - $lineCount = null; - $description = null; + $lineCount = null; + $description = null; // Starting line / Number of lines / Description if (preg_match('/^([1-9]\d*)\s*(?:((?1))\s+)?(.*)$/sux', $body, $matches)) { @@ -76,7 +81,7 @@ public static function create( * @return int The starting line, relative to the structural element's * location. */ - public function getStartingLine(): int + public function getStartingLine() : int { return $this->startingLine; } @@ -87,15 +92,15 @@ public function getStartingLine(): int * @return int|null The number of lines, relative to the starting line. NULL * means "to the end". */ - public function getLineCount(): ?int + public function getLineCount() : ?int { return $this->lineCount; } - public function __toString(): string + public function __toString() : string { return $this->startingLine - . ($this->lineCount !== null ? ' ' . $this->lineCount : '') - . ($this->description ? ' ' . $this->description->render() : ''); + . ($this->lineCount !== null ? ' ' . $this->lineCount : '') + . ($this->description ? ' ' . $this->description->render() : ''); } } diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 3e357083..7ac2b426 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,12 +19,14 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_split; /** * Reflection class for a {@}throws tag in a Docblock. */ final class Throws extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'throws'; /** @var Type */ @@ -32,7 +34,7 @@ final class Throws extends BaseTag implements Factory\StaticMethod public function __construct(Type $type, ?Description $description = null) { - $this->type = $type; + $this->type = $type; $this->description = $description; } @@ -44,12 +46,12 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::allNotNull([$typeResolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); - $type = $typeResolver->resolve($parts[0] ?? '', $context); + $type = $typeResolver->resolve($parts[0] ?? '', $context); $description = $descriptionFactory->create($parts[1] ?? '', $context); return new static($type, $description); @@ -58,12 +60,12 @@ public static function create( /** * Returns the type section of the variable. */ - public function getType(): Type + public function getType() : Type { return $this->type; } - public function __toString(): string + public function __toString() : string { return $this->type . ' ' . $this->description; } diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 50fb36d5..24c74dcc 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; @@ -19,12 +19,14 @@ use phpDocumentor\Reflection\FqsenResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_split; /** * Reflection class for a {@}uses tag in a Docblock. */ final class Uses extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'uses'; /** @var Fqsen */ @@ -35,7 +37,7 @@ final class Uses extends BaseTag implements Factory\StaticMethod */ public function __construct(Fqsen $refers, ?Description $description = null) { - $this->refers = $refers; + $this->refers = $refers; $this->description = $description; } @@ -47,7 +49,7 @@ public static function create( ?FqsenResolver $resolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::allNotNull([$resolver, $descriptionFactory]); $parts = preg_split('/\s+/Su', $body, 2); @@ -61,7 +63,7 @@ public static function create( /** * Returns the structural element this tag refers to. */ - public function getReference(): Fqsen + public function getReference() : Fqsen { return $this->refers; } @@ -69,7 +71,7 @@ public function getReference(): Fqsen /** * Returns a string representation of this tag. */ - public function __toString(): string + public function __toString() : string { return $this->refers . ' ' . $this->description->render(); } diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index eb7d41c0..e39d4e00 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,6 +19,12 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use const PREG_SPLIT_DELIM_CAPTURE; +use function array_shift; +use function implode; +use function preg_split; +use function strlen; +use function substr; /** * Reflection class for a {@}var tag in a Docblock. @@ -37,8 +43,8 @@ class Var_ extends BaseTag implements Factory\StaticMethod public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -49,12 +55,12 @@ public static function create( ?TypeResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): self { + ) : self { Assert::stringNotEmpty($body); Assert::allNotNull([$typeResolver, $descriptionFactory]); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type @@ -81,7 +87,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName(): string + public function getVariableName() : string { return $this->variableName; } @@ -89,7 +95,7 @@ public function getVariableName(): string /** * Returns the variable's type or null if unknown. */ - public function getType(): ?Type + public function getType() : ?Type { return $this->type; } @@ -97,7 +103,7 @@ public function getType(): ?Type /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return ($this->type ? $this->type . ' ' : '') . (empty($this->variableName) ? null : ('$' . $this->variableName)) diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 1710adf7..5a50283e 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -1,14 +1,14 @@ - - * @copyright 2010-2018 Mike van Riel / Naenius (http://www.naenius.com) - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; @@ -17,12 +17,14 @@ use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; +use function preg_match; /** * Reflection class for a {@}version tag in a Docblock. */ final class Version extends BaseTag implements Factory\StaticMethod { + /** @var string */ protected $name = 'version'; /** @@ -44,11 +46,11 @@ final class Version extends BaseTag implements Factory\StaticMethod /** @var string The version vector. */ private $version = ''; - public function __construct($version = null, ?Description $description = null) + public function __construct(?string $version = null, ?Description $description = null) { Assert::nullOrStringNotEmpty($version); - $this->version = $version; + $this->version = $version; $this->description = $description; } @@ -56,7 +58,7 @@ public static function create( ?string $body, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null - ): ?self { + ) : ?self { if (empty($body)) { return new static(); } @@ -75,7 +77,7 @@ public static function create( /** * Gets the version section of the tag. */ - public function getVersion(): ?string + public function getVersion() : ?string { return $this->version; } @@ -83,7 +85,7 @@ public function getVersion(): ?string /** * Returns a string representation for this tag. */ - public function __toString(): string + public function __toString() : string { return $this->version . ($this->description ? ' ' . $this->description->render() : ''); } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 4383bc53..d046a650 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection; +use InvalidArgumentException; +use LogicException; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; use Webmozart\Assert\Assert; +use function array_filter; +use function array_shift; +use function count; +use function explode; +use function is_object; +use function method_exists; +use function preg_match; +use function preg_replace; +use function str_replace; +use function strpos; +use function substr; +use function trim; final class DocBlockFactory implements DocBlockFactoryInterface { @@ -33,7 +47,7 @@ final class DocBlockFactory implements DocBlockFactoryInterface public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory) { $this->descriptionFactory = $descriptionFactory; - $this->tagFactory = $tagFactory; + $this->tagFactory = $tagFactory; } /** @@ -41,10 +55,10 @@ public function __construct(DescriptionFactory $descriptionFactory, TagFactory $ * * @param string[] $additionalTags */ - public static function createInstance(array $additionalTags = []): self + public static function createInstance(array $additionalTags = []) : self { - $fqsenResolver = new FqsenResolver(); - $tagFactory = new StandardTagFactory($fqsenResolver); + $fqsenResolver = new FqsenResolver(); + $tagFactory = new StandardTagFactory($fqsenResolver); $descriptionFactory = new DescriptionFactory($tagFactory); $tagFactory->addService($descriptionFactory); @@ -62,12 +76,12 @@ public static function createInstance(array $additionalTags = []): self * @param object|string $docblock A string containing the DocBlock to parse or an object supporting the * getDocComment method (such as a ReflectionClass object). */ - public function create($docblock, ?Types\Context $context = null, ?Location $location = null): DocBlock + public function create($docblock, ?Types\Context $context = null, ?Location $location = null) : DocBlock { if (is_object($docblock)) { if (!method_exists($docblock, 'getDocComment')) { $exceptionMessage = 'Invalid object passed; the given object must support the getDocComment method'; - throw new \InvalidArgumentException($exceptionMessage); + throw new InvalidArgumentException($exceptionMessage); } $docblock = $docblock->getDocComment(); @@ -80,14 +94,18 @@ public function create($docblock, ?Types\Context $context = null, ?Location $loc } $parts = $this->splitDocBlock($this->stripDocComment($docblock)); + [$templateMarker, $summary, $description, $tags] = $parts; return new DocBlock( $summary, $description ? $this->descriptionFactory->create($description, $context) : null, - array_filter($this->parseTagBlock($tags, $context), function ($tag) { - return $tag instanceof Tag; - }), + array_filter( + $this->parseTagBlock($tags, $context), + static function ($tag) { + return $tag instanceof Tag; + } + ), $context, $location, $templateMarker === '#@+', @@ -95,7 +113,7 @@ public function create($docblock, ?Types\Context $context = null, ?Location $loc ); } - public function registerTagHandler($tagName, $handler): void + public function registerTagHandler(string $tagName, string $handler) : void { $this->tagFactory->registerTagHandler($tagName, $handler); } @@ -105,9 +123,11 @@ public function registerTagHandler($tagName, $handler): void * * @param string $comment String containing the comment text. */ - private function stripDocComment(string $comment): string + private function stripDocComment(string $comment) : string { - $comment = trim(preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment)); + /** @var string $comment */ + $comment = preg_replace('#[ \t]*(?:\/\*\*|\*\/|\*)?[ \t]{0,1}(.*)?#u', '$1', $comment); + $comment = trim($comment); // reg ex above is not able to remove */ from a single line docblock if (substr($comment, -2) === '*/') { @@ -117,17 +137,19 @@ private function stripDocComment(string $comment): string return str_replace(["\r\n", "\r"], "\n", $comment); } + // phpcs:disable SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden /** * Splits the DocBlock into a template marker, summary, description and block of tags. * * @param string $comment Comment to split into the sub-parts. * - * @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split. + * @return string[] containing the template marker (if any), summary, description and a string containing the tags. + * * @author Mike van Riel for extending the regex with template marker support. * - * @return string[] containing the template marker (if any), summary, description and a string containing the tags. + * @author Richard van Velzen (@_richardJ) Special thanks to Richard for the regex responsible for the split. */ - private function splitDocBlock(string $comment): array + 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 @@ -137,6 +159,7 @@ private function splitDocBlock(string $comment): array } // clears all extra horizontal whitespace from the line endings to prevent parsing issues + /** @var string $comment */ $comment = preg_replace('/\h*$/Sum', '', $comment); /* @@ -204,15 +227,15 @@ private function splitDocBlock(string $comment): array /** * Creates the tag objects. * - * @param string $tags Tag block to parse. + * @param string $tags Tag block to parse. * @param Types\Context $context Context of the parsed Tag * * @return DocBlock\Tag[]|string[]|null[] */ - private function parseTagBlock(string $tags, Types\Context $context): array + private function parseTagBlock(string $tags, Types\Context $context) : array { $tags = $this->filterTagBlock($tags); - if (!$tags) { + if ($tags === null) { return []; } @@ -227,7 +250,7 @@ private function parseTagBlock(string $tags, Types\Context $context): array /** * @return string[] */ - private function splitTagBlockIntoTagLines(string $tags): array + private function splitTagBlockIntoTagLines(string $tags) : array { $result = []; foreach (explode("\n", $tags) as $tag_line) { @@ -241,18 +264,18 @@ private function splitTagBlockIntoTagLines(string $tags): array return $result; } - private function filterTagBlock($tags): ?string + private function filterTagBlock(string $tags) : ?string { $tags = trim($tags); if (!$tags) { return null; } - if ('@' !== $tags[0]) { + if ($tags[0] !== '@') { // @codeCoverageIgnoreStart // Can't simulate this; this only happens if there is an error with the parsing of the DocBlock that // we didn't foresee. - throw new \LogicException('A tag block started with text instead of an at-sign(@): ' . $tags); + throw new LogicException('A tag block started with text instead of an at-sign(@): ' . $tags); // @codeCoverageIgnoreEnd } diff --git a/src/DocBlockFactoryInterface.php b/src/DocBlockFactoryInterface.php index 4f665dd6..c1619569 100644 --- a/src/DocBlockFactoryInterface.php +++ b/src/DocBlockFactoryInterface.php @@ -1,7 +1,10 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/InterpretingDocBlocksTest.php b/tests/integration/InterpretingDocBlocksTest.php index ffec7ad9..7ef37ba2 100644 --- a/tests/integration/InterpretingDocBlocksTest.php +++ b/tests/integration/InterpretingDocBlocksTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/ReconstitutingADocBlockTest.php b/tests/integration/ReconstitutingADocBlockTest.php index c8eda66f..02da4def 100644 --- a/tests/integration/ReconstitutingADocBlockTest.php +++ b/tests/integration/ReconstitutingADocBlockTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/integration/UsingTagsTest.php b/tests/integration/UsingTagsTest.php index eb5d4295..eb463d8d 100644 --- a/tests/integration/UsingTagsTest.php +++ b/tests/integration/UsingTagsTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php index 0f8376f5..e10978e5 100644 --- a/tests/unit/DocBlock/DescriptionFactoryTest.php +++ b/tests/unit/DocBlock/DescriptionFactoryTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; use Mockery as m; -use phpDocumentor\Reflection\DocBlock\Tags\Link; +use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; @@ -27,103 +27,108 @@ class DescriptionFactoryTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description * @dataProvider provideSimpleExampleDescriptions */ - public function testDescriptionCanParseASimpleString($contents): void + public function testDescriptionCanParseASimpleString(string $contents) : void { $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, new Context('')); $this->assertSame($contents, $description->render()); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description * @dataProvider provideEscapeSequences */ - public function testEscapeSequences($contents, $expected): void + public function testEscapeSequences(string $contents, string $expected) : void { $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->never(); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, new Context('')); $this->assertSame($expected, $description->render()); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\Types\Context + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\Tags\Link - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter - * @uses phpDocumentor\Reflection\Types\Context */ - public function testDescriptionCanParseAStringWithInlineTag(): void + public function testDescriptionCanParseAStringWithInlineTag() : void { - $contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'; - $context = new Context(''); + $contents = 'This is text for a {@link http://phpdoc.org/ description} that uses an inline tag.'; + $context = new Context(''); $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create') ->once() ->with('@link http://phpdoc.org/ description', $context) - ->andReturn(new Link('http://phpdoc.org/', new Description('description'))); + ->andReturn(new LinkTag('http://phpdoc.org/', new Description('description'))); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, $context); $this->assertSame($contents, $description->render()); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\Types\Context + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\Tags\Link - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter - * @uses phpDocumentor\Reflection\Types\Context */ - public function testDescriptionCanParseAStringStartingWithInlineTag(): void + public function testDescriptionCanParseAStringStartingWithInlineTag() : void { - $contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'; - $context = new Context(''); + $contents = '{@link http://phpdoc.org/ This} is text for a description that starts with an inline tag.'; + $context = new Context(''); $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create') ->once() ->with('@link http://phpdoc.org/ This', $context) - ->andReturn(new Link('http://phpdoc.org/', new Description('This'))); + ->andReturn(new LinkTag('http://phpdoc.org/', new Description('This'))); - $factory = new DescriptionFactory($tagFactory); + $factory = new DescriptionFactory($tagFactory); $description = $factory->create($contents, $context); $this->assertSame($contents, $description->render()); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testIfSuperfluousStartingSpacesAreRemoved(): void + public function testIfSuperfluousStartingSpacesAreRemoved() : void { - $factory = new DescriptionFactory(m::mock(TagFactory::class)); + $factory = new DescriptionFactory(m::mock(TagFactory::class)); $descriptionText = << - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -26,23 +26,24 @@ class DescriptionTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** - * @covers ::__construct - * @covers ::render * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * + * @covers ::__construct + * @covers ::render */ - public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags(): void + public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags() : void { - $body = 'This is a %1$s body.'; + $body = 'This is a %1$s body.'; $expected = 'This is a {@internal significant} body.'; - $tags = [new Generic('internal', new Description('significant '))]; + $tags = [new Generic('internal', new Description('significant '))]; $fixture = new Description($body, $tags); @@ -56,18 +57,19 @@ public function testDescriptionCanRenderUsingABodyWithPlaceholdersAndTags(): voi } /** - * @covers ::__construct - * @covers ::render - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * + * @covers ::__construct + * @covers ::render + * @covers ::__toString */ - public function testDescriptionCanBeCastToString(): void + public function testDescriptionCanBeCastToString() : void { - $body = 'This is a %1$s body.'; + $body = 'This is a %1$s body.'; $expected = 'This is a {@internal significant} body.'; - $tags = [new Generic('internal', new Description('significant '))]; + $tags = [new Generic('internal', new Description('significant '))]; $fixture = new Description($body, $tags); @@ -75,11 +77,12 @@ public function testDescriptionCanBeCastToString(): void } /** - * @covers ::getTags * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * + * @covers ::getTags */ - public function testDescriptionTagsGetter(): void + public function testDescriptionTagsGetter() : void { $body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s)'; @@ -102,14 +105,15 @@ public function testDescriptionTagsGetter(): void } /** - * @covers ::__construct - * @covers ::render - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * + * @covers ::__construct + * @covers ::render + * @covers ::__toString */ - public function testDescriptionMultipleTagsCanBeCastToString(): void + public function testDescriptionMultipleTagsCanBeCastToString() : void { $body = '@JoinTable(name="table", joinColumns=%1$s, inverseJoinColumns=%2$s)'; @@ -121,8 +125,9 @@ public function testDescriptionMultipleTagsCanBeCastToString(): void $tag2, ]; - $fixture = new Description($body, $tags); - $expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})'; + $fixture = new Description($body, $tags); + $expected = '@JoinTable(name="table", joinColumns={@JoinColumn (name="column_id", referencedColumnName="id")}, ' + . 'inverseJoinColumns={@JoinColumn (name="column_id_2", referencedColumnName="id")})'; $this->assertSame($expected, (string) $fixture); } } diff --git a/tests/unit/DocBlock/ExampleFinderTest.php b/tests/unit/DocBlock/ExampleFinderTest.php index 01a8a8c6..19a32f18 100644 --- a/tests/unit/DocBlock/ExampleFinderTest.php +++ b/tests/unit/DocBlock/ExampleFinderTest.php @@ -1,4 +1,6 @@ - */ class ExampleFinderTest extends TestCase @@ -18,23 +20,24 @@ class ExampleFinderTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } - public function setUp(): void + public function setUp() : void { $this->fixture = new ExampleFinder(); } /** - * @covers ::find - * @covers ::getSourceDirectory * @uses \phpDocumentor\Reflection\DocBlock\Tags\Example * @uses \phpDocumentor\Reflection\DocBlock\Description + * + * @covers ::find + * @covers ::getSourceDirectory */ - public function testFileNotFound(): void + public function testFileNotFound() : void { $example = new Example('./example.php', false, 1, 0, new Description('Test')); $this->assertSame('** File not found : ./example.php **', $this->fixture->find($example)); diff --git a/tests/unit/DocBlock/SerializerTest.php b/tests/unit/DocBlock/SerializerTest.php index adfd8f93..967dace9 100644 --- a/tests/unit/DocBlock/SerializerTest.php +++ b/tests/unit/DocBlock/SerializerTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -26,21 +26,22 @@ class SerializerTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * * @covers ::__construct * @covers ::getDocComment - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter - * @uses phpDocumentor\Reflection\DocBlock - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testReconstructsADocCommentFromADocBlock(): void + public function testReconstructsADocCommentFromADocBlock() : void { $expected = <<<'DOCCOMMENT' /** @@ -66,15 +67,16 @@ public function testReconstructsADocCommentFromADocBlock(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * * @covers ::__construct * @covers ::getDocComment - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter - * @uses phpDocumentor\Reflection\DocBlock - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testAddPrefixToDocBlock(): void + public function testAddPrefixToDocBlock() : void { $expected = <<<'DOCCOMMENT' aa/** @@ -100,15 +102,16 @@ public function testAddPrefixToDocBlock(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * * @covers ::__construct * @covers ::getDocComment - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter - * @uses phpDocumentor\Reflection\DocBlock - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testAddPrefixToDocBlockExceptFirstLine(): void + public function testAddPrefixToDocBlockExceptFirstLine() : void { $expected = <<<'DOCCOMMENT' /** @@ -134,15 +137,16 @@ public function testAddPrefixToDocBlockExceptFirstLine(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * * @covers ::__construct * @covers ::getDocComment - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter - * @uses phpDocumentor\Reflection\DocBlock - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic */ - public function testWordwrapsAroundTheGivenAmountOfCharacters(): void + public function testWordwrapsAroundTheGivenAmountOfCharacters() : void { $expected = <<<'DOCCOMMENT' /** @@ -177,7 +181,7 @@ public function testWordwrapsAroundTheGivenAmountOfCharacters(): void * @covers ::__construct * @covers ::getDocComment */ - public function testNoExtraSpacesAfterTagRemoval() + public function testNoExtraSpacesAfterTagRemoval() : void { $expected = <<<'DOCCOMMENT' /** @@ -190,7 +194,7 @@ public function testNoExtraSpacesAfterTagRemoval() */ DOCCOMMENT_AFTER_REMOVE; - $fixture = new Serializer(0, '', true, 15); + $fixture = new Serializer(0, '', true, 15); $genericTag = new DocBlock\Tags\Generic('unknown-tag'); $docBlock = new DocBlock('', null, [$genericTag]); diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index e6647c71..5e4ee4cb 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; @@ -27,7 +27,7 @@ use PHPUnit\Framework\TestCase; /** - * @coversDefaultClass phpDocumentor\Reflection\DocBlock\StandardTagFactory + * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\StandardTagFactory * @covers :: */ class StandardTagFactoryTest extends TestCase @@ -35,25 +35,26 @@ class StandardTagFactoryTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @uses phpDocumentor\Reflection\DocBlock\Tags\Generic - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreatingAGenericTag(): void + public function testCreatingAGenericTag() : void { - $expectedTagName = 'unknown-tag'; + $expectedTagName = 'unknown-tag'; $expectedDescriptionText = 'This is a description'; - $expectedDescription = new Description($expectedDescriptionText); - $context = new Context(''); + $expectedDescription = new Description($expectedDescriptionText); + $context = new Context(''); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory @@ -74,15 +75,16 @@ public function testCreatingAGenericTag(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @uses phpDocumentor\Reflection\DocBlock\Tags\Author - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testCreatingASpecificTag(): void + public function testCreatingASpecificTag() : void { - $context = new Context(''); + $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); /** @var Author $tag */ @@ -93,18 +95,19 @@ public function testCreatingASpecificTag(): void } /** - * @covers ::__construct - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService * @uses \phpDocumentor\Reflection\DocBlock\Tags\See * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen + * + * @covers ::__construct + * @covers ::create */ - public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void + public function testAnEmptyContextIsCreatedIfNoneIsProvided() : void { - $fqsen = '\Tag'; - $resolver = m::mock(FqsenResolver::class) + $fqsen = '\Tag'; + $resolver = m::mock(FqsenResolver::class) ->shouldReceive('resolve') ->with('Tag', m::type(Context::class)) ->andReturn(new Fqsen($fqsen)) @@ -123,15 +126,16 @@ public function testAnEmptyContextIsCreatedIfNoneIsProvided(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @uses phpDocumentor\Reflection\DocBlock\Tags\Author - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testPassingYourOwnSetOfTagHandlers(): void + public function testPassingYourOwnSetOfTagHandlers() : void { - $context = new Context(''); + $context = new Context(''); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class), ['user' => Author::class]); /** @var Author $tag */ @@ -142,26 +146,30 @@ public function testPassingYourOwnSetOfTagHandlers(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testExceptionIsThrownIfProvidedTagIsNotWellformed(): void + public function testExceptionIsThrownIfProvidedTagIsNotWellformed() : void { $this->expectException('InvalidArgumentException'); - $this->expectExceptionMessage('The tag "@user[myuser" does not seem to be wellformed, please check it for errors'); + $this->expectExceptionMessage( + 'The tag "@user[myuser" does not seem to be wellformed, please check it for errors' + ); $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); $tagFactory->create('@user[myuser'); } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * * @covers ::__construct * @covers ::addParameter - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testAddParameterToServiceLocator(): void + public function testAddParameterToServiceLocator() : void { - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addParameter('myParam', 'myValue'); @@ -173,14 +181,15 @@ public function testAddParameterToServiceLocator(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * * @covers ::addService - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct */ - public function testAddServiceToServiceLocator(): void + public function testAddServiceToServiceLocator() : void { $service = new PassthroughFormatter(); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addService($service); @@ -192,15 +201,16 @@ public function testAddServiceToServiceLocator(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * * @covers ::addService - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct */ - public function testInjectConcreteServiceForInterfaceToServiceLocator(): void + public function testInjectConcreteServiceForInterfaceToServiceLocator() : void { $interfaceName = Formatter::class; - $service = new PassthroughFormatter(); + $service = new PassthroughFormatter(); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->addService($service, $interfaceName); @@ -212,15 +222,16 @@ public function testInjectConcreteServiceForInterfaceToServiceLocator(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author + * * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::create - * @uses phpDocumentor\Reflection\DocBlock\Tags\Author */ - public function testRegisteringAHandlerForANewTag(): void + public function testRegisteringAHandlerForANewTag() : void { - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', Author::class); @@ -231,66 +242,72 @@ public function testRegisteringAHandlerForANewTag(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified(): void + public function testHandlerRegistrationFailsIfProvidedTagNameIsNamespaceButNotFullyQualified() : void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); + // phpcs:ignore SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName $tagFactory->registerTagHandler(\Name\Spaced\Tag::class, Author::class); } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty(): void + public function testHandlerRegistrationFailsIfProvidedHandlerIsEmpty() : void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', ''); } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName(): void + public function testHandlerRegistrationFailsIfProvidedHandlerIsNotAnExistingClassName() : void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', 'IDoNotExist'); } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * * @covers ::registerTagHandler - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService */ - public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface(): void + public function testHandlerRegistrationFailsIfProvidedHandlerDoesNotImplementTheTagInterface() : void { $this->expectException('InvalidArgumentException'); - $resolver = m::mock(FqsenResolver::class); + $resolver = m::mock(FqsenResolver::class); $tagFactory = new StandardTagFactory($resolver); $tagFactory->registerTagHandler('my-tag', 'stdClass'); } /** + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct + * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService + * @uses \phpDocumentor\Reflection\Docblock\Description + * @uses \phpDocumentor\Reflection\Docblock\Tags\Return_ + * @uses \phpDocumentor\Reflection\Docblock\Tags\BaseTag + * * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct - * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::addService - * @uses phpDocumentor\Reflection\Docblock\Description - * @uses phpDocumentor\Reflection\Docblock\Tags\Return_ - * @uses phpDocumentor\Reflection\Docblock\Tags\BaseTag */ - public function testReturntagIsMappedCorrectly(): void + public function testReturnTagIsMappedCorrectly() : void { $context = new Context(''); diff --git a/tests/unit/DocBlock/Tags/AuthorTest.php b/tests/unit/DocBlock/Tags/AuthorTest.php index 088c236c..59e4cdad 100644 --- a/tests/unit/DocBlock/Tags/AuthorTest.php +++ b/tests/unit/DocBlock/Tags/AuthorTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -25,16 +25,17 @@ class AuthorTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -45,10 +46,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -57,9 +59,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -73,7 +76,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getAuthorName */ - public function testHasTheAuthorName(): void + public function testHasTheAuthorName() : void { $expected = 'Mike van Riel'; @@ -86,7 +89,7 @@ public function testHasTheAuthorName(): void * @covers ::__construct * @covers ::getEmail */ - public function testHasTheAuthorMailAddress(): void + public function testHasTheAuthorMailAddress() : void { $expected = 'mike@phpdoc.org'; @@ -98,7 +101,7 @@ public function testHasTheAuthorMailAddress(): void /** * @covers ::__construct */ - public function testInitializationFailsIfEmailIsNotValid(): void + public function testInitializationFailsIfEmailIsNotValid() : void { $this->expectException('InvalidArgumentException'); new Author('Mike van Riel', 'mike'); @@ -108,7 +111,7 @@ public function testInitializationFailsIfEmailIsNotValid(): void * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -119,7 +122,7 @@ public function testStringRepresentationIsReturned(): void * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationWithEmtpyEmail(): void + public function testStringRepresentationWithEmtpyEmail() : void { $fixture = new Author('Mike van Riel', ''); @@ -127,10 +130,11 @@ public function testStringRepresentationWithEmtpyEmail(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author:: + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $fixture = Author::create('Mike van Riel '); @@ -140,10 +144,11 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Author:: + * + * @covers ::create */ - public function testFactoryMethodReturnsNullIfItCouldNotReadBody(): void + public function testFactoryMethodReturnsNullIfItCouldNotReadBody() : void { $this->assertNull(Author::create('dfgr<')); } diff --git a/tests/unit/DocBlock/Tags/CoversTest.php b/tests/unit/DocBlock/Tags/CoversTest.php index 56c26576..f4319a91 100644 --- a/tests/unit/DocBlock/Tags/CoversTest.php +++ b/tests/unit/DocBlock/Tags/CoversTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class CoversTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -65,9 +67,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -81,7 +84,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen(): void + public function testHasReferenceToFqsen() : void { $expected = new Fqsen('\DateTime'); @@ -91,11 +94,12 @@ public function testHasReferenceToFqsen(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -105,11 +109,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Covers(new Fqsen('\DateTime'), new Description('Description')); @@ -117,21 +122,22 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Covers:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\FqsenResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = m::mock(FqsenResolver::class); - $context = new Context(''); + $resolver = m::mock(FqsenResolver::class); + $context = new Context(''); - $fqsen = new Fqsen('\DateTime'); + $fqsen = new Fqsen('\DateTime'); $description = new Description('My Description'); $descriptionFactory @@ -148,7 +154,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException('InvalidArgumentException'); $this->assertNull(Covers::create('')); diff --git a/tests/unit/DocBlock/Tags/DeprecatedTest.php b/tests/unit/DocBlock/Tags/DeprecatedTest.php index 95607c98..9df9a7f7 100644 --- a/tests/unit/DocBlock/Tags/DeprecatedTest.php +++ b/tests/unit/DocBlock/Tags/DeprecatedTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -28,7 +28,7 @@ class DeprecatedTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -36,9 +36,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -50,10 +51,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -63,9 +65,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -79,7 +82,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber(): void + public function testHasVersionNumber() : void { $expected = '1.0'; @@ -89,11 +92,12 @@ public function testHasVersionNumber(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -103,11 +107,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Deprecated('1.0', new Description('Description')); @@ -115,18 +120,19 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $version = '1.0'; + $version = '1.0'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -139,13 +145,14 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodCreatesEmptyDeprecatedTag(): void + public function testFactoryMethodCreatesEmptyDeprecatedTag() : void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -158,10 +165,11 @@ public function testFactoryMethodCreatesEmptyDeprecatedTag(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated::__construct + * + * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void { $this->assertEquals(new Deprecated(), Deprecated::create('dkhf<')); } diff --git a/tests/unit/DocBlock/Tags/ExampleTest.php b/tests/unit/DocBlock/Tags/ExampleTest.php index ab9a3333..77809d49 100644 --- a/tests/unit/DocBlock/Tags/ExampleTest.php +++ b/tests/unit/DocBlock/Tags/ExampleTest.php @@ -1,4 +1,6 @@ -assertEquals('"example1.php"', $tag->getContent()); @@ -34,13 +37,14 @@ public function testExampleWithoutContent(): void } /** + * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::create * @covers ::__construct * @covers ::getFilePath * @covers ::getDescription - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testWithDescription(): void + public function testWithDescription() : void { $tag = Example::create('"example1.php" some text'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -48,13 +52,14 @@ public function testWithDescription(): void } /** + * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::create * @covers ::__construct * @covers ::getFilePath * @covers ::getStartingLine - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testStartlineIsParsed(): void + public function testStartlineIsParsed() : void { $tag = Example::create('"example1.php" 10'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -62,14 +67,15 @@ public function testStartlineIsParsed(): void } /** + * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::create * @covers ::__construct * @covers ::getFilePath * @covers ::getStartingLine * @covers ::getDescription - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testAllowOmitingLineCount(): void + public function testAllowOmitingLineCount() : void { $tag = Example::create('"example1.php" 10 some text'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -78,14 +84,15 @@ public function testAllowOmitingLineCount(): void } /** + * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::create * @covers ::__construct * @covers ::getFilePath * @covers ::getStartingLine * @covers ::getLineCount - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testLengthIsParsed(): void + public function testLengthIsParsed() : void { $tag = Example::create('"example1.php" 10 5'); $this->assertEquals('example1.php', $tag->getFilePath()); @@ -94,15 +101,16 @@ public function testLengthIsParsed(): void } /** + * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * * @covers ::create * @covers ::__construct * @covers ::getFilePath * @covers ::getStartingLine * @covers ::getLineCount * @covers ::getDescription - * @uses phpDocumentor\Reflection\DocBlock\Tags\BaseTag */ - public function testFullExample(): void + public function testFullExample() : void { $tag = Example::create('"example1.php" 10 5 test text'); $this->assertEquals('example1.php', $tag->getFilePath()); diff --git a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php index 481e7999..ce0c286a 100644 --- a/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/AlignFormatterTest.php @@ -1,4 +1,6 @@ - - * @copyright 2018 Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; -use phpDocumentor\Reflection\DocBlock\Tags\Link; +use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\DocBlock\Tags\Version; use phpDocumentor\Reflection\Types\String_; @@ -30,27 +29,28 @@ class AlignFormatterTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version + * @uses \phpDocumentor\Reflection\Types\String_ + * * @covers ::format * @covers \phpDocumentor\Reflection\DocBlock\Tags\Formatter\AlignFormatter::__construct - * @uses \phpDocumentor\Reflection\DocBlock\Description - * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag - * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link - * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param - * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version - * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void + public function testFormatterCallsToStringAndReturnsAStandardRepresentation() : void { - $tags = [ + $tags = [ new Param('foobar', new String_()), new Version('1.2.0'), - new Link('http://www.example.com', new Description('Examples')), + new LinkTag('http://www.example.com', new Description('Examples')), ]; $fixture = new AlignFormatter($tags); diff --git a/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php b/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php index 6c4a2812..8f0f021f 100644 --- a/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php +++ b/tests/unit/DocBlock/Tags/Formatter/PassthroughFormatterTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags\Formatter; @@ -26,18 +26,19 @@ class PassthroughFormatterTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** - * @covers ::format * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * + * @covers ::format */ - public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): void + public function testFormatterCallsToStringAndReturnsAStandardRepresentation() : void { $expected = '@unknown-tag This is a description'; @@ -50,15 +51,16 @@ public function testFormatterCallsToStringAndReturnsAStandardRepresentation(): v } /** - * @covers ::format * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic + * + * @covers ::format */ - public function testFormatterToStringWitoutDescription(): void + public function testFormatterToStringWitoutDescription() : void { $expected = '@unknown-tag'; - $fixture = new PassthroughFormatter(); + $fixture = new PassthroughFormatter(); $this->assertSame( $expected, diff --git a/tests/unit/DocBlock/Tags/GenericTest.php b/tests/unit/DocBlock/Tags/GenericTest.php index 3605bc47..a3c82488 100644 --- a/tests/unit/DocBlock/Tags/GenericTest.php +++ b/tests/unit/DocBlock/Tags/GenericTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @generic http://phpdoc.org */ @@ -28,7 +28,7 @@ class GenericTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -36,9 +36,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Generic('generic', new Description('Description')); @@ -51,9 +52,10 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Generic('generic', new Description('Description')); @@ -63,9 +65,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Generic('generic', new Description('Description')); @@ -76,11 +79,12 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -90,12 +94,13 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Generic('generic', new Description('Description')); @@ -103,18 +108,19 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Generic:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $generics = 'generic'; + $generics = 'generic'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -129,7 +135,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfNameIsNotEmpty(): void + public function testFactoryMethodFailsIfNameIsNotEmpty() : void { $this->expectException('InvalidArgumentException'); Generic::create('', ''); @@ -139,7 +145,7 @@ public function testFactoryMethodFailsIfNameIsNotEmpty(): void * @covers ::create * @covers ::__construct */ - public function testFactoryMethodFailsIfNameContainsIllegalCharacters(): void + public function testFactoryMethodFailsIfNameContainsIllegalCharacters() : void { $this->expectException('InvalidArgumentException'); Generic::create('', 'name/myname'); diff --git a/tests/unit/DocBlock/Tags/LinkTest.php b/tests/unit/DocBlock/Tags/LinkTest.php index 47097d7c..00c8fe5c 100644 --- a/tests/unit/DocBlock/Tags/LinkTest.php +++ b/tests/unit/DocBlock/Tags/LinkTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -28,7 +28,7 @@ class LinkTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -36,9 +36,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -50,10 +51,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -63,9 +65,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -79,7 +82,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getLink */ - public function testHasLinkUrl(): void + public function testHasLinkUrl() : void { $expected = 'http://this.is.my/link'; @@ -89,11 +92,12 @@ public function testHasLinkUrl(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -103,11 +107,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Link('http://this.is.my/link', new Description('Description')); @@ -115,18 +120,19 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $links = 'http://this.is.my/link'; + $links = 'http://this.is.my/link'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -139,13 +145,14 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Link:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodCreatesEmptyLinkTag(): void + public function testFactoryMethodCreatesEmptyLinkTag() : void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 880a3cf3..f0ef1ff3 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -37,16 +37,17 @@ class MethodTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Method('myMethod'); @@ -59,16 +60,24 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], ['name' => 'argument2', 'type' => new Object_()], ]; - $fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description')); + + $fixture = new Method( + 'myMethod', + $arguments, + new Void_(), + true, + new Description('My Description') + ); $this->assertSame( '@method static void myMethod(string $argument1, object $argument2) My Description', @@ -79,9 +88,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Method('myMethod'); @@ -95,7 +105,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getMethodName */ - public function testHasMethodName(): void + public function testHasMethodName() : void { $expected = 'myMethod'; @@ -108,7 +118,7 @@ public function testHasMethodName(): void * @covers ::__construct * @covers ::getArguments */ - public function testHasArguments(): void + public function testHasArguments() : void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], @@ -123,10 +133,10 @@ public function testHasArguments(): void * @covers ::__construct * @covers ::getArguments */ - public function testArgumentsMayBePassedAsString(): void + public function testArgumentsMayBePassedAsString() : void { $arguments = ['argument1']; - $expected = [ + $expected = [ ['name' => $arguments[0], 'type' => new Void_()], ]; @@ -139,10 +149,10 @@ public function testArgumentsMayBePassedAsString(): void * @covers ::__construct * @covers ::getArguments */ - public function testArgumentTypeCanBeInferredAsVoid(): void + public function testArgumentTypeCanBeInferredAsVoid() : void { $arguments = [['name' => 'argument1']]; - $expected = [ + $expected = [ ['name' => $arguments[0]['name'], 'type' => new Void_()], ]; @@ -152,12 +162,13 @@ public function testArgumentTypeCanBeInferredAsVoid(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::__construct * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::getArguments * @uses \phpDocumentor\Reflection\DocBlock\Description + * + * @covers ::create */ - public function testRestArgumentIsParsedAsRegularArg(): void + public function testRestArgumentIsParsedAsRegularArg() : void { $expected = [ ['name' => 'arg1', 'type' => new Void_()], @@ -166,9 +177,9 @@ public function testRestArgumentIsParsedAsRegularArg(): void ]; $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); - $description = new Description(''); + $resolver = new TypeResolver(); + $context = new Context(''); + $description = new Description(''); $descriptionFactory->shouldReceive('create')->with('', $context)->andReturn($description); $fixture = Method::create( @@ -185,7 +196,7 @@ public function testRestArgumentIsParsedAsRegularArg(): void * @covers ::__construct * @covers ::getReturnType */ - public function testHasReturnType(): void + public function testHasReturnType() : void { $expected = new String_(); @@ -198,7 +209,7 @@ public function testHasReturnType(): void * @covers ::__construct * @covers ::getReturnType */ - public function testReturnTypeCanBeInferredAsVoid(): void + public function testReturnTypeCanBeInferredAsVoid() : void { $fixture = new Method('myMethod', []); @@ -209,23 +220,24 @@ public function testReturnTypeCanBeInferredAsVoid(): void * @covers ::__construct * @covers ::isStatic */ - public function testMethodCanBeStatic(): void + public function testMethodCanBeStatic() : void { $expected = false; - $fixture = new Method('myMethod', [], null, $expected); + $fixture = new Method('myMethod', [], null, $expected); $this->assertSame($expected, $fixture->isStatic()); $expected = true; - $fixture = new Method('myMethod', [], null, $expected); + $fixture = new Method('myMethod', [], null, $expected); $this->assertSame($expected, $fixture->isStatic()); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -235,18 +247,19 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method::isStatic + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $arguments = [ ['name' => 'argument1', 'type' => new String_()], ['name' => 'argument2', 'type' => new Object_()], ]; - $fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description')); + $fixture = new Method('myMethod', $arguments, new Void_(), true, new Description('My Description')); $this->assertSame( 'static void myMethod(string $argument1, object $argument2) My Description', @@ -255,21 +268,22 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $description = new Description('My Description'); + $description = new Description('My Description'); $expectedArguments = [ ['name' => 'argument1', 'type' => new String_()], ['name' => 'argument2', 'type' => new Void_()], @@ -292,17 +306,18 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testReturnTypeThis(): void + public function testReturnTypeThis() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description(''); @@ -321,52 +336,58 @@ public function testReturnTypeThis(): void $this->assertInstanceOf(This::class, $fixture->getReturnType()); } - public function collectionReturnTypesProvider() + /** + * @return string[][] + */ + public function collectionReturnTypesProvider() : array { return [ - ['int[]', Array_::class, Integer::class, Compound::class], - ['int[][]', Array_::class, Array_::class, Compound::class], + ['int[]', Array_::class, Integer::class, Compound::class], + ['int[][]', Array_::class, Array_::class, Compound::class], ['Object[]', Array_::class, Object_::class, Compound::class], - ['array[]', Array_::class, Array_::class, Compound::class], + ['array[]', Array_::class, Array_::class, Compound::class], ]; } /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\Types\Array_ + * @uses \phpDocumentor\Reflection\Types\Compound + * @uses \phpDocumentor\Reflection\Types\Integer + * @uses \phpDocumentor\Reflection\Types\Object_ + * * @dataProvider collectionReturnTypesProvider * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Tags\Method:: - * @uses phpDocumentor\Reflection\DocBlock\Description - * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses phpDocumentor\Reflection\TypeResolver - * @uses phpDocumentor\Reflection\Types\Array_ - * @uses phpDocumentor\Reflection\Types\Compound - * @uses phpDocumentor\Reflection\Types\Integer - * @uses phpDocumentor\Reflection\Types\Object_ */ public function testCollectionReturnTypes( string $returnType, string $expectedType, ?string $expectedValueType = null, ?string $expectedKeyType = null - ): void { - $resolver = new TypeResolver(); + ) : void { + $resolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description('')); - $fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory); + $fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory); $returnType = $fixture->getReturnType(); $this->assertInstanceOf($expectedType, $returnType); - if ($returnType instanceof Array_) { - $this->assertInstanceOf($expectedValueType, $returnType->getValueType()); - $this->assertInstanceOf($expectedKeyType, $returnType->getKeyType()); + if (!($returnType instanceof Array_)) { + return; } + + $this->assertInstanceOf($expectedValueType, $returnType->getValueType()); + $this->assertInstanceOf($expectedKeyType, $returnType->getKeyType()); } /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsEmpty(): void + public function testFactoryMethodFailsIfBodyIsEmpty() : void { $this->expectException('InvalidArgumentException'); Method::create(''); @@ -375,7 +396,7 @@ public function testFactoryMethodFailsIfBodyIsEmpty(): void /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void + public function testFactoryMethodReturnsNullIfBodyIsIncorrect() : void { $this->expectException('InvalidArgumentException'); $this->assertNull(Method::create('body(')); @@ -384,7 +405,7 @@ public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Method::create('body'); @@ -393,7 +414,7 @@ public function testFactoryMethodFailsIfResolverIsNull(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Method::create('body', new TypeResolver()); @@ -402,16 +423,7 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void /** * @covers ::__construct */ - public function testCreationFailsIfBodyIsNotString(): void - { - $this->expectException('InvalidArgumentException'); - new Method([]); - } - - /** - * @covers ::__construct - */ - public function testCreationFailsIfBodyIsEmpty(): void + public function testCreationFailsIfBodyIsEmpty() : void { $this->expectException('InvalidArgumentException'); new Method(''); @@ -420,35 +432,27 @@ public function testCreationFailsIfBodyIsEmpty(): void /** * @covers ::__construct */ - public function testCreationFailsIfStaticIsNotBoolean(): void - { - $this->expectException('InvalidArgumentException'); - new Method('body', [], null, []); - } - - /** - * @covers ::__construct - */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void + public function testCreationFailsIfArgumentRecordContainsInvalidEntry() : void { $this->expectException('InvalidArgumentException'); new Method('body', [['name' => 'myName', 'unknown' => 'nah']]); } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testCreateMethodParenthesisMissing(): void + public function testCreateMethodParenthesisMissing() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); @@ -469,7 +473,6 @@ public function testCreateMethodParenthesisMissing(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver @@ -477,12 +480,14 @@ public function testCreateMethodParenthesisMissing(): void * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context * @uses \phpDocumentor\Reflection\Types\Void_ + * + * @covers ::create */ - public function testCreateWithoutReturnType(): void + public function testCreateWithoutReturnType() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description(''); @@ -503,7 +508,6 @@ public function testCreateWithoutReturnType(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver @@ -514,12 +518,14 @@ public function testCreateWithoutReturnType(): void * @uses \phpDocumentor\Reflection\Types\Compound * @uses \phpDocumentor\Reflection\Types\Integer * @uses \phpDocumentor\Reflection\Types\Object_ + * + * @covers ::create */ - public function testCreateWithMixedReturnTypes(): void + public function testCreateWithMixedReturnTypes() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $descriptionFactory->shouldReceive('create')->andReturn(new Description('')); diff --git a/tests/unit/DocBlock/Tags/ParamTest.php b/tests/unit/DocBlock/Tags/ParamTest.php index 45615c97..9e4513ab 100644 --- a/tests/unit/DocBlock/Tags/ParamTest.php +++ b/tests/unit/DocBlock/Tags/ParamTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class ParamTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Param('myParameter', null, false, new Description('Description')); @@ -53,10 +54,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); $this->assertSame('@param string ...$myParameter Description', $fixture->render()); @@ -73,9 +75,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Param('myParameter'); @@ -89,7 +92,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName(): void + public function testHasVariableName() : void { $expected = 'myParameter'; @@ -102,7 +105,7 @@ public function testHasVariableName(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -115,7 +118,7 @@ public function testHasType(): void * @covers ::__construct * @covers ::isVariadic */ - public function testIfParameterIsVariadic(): void + public function testIfParameterIsVariadic() : void { $fixture = new Param('myParameter', new String_(), false); $this->assertFalse($fixture->isVariadic()); @@ -125,11 +128,12 @@ public function testIfParameterIsVariadic(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -139,13 +143,14 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * * @covers ::__construct * @covers ::isVariadic * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description - * @uses \phpDocumentor\Reflection\Types\String_ */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Param('myParameter', new String_(), true, new Description('Description')); @@ -153,17 +158,18 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { - $typeResolver = new TypeResolver(); + $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -178,12 +184,13 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Param:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -193,17 +200,18 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Param::create('body'); } /** - * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver + * + * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Param::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/PropertyReadTest.php b/tests/unit/DocBlock/Tags/PropertyReadTest.php index c69508c8..901b0907 100644 --- a/tests/unit/DocBlock/Tags/PropertyReadTest.php +++ b/tests/unit/DocBlock/Tags/PropertyReadTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class PropertyReadTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new PropertyRead('myProperty', null, new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); $this->assertSame('@property-read string $myProperty Description', $fixture->render()); @@ -69,9 +71,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new PropertyRead('myProperty'); @@ -85,7 +88,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName(): void + public function testHasVariableName() : void { $expected = 'myProperty'; @@ -98,7 +101,7 @@ public function testHasVariableName(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -108,11 +111,12 @@ public function testHasType(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -122,12 +126,13 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new PropertyRead('myProperty', new String_(), new Description('Description')); @@ -135,17 +140,18 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { - $typeResolver = new TypeResolver(); + $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -164,12 +170,13 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyRead:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -179,17 +186,18 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); PropertyRead::create('body'); } /** - * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver + * + * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); PropertyRead::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/PropertyTest.php b/tests/unit/DocBlock/Tags/PropertyTest.php index f9e34b25..ec0e7fc3 100644 --- a/tests/unit/DocBlock/Tags/PropertyTest.php +++ b/tests/unit/DocBlock/Tags/PropertyTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class PropertyTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Property('myProperty', null, new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Property('myProperty', new String_(), new Description('Description')); $this->assertSame('@property string $myProperty Description', $fixture->render()); @@ -69,9 +71,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Property('myProperty'); @@ -85,7 +88,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName(): void + public function testHasVariableName() : void { $expected = 'myProperty'; @@ -98,7 +101,7 @@ public function testHasVariableName(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -108,11 +111,12 @@ public function testHasType(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -122,12 +126,13 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Property('myProperty', new String_(), new Description('Description')); @@ -135,17 +140,18 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { - $typeResolver = new TypeResolver(); + $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -159,12 +165,13 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Property:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -174,17 +181,18 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Property::create('body'); } /** - * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver + * + * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Property::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/PropertyWriteTest.php b/tests/unit/DocBlock/Tags/PropertyWriteTest.php index 65be7f97..1c6124c2 100644 --- a/tests/unit/DocBlock/Tags/PropertyWriteTest.php +++ b/tests/unit/DocBlock/Tags/PropertyWriteTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class PropertyWriteTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new PropertyWrite('myProperty', null, new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); $this->assertSame('@property-write string $myProperty Description', $fixture->render()); @@ -69,9 +71,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new PropertyWrite('myProperty'); @@ -85,7 +88,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName(): void + public function testHasVariableName() : void { $expected = 'myProperty'; @@ -98,7 +101,7 @@ public function testHasVariableName(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -108,11 +111,12 @@ public function testHasType(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -122,12 +126,13 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new PropertyWrite('myProperty', new String_(), new Description('Description')); @@ -135,17 +140,18 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { - $typeResolver = new TypeResolver(); + $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -164,12 +170,13 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -179,17 +186,18 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); PropertyWrite::create('body'); } /** - * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver + * + * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); PropertyWrite::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index dd6c4b9e..63ace030 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class ReturnTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Return_(new String_(), new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Return_(new String_(), new Description('Description')); @@ -65,9 +67,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Return_(new String_(), new Description('Description')); @@ -81,7 +84,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -91,11 +94,12 @@ public function testHasType(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -105,11 +109,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Return_(new String_(), new Description('Description')); @@ -117,21 +122,22 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $type = new String_(); + $type = new String_(); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -145,7 +151,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException('InvalidArgumentException'); $this->assertNull(Return_::create('')); @@ -154,7 +160,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Return_::create('body'); @@ -163,7 +169,7 @@ public function testFactoryMethodFailsIfResolverIsNull(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Return_::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/SeeTest.php b/tests/unit/DocBlock/Tags/SeeTest.php index b876f696..f9ed04c0 100644 --- a/tests/unit/DocBlock/Tags/SeeTest.php +++ b/tests/unit/DocBlock/Tags/SeeTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -32,7 +32,7 @@ class SeeTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -42,9 +42,10 @@ public function tearDown(): void * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -57,10 +58,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -72,9 +74,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime')), new Description('Description')); @@ -87,10 +90,11 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen + * * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen(): void + public function testHasReferenceToFqsen() : void { $expected = new FqsenRef(new Fqsen('\DateTime')); @@ -100,13 +104,14 @@ public function testHasReferenceToFqsen(): void } /** - * @covers ::__construct - * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen + * + * @covers ::__construct + * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -116,13 +121,14 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new See(new FqsenRef(new Fqsen('\DateTime::format()')), new Description('Description')); @@ -130,7 +136,6 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\FqsenResolver @@ -138,14 +143,16 @@ public function testStringRepresentationIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Fqsen * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = m::mock(FqsenResolver::class); - $context = new Context(''); + $resolver = m::mock(FqsenResolver::class); + $context = new Context(''); - $fqsen = new Fqsen('\DateTime'); + $fqsen = new Fqsen('\DateTime'); $description = new Description('My Description'); $descriptionFactory @@ -161,19 +168,20 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\See:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\FqsenResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tags\Reference\Url * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithUrl(): void + public function testFactoryMethodWithUrl() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = m::mock(FqsenResolver::class); - $context = new Context(''); + $resolver = m::mock(FqsenResolver::class); + $context = new Context(''); $description = new Description('My Description'); @@ -193,7 +201,7 @@ public function testFactoryMethodWithUrl(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException('InvalidArgumentException'); $this->assertNull(See::create('')); @@ -202,7 +210,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); See::create('body'); @@ -211,7 +219,7 @@ public function testFactoryMethodFailsIfResolverIsNull(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); See::create('body', new FqsenResolver()); diff --git a/tests/unit/DocBlock/Tags/SinceTest.php b/tests/unit/DocBlock/Tags/SinceTest.php index f55364a9..ff926d2c 100644 --- a/tests/unit/DocBlock/Tags/SinceTest.php +++ b/tests/unit/DocBlock/Tags/SinceTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -28,7 +28,7 @@ class SinceTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -36,9 +36,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Since('1.0', new Description('Description')); @@ -50,10 +51,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Since('1.0', new Description('Description')); @@ -63,9 +65,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Since::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Since('1.0', new Description('Description')); @@ -79,7 +82,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber(): void + public function testHasVersionNumber() : void { $expected = '1.0'; @@ -89,11 +92,12 @@ public function testHasVersionNumber(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -103,11 +107,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Since('1.0', new Description('Description')); @@ -115,18 +120,19 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Since:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $version = '1.0'; + $version = '1.0'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -139,13 +145,14 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Since:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodCreatesEmptySinceTag(): void + public function testFactoryMethodCreatesEmptySinceTag() : void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -160,7 +167,7 @@ public function testFactoryMethodCreatesEmptySinceTag(): void /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void { $this->assertNull(Since::create('dkhf<')); } diff --git a/tests/unit/DocBlock/Tags/SourceTest.php b/tests/unit/DocBlock/Tags/SourceTest.php index e1742edd..178d16e0 100644 --- a/tests/unit/DocBlock/Tags/SourceTest.php +++ b/tests/unit/DocBlock/Tags/SourceTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -28,7 +28,7 @@ class SourceTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -36,9 +36,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Source(1, null, new Description('Description')); @@ -50,10 +51,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Source(1, 10, new Description('Description')); $this->assertSame('@source 1 10 Description', $fixture->render()); @@ -67,9 +69,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Source(1); @@ -83,7 +86,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getStartingLine */ - public function testHasStartingLine(): void + public function testHasStartingLine() : void { $expected = 1; @@ -96,7 +99,7 @@ public function testHasStartingLine(): void * @covers ::__construct * @covers ::getLineCount */ - public function testHasLineCount(): void + public function testHasLineCount() : void { $expected = 2; @@ -106,11 +109,12 @@ public function testHasLineCount(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -120,12 +124,13 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Source(1, 10, new Description('Description')); @@ -133,16 +138,17 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -156,12 +162,13 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Source:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -169,10 +176,11 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver + * + * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Source::create('1'); @@ -181,7 +189,7 @@ public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void /** * @covers ::__construct */ - public function testExceptionIsThrownIfStartingLineIsNotInteger(): void + public function testExceptionIsThrownIfStartingLineIsNotInteger() : void { $this->expectException('InvalidArgumentException'); new Source('blabla'); @@ -190,7 +198,7 @@ public function testExceptionIsThrownIfStartingLineIsNotInteger(): void /** * @covers ::__construct */ - public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull(): void + public function testExceptionIsThrownIfLineCountIsNotIntegerOrNull() : void { $this->expectException('InvalidArgumentException'); new Source('1', []); diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index 33381271..b4dec5eb 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class ThrowsTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Throws(new String_(), new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Throws(new String_(), new Description('Description')); @@ -65,9 +67,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Throws(new String_(), new Description('Description')); @@ -81,7 +84,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -91,11 +94,12 @@ public function testHasType(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -105,11 +109,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Throws(new String_(), new Description('Description')); @@ -117,21 +122,22 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $type = new String_(); + $type = new String_(); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -145,7 +151,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException('InvalidArgumentException'); $this->assertNull(Throws::create('')); @@ -154,7 +160,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Throws::create('body'); @@ -163,7 +169,7 @@ public function testFactoryMethodFailsIfResolverIsNull(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Throws::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/UsesTest.php b/tests/unit/DocBlock/Tags/UsesTest.php index ee06863e..979a6751 100644 --- a/tests/unit/DocBlock/Tags/UsesTest.php +++ b/tests/unit/DocBlock/Tags/UsesTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class UsesTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -52,10 +53,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -65,9 +67,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -81,7 +84,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen(): void + public function testHasReferenceToFqsen() : void { $expected = new Fqsen('\DateTime'); @@ -91,11 +94,12 @@ public function testHasReferenceToFqsen(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -105,11 +109,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Uses(new Fqsen('\DateTime'), new Description('Description')); @@ -117,21 +122,22 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Uses:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\FqsenResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Fqsen * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = m::mock(FqsenResolver::class); - $context = new Context(''); + $resolver = m::mock(FqsenResolver::class); + $context = new Context(''); - $fqsen = new Fqsen('\DateTime'); + $fqsen = new Fqsen('\DateTime'); $description = new Description('My Description'); $descriptionFactory @@ -148,7 +154,7 @@ public function testFactoryMethod(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfBodyIsNotEmpty(): void + public function testFactoryMethodFailsIfBodyIsNotEmpty() : void { $this->expectException('InvalidArgumentException'); $this->assertNull(Uses::create('')); @@ -157,7 +163,7 @@ public function testFactoryMethodFailsIfBodyIsNotEmpty(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Uses::create('body'); @@ -166,7 +172,7 @@ public function testFactoryMethodFailsIfResolverIsNull(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Uses::create('body', new FqsenResolver()); diff --git a/tests/unit/DocBlock/Tags/VarTest.php b/tests/unit/DocBlock/Tags/VarTest.php index 627b533e..409263ed 100644 --- a/tests/unit/DocBlock/Tags/VarTest.php +++ b/tests/unit/DocBlock/Tags/VarTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -30,7 +30,7 @@ class VarTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -38,9 +38,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Var_('myVariable', null, new Description('Description')); @@ -49,9 +50,10 @@ public function testIfCorrectTagNameIsReturned(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfVariableNameIsOmmitedIfEmpty(): void + public function testIfVariableNameIsOmmitedIfEmpty() : void { $fixture = new Var_('', null, null); @@ -63,10 +65,11 @@ public function testIfVariableNameIsOmmitedIfEmpty(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); $this->assertSame('@var string $myVariable Description', $fixture->render()); @@ -80,9 +83,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_::__construct + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Var_('myVariable'); @@ -96,7 +100,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName(): void + public function testHasVariableName() : void { $expected = 'myVariable'; @@ -109,7 +113,7 @@ public function testHasVariableName(): void * @covers ::__construct * @covers ::getType */ - public function testHasType(): void + public function testHasType() : void { $expected = new String_(); @@ -119,11 +123,12 @@ public function testHasType(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -133,12 +138,13 @@ public function testHasDescription(): void } /** - * @covers ::__construct - * @covers ::__toString * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ + * + * @covers ::__construct + * @covers ::__toString */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Var_('myVariable', new String_(), new Description('Description')); @@ -146,17 +152,18 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { - $typeResolver = new TypeResolver(); + $typeResolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -170,12 +177,13 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Var_:: * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::create */ - public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void + public function testFactoryMethodFailsIfEmptyBodyIsGiven() : void { $this->expectException('InvalidArgumentException'); $descriptionFactory = m::mock(DescriptionFactory::class); @@ -185,17 +193,18 @@ public function testFactoryMethodFailsIfEmptyBodyIsGiven(): void /** * @covers ::create */ - public function testFactoryMethodFailsIfResolverIsNull(): void + public function testFactoryMethodFailsIfResolverIsNull() : void { $this->expectException('InvalidArgumentException'); Var_::create('body'); } /** - * @covers ::create * @uses \phpDocumentor\Reflection\TypeResolver + * + * @covers ::create */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void + public function testFactoryMethodFailsIfDescriptionFactoryIsNull() : void { $this->expectException('InvalidArgumentException'); Var_::create('body', new TypeResolver()); diff --git a/tests/unit/DocBlock/Tags/VersionTest.php b/tests/unit/DocBlock/Tags/VersionTest.php index 1eff1a62..04ce027e 100644 --- a/tests/unit/DocBlock/Tags/VersionTest.php +++ b/tests/unit/DocBlock/Tags/VersionTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -28,7 +28,7 @@ class VersionTest extends TestCase /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } @@ -36,9 +36,10 @@ public function tearDown(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfCorrectTagNameIsReturned(): void + public function testIfCorrectTagNameIsReturned() : void { $fixture = new Version('1.0', new Description('Description')); @@ -50,10 +51,11 @@ public function testIfCorrectTagNameIsReturned(): void * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::__toString * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getName */ - public function testIfTagCanBeRenderedUsingDefaultFormatter(): void + public function testIfTagCanBeRenderedUsingDefaultFormatter() : void { $fixture = new Version('1.0', new Description('Description')); @@ -63,9 +65,10 @@ public function testIfTagCanBeRenderedUsingDefaultFormatter(): void /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version::__construct * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::render */ - public function testIfTagCanBeRenderedUsingSpecificFormatter(): void + public function testIfTagCanBeRenderedUsingSpecificFormatter() : void { $fixture = new Version('1.0', new Description('Description')); @@ -79,7 +82,7 @@ public function testIfTagCanBeRenderedUsingSpecificFormatter(): void * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber(): void + public function testHasVersionNumber() : void { $expected = '1.0'; @@ -89,11 +92,12 @@ public function testHasVersionNumber(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers \phpDocumentor\Reflection\DocBlock\Tags\BaseTag::getDescription - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testHasDescription(): void + public function testHasDescription() : void { $expected = new Description('Description'); @@ -103,11 +107,12 @@ public function testHasDescription(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::__toString - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testStringRepresentationIsReturned(): void + public function testStringRepresentationIsReturned() : void { $fixture = new Version('1.0', new Description('Description')); @@ -115,18 +120,19 @@ public function testStringRepresentationIsReturned(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethod(): void + public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $context = new Context(''); + $context = new Context(''); - $version = '1.0'; + $version = '1.0'; $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -139,13 +145,14 @@ public function testFactoryMethod(): void } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Version:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodCreatesEmptyVersionTag(): void + public function testFactoryMethodCreatesEmptyVersionTag() : void { $descriptionFactory = m::mock(DescriptionFactory::class); $descriptionFactory->shouldReceive('create')->never(); @@ -160,7 +167,7 @@ public function testFactoryMethodCreatesEmptyVersionTag(): void /** * @covers ::create */ - public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex(): void + public function testFactoryMethodReturnsNullIfBodyDoesNotMatchRegex() : void { $this->assertNull(Version::create('dkhf<')); } diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index c9662fb3..91f06be5 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -21,30 +21,33 @@ use phpDocumentor\Reflection\DocBlock\Tags\Param; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; +use ReflectionClass; /** - * @coversDefaultClass phpDocumentor\Reflection\DocBlockFactory - * @covers :: * @uses \Webmozart\Assert\Assert - * @uses phpDocumentor\Reflection\DocBlock + * @uses \phpDocumentor\Reflection\DocBlock + * + * @coversDefaultClass \phpDocumentor\Reflection\DocBlockFactory + * @covers :: */ class DocBlockFactoryTest extends TestCase { /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** - * @covers ::__construct - * @covers ::createInstance * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * + * @covers ::__construct + * @covers ::createInstance */ - public function testCreateFactoryUsingFactoryMethod(): void + public function testCreateFactoryUsingFactoryMethod() : void { $fixture = DocBlockFactory::createInstance(); @@ -52,16 +55,17 @@ public function testCreateFactoryUsingFactoryMethod(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreateDocBlockFromReflection(): void + public function testCreateDocBlockFromReflection() : void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); - $docBlock = '/** This is a DocBlock */'; - $classReflector = m::mock(\ReflectionClass::class); + $docBlock = '/** This is a DocBlock */'; + $classReflector = m::mock(ReflectionClass::class); $classReflector->shouldReceive('getDocComment')->andReturn($docBlock); $docblock = $fixture->create($classReflector); @@ -74,11 +78,12 @@ public function testCreateDocBlockFromReflection(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreateDocBlockFromStringWithDocComment(): void + public function testCreateDocBlockFromStringWithDocComment() : void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -93,11 +98,12 @@ public function testCreateDocBlockFromStringWithDocComment(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::create * @covers ::__construct - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testCreateDocBlockFromStringWithoutDocComment(): void + public function testCreateDocBlockFromStringWithoutDocComment() : void { $fixture = new DocBlockFactory(m::mock(DescriptionFactory::class), m::mock(TagFactory::class)); @@ -112,16 +118,18 @@ public function testCreateDocBlockFromStringWithoutDocComment(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses phpDocumentor\Reflection\DocBlock\Description + * * @dataProvider provideSummaryAndDescriptions */ - public function testSummaryAndDescriptionAreSeparated($given, $summary, $description): void + public function testSummaryAndDescriptionAreSeparated(string $given, string $summary, string $description) : void { $tagFactory = m::mock(TagFactory::class); - $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); + $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); $docblock = $fixture->create($given); @@ -130,15 +138,16 @@ public function testSummaryAndDescriptionAreSeparated($given, $summary, $descrip } /** + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testDescriptionsRetainFormatting(): void + public function testDescriptionsRetainFormatting() : void { $tagFactory = m::mock(TagFactory::class); - $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); + $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); $given = << This is with multiline description. TAG; - $tag = m::mock(Tag::class); + $tag = m::mock(Tag::class); $tagFactory = m::mock(TagFactory::class); $tagFactory->shouldReceive('create')->with($tagString, m::type(Context::class))->andReturn($tag); @@ -195,7 +205,10 @@ public function testTagsAreInterpretedUsingFactory(): void $this->assertEquals([$tag], $docblock->getTags()); } - public function provideSummaryAndDescriptions() + /** + * @return string[] + */ + public function provideSummaryAndDescriptions() : array { return [ ['This is a DocBlock', 'This is a DocBlock', ''], @@ -208,8 +221,7 @@ public function provideSummaryAndDescriptions() <<shouldReceive('create')->with(m::any(), $context)->andReturn(new Param('param')); $docblock = $fixture->create('/** @param MyType $param */', $context); @@ -268,13 +277,13 @@ public function testTagsWithContextNamespace(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::create - * - * @uses phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses phpDocumentor\Reflection\DocBlock\Description */ - public function testTagsAreFilteredForNullValues(): void + public function testTagsAreFilteredForNullValues() : void { $tagString = << This is with diff --git a/tests/unit/DocBlockTest.php b/tests/unit/DocBlockTest.php index d03fb0d2..e6cbfe37 100644 --- a/tests/unit/DocBlockTest.php +++ b/tests/unit/DocBlockTest.php @@ -1,4 +1,6 @@ - - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ @@ -19,27 +19,28 @@ use PHPUnit\Framework\TestCase; /** + * @uses \Webmozart\Assert\Assert + * * @coversDefaultClass phpDocumentor\Reflection\DocBlock * @covers :: - * @uses \Webmozart\Assert\Assert */ class DocBlockTest extends TestCase { /** * Call Mockery::close after each test. */ - public function tearDown(): void + public function tearDown() : void { m::close(); } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::getSummary - * - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveASummary(): void + public function testDocBlockCanHaveASummary() : void { $summary = 'This is a summary'; @@ -49,12 +50,12 @@ public function testDocBlockCanHaveASummary(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::getSummary - * - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveEllipsisInSummary(): void + public function testDocBlockCanHaveEllipsisInSummary() : void { $summary = 'This is a short (...) description.'; @@ -64,12 +65,12 @@ public function testDocBlockCanHaveEllipsisInSummary(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::getDescription - * - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveADescription(): void + public function testDocBlockCanHaveADescription() : void { $description = new DocBlock\Description(''); @@ -79,13 +80,13 @@ public function testDocBlockCanHaveADescription(): void } /** - * @covers ::__construct - * @covers ::getTags - * * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag + * + * @covers ::__construct + * @covers ::getTags */ - public function testDocBlockCanHaveTags(): void + public function testDocBlockCanHaveTags() : void { $tags = [ m::mock(DocBlock\Tag::class), @@ -97,29 +98,28 @@ public function testDocBlockCanHaveTags(): void } /** - * @covers ::__construct - * @covers ::getTags * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag + * + * @covers ::__construct + * @covers ::getTags */ - public function testDocBlockAllowsOnlyTags(): void + public function testDocBlockAllowsOnlyTags() : void { $this->expectException('InvalidArgumentException'); - $tags = [ - null, - ]; + $tags = [null]; $fixture = new DocBlock('', null, $tags); } /** - * @covers ::__construct - * @covers ::getTagsByName - * * @uses \phpDocumentor\Reflection\DocBlock::getTags * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag + * + * @covers ::__construct + * @covers ::getTagsByName */ - public function testFindTagsInDocBlockByName(): void + public function testFindTagsInDocBlockByName() : void { $tag1 = m::mock(DocBlock\Tag::class); $tag2 = m::mock(DocBlock\Tag::class); @@ -137,14 +137,14 @@ public function testFindTagsInDocBlockByName(): void } /** - * @covers ::__construct - * @covers ::hasTag - * * @uses \phpDocumentor\Reflection\DocBlock::getTags * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\DocBlock\Tag + * + * @covers ::__construct + * @covers ::hasTag */ - public function testCheckIfThereAreTagsWithAGivenName(): void + public function testCheckIfThereAreTagsWithAGivenName() : void { $tag1 = m::mock(DocBlock\Tag::class); $tag2 = m::mock(DocBlock\Tag::class); @@ -162,13 +162,13 @@ public function testCheckIfThereAreTagsWithAGivenName(): void } /** - * @covers ::__construct - * @covers ::getContext - * * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::__construct + * @covers ::getContext */ - public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre(): void + public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre() : void { $context = new Context(''); @@ -178,13 +178,13 @@ public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre(): } /** - * @covers ::__construct - * @covers ::getLocation - * * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Location + * + * @covers ::__construct + * @covers ::getLocation */ - public function testDocBlockKnowsAtWhichLineItIs(): void + public function testDocBlockKnowsAtWhichLineItIs() : void { $location = new Location(10); @@ -194,12 +194,12 @@ public function testDocBlockKnowsAtWhichLineItIs(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::isTemplateStart - * - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate(): void + public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate() : void { $fixture = new DocBlock('', null, [], null, null, true); @@ -207,12 +207,12 @@ public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * * @covers ::__construct * @covers ::isTemplateEnd - * - * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate(): void + public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate() : void { $fixture = new DocBlock('', null, [], null, null, false, true); @@ -220,14 +220,14 @@ public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate(): void } /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated + * * @covers ::__construct * @covers ::removeTag - * - * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated */ - public function testRemoveTag(): void + public function testRemoveTag() : void { - $someTag = new Deprecated(); + $someTag = new Deprecated(); $anotherTag = new Deprecated(); $fixture = new DocBlock('', null, [$someTag]); From 19a1f3a91fc2895a7540efd3537545bac16800df Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 20 Sep 2019 16:52:17 +0200 Subject: [PATCH 088/126] Phpstan to max level --- phpstan.neon | 12 +++--- src/DocBlock/DescriptionFactory.php | 57 ++++++++++++---------------- src/DocBlock/ExampleFinder.php | 7 +++- src/DocBlock/StandardTagFactory.php | 59 +++++++++++++++++++---------- src/DocBlock/Tags/Covers.php | 3 ++ src/DocBlock/Tags/Deprecated.php | 3 +- src/DocBlock/Tags/Generic.php | 2 +- src/DocBlock/Tags/Link.php | 1 + src/DocBlock/Tags/Method.php | 9 +++-- src/DocBlock/Tags/Param.php | 12 +++--- src/DocBlock/Tags/Property.php | 14 ++++--- src/DocBlock/Tags/PropertyRead.php | 10 +++-- src/DocBlock/Tags/PropertyWrite.php | 9 +++-- src/DocBlock/Tags/Return_.php | 4 +- src/DocBlock/Tags/See.php | 8 ++-- src/DocBlock/Tags/Since.php | 3 +- src/DocBlock/Tags/Throws.php | 4 +- src/DocBlock/Tags/Uses.php | 5 ++- src/DocBlock/Tags/Var_.php | 15 +++++--- src/DocBlock/Tags/Version.php | 9 ++++- src/DocBlockFactory.php | 12 ++++-- 21 files changed, 156 insertions(+), 102 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 2beb983c..4ebb808e 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,10 +1,10 @@ +includes: + - /composer/vendor/phpstan/phpstan-mockery/extension.neon + - /composer/vendor/phpstan/phpstan-webmozart-assert/extension.neon + parameters: ignoreErrors: # false positive - - '#Call to an undefined method object::getDocComment\(\)#' + - '#Method phpDocumentor\Reflection\DocBlock\Tags\Method::filterArguments() should return array but returns array#' + - "~Parameter #1 $function of function call_user_func_array expects callable(): mixed, array(string, 'create') given.~" - '#Cannot call method render\(\) on phpDocumentor\\Reflection\\DocBlock\\Description\|string#' - - '#Calling method create\(\) on possibly null value of type phpDocumentor\\Reflection\\DocBlock\\DescriptionFactory\|null#' - - '#Calling method resolve\(\) on possibly null value of type phpDocumentor\\Reflection\\(TypeResolver|FqsenResolver)\|null#' - - # nested parents - - '#Calling method render\(\) on possibly null value of type phpDocumentor\\Reflection\\DocBlock\\Description\|string\|null#' diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 458fac72..746a2c2e 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -14,6 +14,7 @@ namespace phpDocumentor\Reflection\DocBlock; use phpDocumentor\Reflection\Types\Context as TypeContext; +use Webmozart\Assert\Assert; use const PREG_SPLIT_DELIM_CAPTURE; use function count; use function explode; @@ -62,9 +63,28 @@ public function __construct(TagFactory $tagFactory) */ public function create(string $contents, ?TypeContext $context = null) : Description { - [$text, $tags] = $this->parse($this->lex($contents), $context); + $tokens = $this->lex($contents); + $count = count($tokens); + $tagCount = 0; + $tags = []; + + for ($i = 1; $i < $count; $i += 2) { + $tag = $this->tagFactory->create($tokens[$i], $context); + if ($tag !== null) { + $tags[] = $tag; + } + $tokens[$i] = '%' . ++$tagCount . '$s'; + } + + //In order to allow "literal" inline tags, the otherwise invalid + //sequence "{@}" is changed to "@", and "{}" is changed to "}". + //"%" is escaped to "%%" because of vsprintf. + //See unit tests for examples. + for ($i = 0; $i < $count; $i += 2) { + $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]); + } - return new Description($text, $tags); + return new Description(implode('', $tokens), $tags); } /** @@ -81,7 +101,7 @@ private function lex(string $contents) : array return [$contents]; } - return preg_split( + $parts = preg_split( '/\{ # "{@}" is not a valid inline tag. This ensures that we do not treat it as one, but treat it literally. (?!@\}) @@ -110,35 +130,8 @@ private function lex(string $contents) : array 0, PREG_SPLIT_DELIM_CAPTURE ); - } - - /** - * Parses the stream of tokens in to a new set of tokens containing Tags. - * - * @param string[] $tokens - * - * @return string[]|Tag[] - */ - private function parse(array $tokens, ?TypeContext $context = null) : array - { - $count = count($tokens); - $tagCount = 0; - $tags = []; - - for ($i = 1; $i < $count; $i += 2) { - $tags[] = $this->tagFactory->create($tokens[$i], $context); - $tokens[$i] = '%' . ++$tagCount . '$s'; - } - - //In order to allow "literal" inline tags, the otherwise invalid - //sequence "{@}" is changed to "@", and "{}" is changed to "}". - //"%" is escaped to "%%" because of vsprintf. - //See unit tests for examples. - for ($i = 0; $i < $count; $i += 2) { - $tokens[$i] = str_replace(['{@}', '{}', '%'], ['@', '}', '%%'], $tokens[$i]); - } - - return [implode('', $tokens), $tags]; + Assert::isArray($parts); + return $parts; } /** diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 227894ce..919c2b46 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -96,8 +96,10 @@ public function getExampleDirectories() : array * 2. Checks the source folder for the given filename * 3. Checks the 'examples' folder in the current working directory for examples * 4. Checks the path relative to the current working directory for the given filename + * + * @return string[] all lines of the example file */ - private function getExampleFileContents(string $filename) : ?string + private function getExampleFileContents(string $filename) : ?array { $normalizedPath = null; @@ -119,7 +121,8 @@ private function getExampleFileContents(string $filename) : ?string } } - return $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : null; + $lines = $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : false; + return $lines !== false ? $lines : null; } /** diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index b26f7610..7cf911a5 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -28,6 +28,23 @@ use function get_class; use function preg_match; use function strpos; +use phpDocumentor\Reflection\DocBlock\Tags\Author; +use phpDocumentor\Reflection\DocBlock\Tags\Covers; +use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; +use phpDocumentor\Reflection\DocBlock\Tags\Link; +use phpDocumentor\Reflection\DocBlock\Tags\Method; +use phpDocumentor\Reflection\DocBlock\Tags\Param; +use phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; +use phpDocumentor\Reflection\DocBlock\Tags\Property; +use phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; +use phpDocumentor\Reflection\DocBlock\Tags\Return_; +use phpDocumentor\Reflection\DocBlock\Tags\See; +use phpDocumentor\Reflection\DocBlock\Tags\Since; +use phpDocumentor\Reflection\DocBlock\Tags\Source; +use phpDocumentor\Reflection\DocBlock\Tags\Throws; +use phpDocumentor\Reflection\DocBlock\Tags\Uses; +use phpDocumentor\Reflection\DocBlock\Tags\Var_; +use phpDocumentor\Reflection\DocBlock\Tags\Version; /** * Creates a Tag object given the contents of a tag. @@ -56,25 +73,25 @@ final class StandardTagFactory implements TagFactory * FQCN to a class that handles it as an array value. */ private $tagHandlerMappings = [ - 'author' => '\phpDocumentor\Reflection\DocBlock\Tags\Author', - 'covers' => '\phpDocumentor\Reflection\DocBlock\Tags\Covers', - 'deprecated' => '\phpDocumentor\Reflection\DocBlock\Tags\Deprecated', + 'author' => Author::class, + 'covers' => Covers::class, + 'deprecated' => Deprecated::class, // 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example', - 'link' => '\phpDocumentor\Reflection\DocBlock\Tags\Link', - 'method' => '\phpDocumentor\Reflection\DocBlock\Tags\Method', - 'param' => '\phpDocumentor\Reflection\DocBlock\Tags\Param', - 'property-read' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyRead', - 'property' => '\phpDocumentor\Reflection\DocBlock\Tags\Property', - 'property-write' => '\phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite', - 'return' => '\phpDocumentor\Reflection\DocBlock\Tags\Return_', - 'see' => '\phpDocumentor\Reflection\DocBlock\Tags\See', - 'since' => '\phpDocumentor\Reflection\DocBlock\Tags\Since', - 'source' => '\phpDocumentor\Reflection\DocBlock\Tags\Source', - 'throw' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', - 'throws' => '\phpDocumentor\Reflection\DocBlock\Tags\Throws', - 'uses' => '\phpDocumentor\Reflection\DocBlock\Tags\Uses', - 'var' => '\phpDocumentor\Reflection\DocBlock\Tags\Var_', - 'version' => '\phpDocumentor\Reflection\DocBlock\Tags\Version', + 'link' => Link::class, + 'method' => Method::class, + 'param' => Param::class, + 'property-read' => PropertyRead::class, + 'property' => Property::class, + 'property-write' => PropertyWrite::class, + 'return' => Return_::class, + 'see' => See::class, + 'since' => Since::class, + 'source' => Source::class, + 'throw' => Throws::class, + 'throws' => Throws::class, + 'uses' => Uses::class, + 'var' => Var_::class, + 'version' => Version::class, ]; /** @@ -149,7 +166,7 @@ public function addParameter(string $name, $value) : void /** * {@inheritDoc} */ - public function addService($service, $alias = null) : void + public function addService(object $service, $alias = null) : void { $this->serviceLocator[$alias ?: get_class($service)] = $service; } @@ -215,6 +232,8 @@ private function createTag(string $body, string $name, TypeContext $context) : ? /** * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). + * + * @return */ private function findHandlerClassName(string $tagName, TypeContext $context) : string { @@ -245,7 +264,7 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l { $arguments = []; foreach ($parameters as $parameter) { - $typeHint = $parameter->getClass() ? $parameter->getClass()->getName() : null; + $typeHint = $parameter->getClass() !== null ? $parameter->getClass()->getName() : null; if (isset($locator[$typeHint])) { $arguments[] = $locator[$typeHint]; continue; diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 2a1ebf14..5d165f80 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -51,8 +51,11 @@ public static function create( ?TypeContext $context = null ) : self { Assert::notEmpty($body); + Assert::notNull($descriptionFactory); + Assert::notNull($resolver); $parts = preg_split('/\s+/Su', $body, 2); + Assert::isArray($parts); return new static( $resolver->resolve($parts[0], $context), diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 98834145..824ec739 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -43,7 +43,7 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod [^\s\:]+\:\s*\$[^\$]+\$ )'; - /** @var string The version vector. */ + /** @var string|null The version vector. */ private $version = ''; public function __construct(?string $version = null, ?Description $description = null) @@ -74,6 +74,7 @@ public static function create( ); } + Assert::notNull($descriptionFactory); return new static( $matches[1], $descriptionFactory->create($matches[2] ?? '', $context) diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index 713a10ca..ffb4a5b7 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -54,7 +54,7 @@ public static function create( Assert::stringNotEmpty($name); Assert::notNull($descriptionFactory); - $description = $descriptionFactory && $body !== '' ? $descriptionFactory->create($body, $context) : null; + $description = $body !== '' ? $descriptionFactory->create($body, $context) : null; return new static($name, $description); } diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 475357fd..2f9db500 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -50,6 +50,7 @@ public static function create( Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); + Assert::isArray($parts); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; return new static($parts[0], $description); diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 251cf039..0ab19e90 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -44,7 +44,7 @@ final class Method extends BaseTag implements Factory\StaticMethod /** @var string */ private $methodName = ''; - /** @var string[] */ + /** @var string[][] */ private $arguments = []; /** @var bool */ @@ -87,7 +87,8 @@ public static function create( ?TypeContext $context = null ) : ?self { Assert::stringNotEmpty($body); - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); // 1. none or more whitespace // 2. optionally the keyword "static" followed by whitespace @@ -184,7 +185,7 @@ public function getMethodName() : string } /** - * @return string[] + * @return string[][] */ public function getArguments() : array { @@ -221,7 +222,7 @@ public function __toString() : string } /** - * @param mixed[][] $arguments + * @param array $arguments * * @return mixed[][] */ diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 5d02cb6b..430c3d7b 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -66,32 +66,34 @@ public static function create( ?TypeContext $context = null ) : self { Assert::stringNotEmpty($body); - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + Assert::isArray($parts); $type = null; $variableName = ''; $isVariadic = false; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { $type = $typeResolver->resolve(array_shift($parts), $context); array_shift($parts); } // if the next item starts with a $ or ...$ it must be the variable name - if (isset($parts[0]) && (strlen($parts[0]) > 0) && + if (isset($parts[0]) && ($parts[0] !== '') && (strpos($parts[0], '$') === 0 || strpos($parts[0], '...$') === 0) ) { $variableName = array_shift($parts); array_shift($parts); - if (substr($variableName, 0, 3) === '...') { + if ($variableName !== null && strpos($variableName, '...') === 0) { $isVariadic = true; $variableName = substr($variableName, 3); } - if (substr($variableName, 0, 1) === '$') { + if ($variableName !== null && strpos($variableName, '$') === 0) { $variableName = substr($variableName, 1); } } diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index a81b3f05..55f40b71 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -23,7 +23,7 @@ use function array_shift; use function implode; use function preg_split; -use function strlen; +use function strpos; use function substr; /** @@ -57,24 +57,26 @@ public static function create( ?TypeContext $context = null ) : self { Assert::stringNotEmpty($body); - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + Assert::isArray($parts); $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { $type = $typeResolver->resolve(array_shift($parts), $context); array_shift($parts); } // if the next item starts with a $ or ...$ it must be the variable name - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && (strpos($parts[0], '$') === 0)) { $variableName = array_shift($parts); array_shift($parts); - if (substr($variableName, 0, 1) === '$') { + if ($variableName !== null && strpos($variableName, '$') === 0) { $variableName = substr($variableName, 1); } } diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index f98e3322..5810ea82 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -57,24 +57,26 @@ public static function create( ?TypeContext $context = null ) : self { Assert::stringNotEmpty($body); - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + Assert::isArray($parts); $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { $type = $typeResolver->resolve(array_shift($parts), $context); array_shift($parts); } // if the next item starts with a $ or ...$ it must be the variable name - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && (strpos($parts[0], '$') === 0)) { $variableName = array_shift($parts); array_shift($parts); - if (substr($variableName, 0, 1) === '$') { + if ($variableName !== null && strpos($variableName, '$') === 0) { $variableName = substr($variableName, 1); } } diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 8e45ab84..ff7367ba 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -24,6 +24,7 @@ use function implode; use function preg_split; use function strlen; +use function strpos; use function substr; /** @@ -57,14 +58,16 @@ public static function create( ?TypeContext $context = null ) : self { Assert::stringNotEmpty($body); - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + Assert::isArray($parts); $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { $type = $typeResolver->resolve(array_shift($parts), $context); array_shift($parts); } @@ -74,7 +77,7 @@ public static function create( $variableName = array_shift($parts); array_shift($parts); - if (substr($variableName, 0, 1) === '$') { + if ($variableName !== null && strpos($variableName, '$') === 0) { $variableName = substr($variableName, 1); } } diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index dac50365..1efdfbb7 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -47,9 +47,11 @@ public static function create( ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ) : self { - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); + Assert::isArray($parts); $type = $typeResolver->resolve($parts[0] ?? '', $context); $description = $descriptionFactory->create($parts[1] ?? '', $context); diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 218309e0..5db5a650 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -49,13 +49,15 @@ public function __construct(Reference $refers, ?Description $description = null) */ public static function create( string $body, - ?FqsenResolver $resolver = null, + ?FqsenResolver $typeResolver = null, ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ) : self { - Assert::allNotNull([$resolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); + Assert::isArray($parts); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; // https://tools.ietf.org/html/rfc2396#section-3 @@ -63,7 +65,7 @@ public static function create( return new static(new Url($parts[0]), $description); } - return new static(new FqsenRef($resolver->resolve($parts[0], $context)), $description); + return new static(new FqsenRef($typeResolver->resolve($parts[0], $context)), $description); } /** diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 4b967961..8e714a8f 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -43,7 +43,7 @@ final class Since extends BaseTag implements Factory\StaticMethod [^\s\:]+\:\s*\$[^\$]+\$ )'; - /** @var string The version vector. */ + /** @var string|null The version vector. */ private $version = ''; public function __construct(?string $version = null, ?Description $description = null) @@ -68,6 +68,7 @@ public static function create( return null; } + Assert::notNull($descriptionFactory); return new static( $matches[1], $descriptionFactory->create($matches[2] ?? '', $context) diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 7ac2b426..3e9047ee 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -47,9 +47,11 @@ public static function create( ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ) : self { - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); + Assert::isArray($parts); $type = $typeResolver->resolve($parts[0] ?? '', $context); $description = $descriptionFactory->create($parts[1] ?? '', $context); diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 24c74dcc..529c2b75 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -50,9 +50,12 @@ public static function create( ?DescriptionFactory $descriptionFactory = null, ?TypeContext $context = null ) : self { - Assert::allNotNull([$resolver, $descriptionFactory]); + Assert::notNull($resolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/\s+/Su', $body, 2); + Assert::isArray($parts); + Assert::allString($parts); return new static( $resolver->resolve($parts[0], $context), diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index e39d4e00..1039ffd7 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -57,24 +57,29 @@ public static function create( ?TypeContext $context = null ) : self { Assert::stringNotEmpty($body); - Assert::allNotNull([$typeResolver, $descriptionFactory]); + Assert::notNull($typeResolver); + Assert::notNull($descriptionFactory); $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + Assert::isArray($parts); + Assert::allString($parts); $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] !== '$')) { - $type = $typeResolver->resolve(array_shift($parts), $context); + if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { + if ($typeResolver !== null) { + $type = $typeResolver->resolve(array_shift($parts), $context); + } array_shift($parts); } // if the next item starts with a $ or ...$ it must be the variable name - if (isset($parts[0]) && (strlen($parts[0]) > 0) && ($parts[0][0] === '$')) { + if (isset($parts[0]) && ($parts[0] !== '') && (strpos($parts[0], '$') === 0)) { $variableName = array_shift($parts); array_shift($parts); - if (substr($variableName, 0, 1) === '$') { + if ($variableName !== null && strpos($variableName, '$') === 0) { $variableName = substr($variableName, 1); } } diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 5a50283e..28cc3266 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -43,7 +43,7 @@ final class Version extends BaseTag implements Factory\StaticMethod [^\s\:]+\:\s*\$[^\$]+\$ )'; - /** @var string The version vector. */ + /** @var string|null The version vector. */ private $version = ''; public function __construct(?string $version = null, ?Description $description = null) @@ -68,9 +68,14 @@ public static function create( return null; } + $description = null; + if ($descriptionFactory !== null) { + $description = $descriptionFactory->create($matches[2] ?? '', $context); + } + return new static( $matches[1], - $descriptionFactory->create($matches[2] ?? '', $context) + $description ); } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index d046a650..1ea28eb4 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -230,7 +230,7 @@ private function splitDocBlock(string $comment) : array * @param string $tags Tag block to parse. * @param Types\Context $context Context of the parsed Tag * - * @return DocBlock\Tag[]|string[]|null[] + * @return DocBlock\Tag[] */ private function parseTagBlock(string $tags, Types\Context $context) : array { @@ -239,9 +239,13 @@ private function parseTagBlock(string $tags, Types\Context $context) : array return []; } - $result = $this->splitTagBlockIntoTagLines($tags); - foreach ($result as $key => $tagLine) { - $result[$key] = $this->tagFactory->create(trim($tagLine), $context); + $result = []; + $lines = $this->splitTagBlockIntoTagLines($tags); + foreach ($lines as $key => $tagLine) { + $tag = $this->tagFactory->create(trim($tagLine), $context); + if ($tag instanceof Tag) { + $result[$key] = $tag; + } } return $result; From 50ec1362de7f758a61dac08d031bd565db1d7049 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 26 Sep 2019 21:09:37 +0200 Subject: [PATCH 089/126] Psalm fixes --- composer-require-config.json | 15 +++ composer.json | 13 ++- composer.lock | 161 ++++++++++++++++++++-------- src/DocBlock/ExampleFinder.php | 2 +- src/DocBlock/StandardTagFactory.php | 51 ++++----- src/DocBlock/Tags/Link.php | 2 +- src/DocBlock/Tags/Method.php | 2 +- src/DocBlock/Tags/Param.php | 3 +- src/DocBlock/Tags/PropertyRead.php | 4 +- src/DocBlock/Tags/PropertyWrite.php | 2 +- src/DocBlock/Tags/See.php | 2 +- src/DocBlock/Tags/Var_.php | 6 +- src/DocBlock/Tags/Version.php | 3 +- src/DocBlockFactory.php | 16 ++- 14 files changed, 185 insertions(+), 97 deletions(-) create mode 100644 composer-require-config.json diff --git a/composer-require-config.json b/composer-require-config.json new file mode 100644 index 00000000..19eee4ff --- /dev/null +++ b/composer-require-config.json @@ -0,0 +1,15 @@ +{ + "symbol-whitelist" : [ + "null", "true", "false", + "static", "self", "parent", + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "XSLTProcessor" + ], + "php-core-extensions" : [ + "Core", + "pcre", + "Reflection", + "tokenizer", + "SPL", + "standard" + ] +} diff --git a/composer.json b/composer.json index 788ed981..a072f63b 100644 --- a/composer.json +++ b/composer.json @@ -7,13 +7,18 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], - "minimum-stability": "alpha", "require": { - "php": ">=7.1", - "phpdocumentor/type-resolver": "^0", - "webmozart/assert": "^1" + "php": "^7.1", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1", + "phpdocumentor/reflection-common": "^2.0", + "ext-filter": "^7.1" }, "require-dev": { "mockery/mockery": "^1", diff --git a/composer.lock b/composer.lock index 29b1328a..cc854ec9 100644 --- a/composer.lock +++ b/composer.lock @@ -1,30 +1,30 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "cb7ecdcb52e627755275cf273bcdd249", + "content-hash": "93c5a8174b30802326730535c6b1479f", "packages": [ { "name": "phpdocumentor/reflection-common", - "version": "2.0.0-alpha3", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f" + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/eedd98e8bc9cfd924f056b4b5847066d4a250d2f", - "reference": "eedd98e8bc9cfd924f056b4b5847066d4a250d2f", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/63a995caa1ca9e5590304cd845c15ad6d482a62a", + "reference": "63a995caa1ca9e5590304cd845c15ad6d482a62a", "shasum": "" }, "require": { "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "^6" + "phpunit/phpunit": "~6" }, "type": "library", "extra": { @@ -34,9 +34,7 @@ }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] + "phpDocumentor\\Reflection\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -58,34 +56,35 @@ "reflection", "static analysis" ], - "time": "2018-06-13T21:44:20+00:00" + "time": "2018-08-07T13:53:10+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "0.6.2", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b" + "reference": "4dfca962ce4d6c11ae17efcc65621cc4b22004c7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/e81ce9e82df06b49b2d0e0a2393a08955aeda05b", - "reference": "e81ce9e82df06b49b2d0e0a2393a08955aeda05b", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/4dfca962ce4d6c11ae17efcc65621cc4b22004c7", + "reference": "4dfca962ce4d6c11ae17efcc65621cc4b22004c7", "shasum": "" }, "require": { - "php": ">=7.1", - "phpdocumentor/reflection-common": "^2" + "php": "^7.1", + "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.5" + "ext-tokenizer": "^7.1", + "mockery/mockery": "~1", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -93,7 +92,11 @@ "phpDocumentor\\Reflection\\": "src" } }, - "notification-url": "https://packagist.org/downloads/", + "autoload-dev": { + "psr-4": { + "phpDocumentor\\Reflection\\": "tests/unit" + } + }, "license": [ "MIT" ], @@ -103,24 +106,88 @@ "email": "me@mikevanriel.com" } ], - "time": "2018-06-14T12:29:58+00:00" + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.0.0", + "issues": "https://github.com/phpDocumentor/TypeResolver/issues" + }, + "time": "2019-07-08T19:35:58+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "82ebae02209c21113908c229e9883c419720738a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-02-06T07:57:58+00:00" }, { "name": "webmozart/assert", - "version": "1.3.0", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", - "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", + "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -153,33 +220,35 @@ "check", "validate" ], - "time": "2018-01-29T19:49:41+00:00" + "time": "2018-12-25T11:19:39+00:00" } ], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + "reference": "a2c590166b2133a4633738648b6b064edae0814a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", - "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", + "reference": "a2c590166b2133a4633738648b6b064edae0814a", "shasum": "" }, "require": { "php": "^7.1" }, "require-dev": { - "athletic/athletic": "~0.1.8", + "doctrine/coding-standard": "^6.0", "ext-pdo": "*", "ext-phar": "*", - "phpunit/phpunit": "^6.2.3", - "squizlabs/php_codesniffer": "^3.0.2" + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" }, "type": "library", "extra": { @@ -204,12 +273,12 @@ } ], "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://github.com/doctrine/instantiator", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", "keywords": [ "constructor", "instantiate" ], - "time": "2017-07-22T11:58:36+00:00" + "time": "2019-03-17T17:37:11+00:00" }, { "name": "hamcrest/hamcrest-php", @@ -261,16 +330,16 @@ }, { "name": "mockery/mockery", - "version": "1.1.0", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99" + "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/99e29d3596b16dabe4982548527d5ddf90232e99", - "reference": "99e29d3596b16dabe4982548527d5ddf90232e99", + "url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", + "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", "shasum": "" }, "require": { @@ -279,8 +348,7 @@ "php": ">=5.6.0" }, "require-dev": { - "phpdocumentor/phpdocumentor": "^2.9", - "phpunit/phpunit": "~5.7.10|~6.5" + "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" }, "type": "library", "extra": { @@ -323,16 +391,17 @@ "test double", "testing" ], - "time": "2018-05-08T08:54:48+00:00" + "time": "2019-02-13T09:37:52+00:00" } ], "aliases": [], - "minimum-stability": "alpha", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.1" + "php": "^7.1", + "ext-filter": "^7.1" }, "platform-dev": [] } diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 919c2b46..db42be71 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -122,7 +122,7 @@ private function getExampleFileContents(string $filename) : ?array } $lines = $normalizedPath && is_readable($normalizedPath) ? file($normalizedPath) : false; - return $lines !== false ? $lines : null; + return $lines !== false ? $lines : null; } /** diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 7cf911a5..02c3651d 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -8,43 +8,43 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @link http://phpdoc.org + * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock; use InvalidArgumentException; -use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; -use phpDocumentor\Reflection\DocBlock\Tags\Generic; -use phpDocumentor\Reflection\FqsenResolver; -use phpDocumentor\Reflection\Types\Context as TypeContext; -use ReflectionMethod; -use ReflectionParameter; -use Webmozart\Assert\Assert; -use function array_merge; -use function array_slice; -use function call_user_func_array; -use function count; -use function get_class; -use function preg_match; -use function strpos; use phpDocumentor\Reflection\DocBlock\Tags\Author; use phpDocumentor\Reflection\DocBlock\Tags\Covers; use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; -use phpDocumentor\Reflection\DocBlock\Tags\Link; +use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; +use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; use phpDocumentor\Reflection\DocBlock\Tags\Method; use phpDocumentor\Reflection\DocBlock\Tags\Param; -use phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; use phpDocumentor\Reflection\DocBlock\Tags\Property; +use phpDocumentor\Reflection\DocBlock\Tags\PropertyRead; use phpDocumentor\Reflection\DocBlock\Tags\PropertyWrite; use phpDocumentor\Reflection\DocBlock\Tags\Return_; -use phpDocumentor\Reflection\DocBlock\Tags\See; +use phpDocumentor\Reflection\DocBlock\Tags\See as SeeTag; use phpDocumentor\Reflection\DocBlock\Tags\Since; use phpDocumentor\Reflection\DocBlock\Tags\Source; use phpDocumentor\Reflection\DocBlock\Tags\Throws; use phpDocumentor\Reflection\DocBlock\Tags\Uses; use phpDocumentor\Reflection\DocBlock\Tags\Var_; use phpDocumentor\Reflection\DocBlock\Tags\Version; +use phpDocumentor\Reflection\FqsenResolver; +use phpDocumentor\Reflection\Types\Context as TypeContext; +use ReflectionMethod; +use ReflectionParameter; +use Webmozart\Assert\Assert; +use function array_merge; +use function array_slice; +use function call_user_func_array; +use function count; +use function get_class; +use function preg_match; +use function strpos; /** * Creates a Tag object given the contents of a tag. @@ -77,14 +77,14 @@ final class StandardTagFactory implements TagFactory 'covers' => Covers::class, 'deprecated' => Deprecated::class, // 'example' => '\phpDocumentor\Reflection\DocBlock\Tags\Example', - 'link' => Link::class, + 'link' => LinkTag::class, 'method' => Method::class, 'param' => Param::class, 'property-read' => PropertyRead::class, 'property' => Property::class, 'property-write' => PropertyWrite::class, 'return' => Return_::class, - 'see' => See::class, + 'see' => SeeTag::class, 'since' => Since::class, 'source' => Source::class, 'throw' => Throws::class, @@ -166,7 +166,7 @@ public function addParameter(string $name, $value) : void /** * {@inheritDoc} */ - public function addService(object $service, $alias = null) : void + public function addService(object $service, ?string $alias = null) : void { $this->serviceLocator[$alias ?: get_class($service)] = $service; } @@ -232,8 +232,6 @@ private function createTag(string $body, string $name, TypeContext $context) : ? /** * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). - * - * @return */ private function findHandlerClassName(string $tagName, TypeContext $context) : string { @@ -264,7 +262,12 @@ private function getArgumentsForParametersFromWiring(array $parameters, array $l { $arguments = []; foreach ($parameters as $parameter) { - $typeHint = $parameter->getClass() !== null ? $parameter->getClass()->getName() : null; + $class = $parameter->getClass(); + $typeHint = null; + if ($class !== null) { + $typeHint = $class->getName(); + } + if (isset($locator[$typeHint])) { $arguments[] = $locator[$typeHint]; continue; diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 2f9db500..a50c813a 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -49,7 +49,7 @@ public static function create( ) : self { Assert::notNull($descriptionFactory); - $parts = preg_split('/\s+/Su', $body, 2); + $parts = preg_split('/\s+/Su', $body, 2); Assert::isArray($parts); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 0ab19e90..8f9ab591 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -222,7 +222,7 @@ public function __toString() : string } /** - * @param array $arguments + * @param mixed[][] $arguments * * @return mixed[][] */ diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 430c3d7b..74e984d7 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -23,7 +23,6 @@ use function array_shift; use function implode; use function preg_split; -use function strlen; use function strpos; use function substr; @@ -69,7 +68,7 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); Assert::isArray($parts); $type = null; $variableName = ''; diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 5810ea82..9cdd4f89 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -23,7 +23,7 @@ use function array_shift; use function implode; use function preg_split; -use function strlen; +use function strpos; use function substr; /** @@ -60,7 +60,7 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); Assert::isArray($parts); $type = null; $variableName = ''; diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index ff7367ba..edeed5f1 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -61,7 +61,7 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); Assert::isArray($parts); $type = null; $variableName = ''; diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 5db5a650..cb79e48c 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -56,7 +56,7 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/\s+/Su', $body, 2); + $parts = preg_split('/\s+/Su', $body, 2); Assert::isArray($parts); $description = isset($parts[1]) ? $descriptionFactory->create($parts[1], $context) : null; diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 1039ffd7..cf5b4d9a 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -23,7 +23,7 @@ use function array_shift; use function implode; use function preg_split; -use function strlen; +use function strpos; use function substr; /** @@ -60,7 +60,7 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); + $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); Assert::isArray($parts); Assert::allString($parts); $type = null; @@ -111,7 +111,7 @@ public function getType() : ?Type public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . (empty($this->variableName) ? null : ('$' . $this->variableName)) + . (empty($this->variableName) ? '' : ('$' . $this->variableName)) . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 28cc3266..7fdb590b 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -92,6 +92,7 @@ public function getVersion() : ?string */ public function __toString() : string { - return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + return ((string) $this->version) . + ($this->description instanceof Description ? ' ' . $this->description->render() : ''); } } diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 1ea28eb4..30559682 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -20,7 +20,6 @@ use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; use Webmozart\Assert\Assert; -use function array_filter; use function array_shift; use function count; use function explode; @@ -100,12 +99,7 @@ public function create($docblock, ?Types\Context $context = null, ?Location $loc return new DocBlock( $summary, $description ? $this->descriptionFactory->create($description, $context) : null, - array_filter( - $this->parseTagBlock($tags, $context), - static function ($tag) { - return $tag instanceof Tag; - } - ), + $this->parseTagBlock($tags, $context), $context, $location, $templateMarker === '#@+', @@ -240,12 +234,14 @@ private function parseTagBlock(string $tags, Types\Context $context) : array } $result = []; - $lines = $this->splitTagBlockIntoTagLines($tags); + $lines = $this->splitTagBlockIntoTagLines($tags); foreach ($lines as $key => $tagLine) { $tag = $this->tagFactory->create(trim($tagLine), $context); - if ($tag instanceof Tag) { - $result[$key] = $tag; + if (!($tag instanceof Tag)) { + continue; } + + $result[$key] = $tag; } return $result; From 73ea6784b334130ecbaa8909d12d504743ecf082 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 26 Sep 2019 21:11:19 +0200 Subject: [PATCH 090/126] Add workflow to ensure checks --- .github/workflows/push.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 00000000..4e53593b --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,35 @@ +on: push +name: Qa workflow +jobs: + qa-checks: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + - name: composer + uses: docker://composer + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: install --no-interaction --prefer-dist --optimize-autoloader + - name: Code style check + uses: docker://phpdoc/phpcs-ga:master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: -d memory_limit=1024M -s + - name: composer-require-checker + uses: docker://phpga/composer-require-checker-ga + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: check --config-file ./composer-require-config.json composer.json + - name: Psalm + uses: docker://mickaelandrieu/psalm-ga + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: PHPStan + uses: docker://oskarstark/phpstan-ga + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: analyse src --level max --configuration phpstan.neon From 09e086ecf13bde3be24643709cb01fc1394fd315 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 26 Sep 2019 21:19:59 +0200 Subject: [PATCH 091/126] Cleanup build files --- .travis.yml | 9 --------- easy-coding-standard.neon | 26 -------------------------- phive.xml | 5 ----- psalm.xml | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+), 40 deletions(-) delete mode 100644 easy-coding-standard.neon delete mode 100644 phive.xml create mode 100644 psalm.xml diff --git a/.travis.yml b/.travis.yml index 050bab94..f4cc4b39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,18 +27,9 @@ jobs: - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose - travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - - stage: lint - php: 7.1 - before_script: - - travis_retry php phive.phar --no-progress install --trust-gpg-keys 8E730BA25823D8B5 phpstan - script: - - ./tools/phpstan analyse src --level max --configuration phpstan.neon - - composer create-project symplify/easy-coding-standard temp/ecs ^3 && temp/ecs/bin/ecs check src tests - cache: directories: - $HOME/.composer/cache/files - - $HOME/.phive notifications: irc: "irc.freenode.org#phpdocumentor" diff --git a/easy-coding-standard.neon b/easy-coding-standard.neon deleted file mode 100644 index 8260402a..00000000 --- a/easy-coding-standard.neon +++ /dev/null @@ -1,26 +0,0 @@ -includes: - - temp/ecs/config/clean-code.neon - - temp/ecs/config/psr2.neon - - temp/ecs/config/common.neon - -parameters: - exclude_checkers: - # from temp/ecs/config/common.neon - - PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer - - PhpCsFixer\Fixer\PhpUnit\PhpUnitStrictFixer - - PhpCsFixer\Fixer\ControlStructure\YodaStyleFixer - # from temp/ecs/config/spaces.neon - - PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer - - skip: - SlevomatCodingStandard\Sniffs\Classes\UnusedPrivateElementsSniff: - # WIP code - - src/DocBlock/StandardTagFactory.php - PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff: - # WIP code - - src/DocBlock/StandardTagFactory.php - PHP_CodeSniffer\Standards\Squiz\Sniffs\Classes\ValidClassNameSniff: - - src/DocBlock/Tags/Return_.php - - src/DocBlock/Tags/Var_.php - PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\CamelCapsFunctionNameSniff: - - */tests/** diff --git a/phive.xml b/phive.xml deleted file mode 100644 index 24b708d5..00000000 --- a/phive.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 00000000..9fedb8ab --- /dev/null +++ b/psalm.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + From c14c01875aa515194332e6eba966a66dbd035ef8 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Tue, 10 Dec 2019 23:46:06 +0100 Subject: [PATCH 092/126] Make static anlisys pass --- Makefile | 32 +++++++++++++++ composer.lock | 21 ++++------ phive.xml | 5 +++ phpstan.neon | 2 - phpunit.xml.dist | 10 +---- src/DocBlock/StandardTagFactory.php | 6 ++- src/DocBlock/Tags/BaseTag.php | 7 +--- src/DocBlock/Tags/Deprecated.php | 2 +- src/DocBlock/Tags/Example.php | 50 +++++++++++++++-------- src/DocBlock/Tags/Generic.php | 2 +- src/DocBlock/Tags/Method.php | 20 +++++---- src/DocBlock/Tags/Param.php | 12 +++--- src/DocBlock/Tags/Property.php | 10 ++--- src/DocBlock/Tags/PropertyRead.php | 10 ++--- src/DocBlock/Tags/PropertyWrite.php | 10 ++--- src/DocBlock/Tags/Return_.php | 2 +- src/DocBlock/Tags/See.php | 2 +- src/DocBlock/Tags/Since.php | 2 +- src/DocBlock/Tags/Source.php | 4 +- src/DocBlock/Tags/Throws.php | 2 +- src/DocBlock/Tags/Uses.php | 2 +- src/DocBlock/Tags/Var_.php | 12 +++--- tests/unit/DocBlock/ExampleFinderTest.php | 2 +- tests/unit/DocBlockFactoryTest.php | 12 ++++-- 24 files changed, 143 insertions(+), 96 deletions(-) create mode 100644 Makefile create mode 100644 phive.xml diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..374f1bde --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +.PHONY: install-phive +install-phive: + mkdir tools; \ + wget -O tools/phive.phar https://phar.io/releases/phive.phar; \ + wget -O tools/phive.phar.asc https://phar.io/releases/phive.phar.asc; \ + gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; \ + gpg --verify tools/phive.phar.asc tools/phive.phar; \ + chmod +x tools/phive.phar + +.PHONY: setup +setup: install-phive + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phar-ga:latest php tools/phive.phar install --force-accept-unsigned + +.PHONY: phpcs +phpcs: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M + +.PHONY: phpstan +phpstan: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpstan-ga:latest analyse src --debug --no-progress --level max --configuration phpstan.neon + +.PHONY: psaml +psalm: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project mickaelandrieu/psalm-ga + +.PHONY: test +test: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/phpunit + +.PHONY: pre-commit-test +pre-commit-test: test phpcs phpstan psalm + diff --git a/composer.lock b/composer.lock index cc854ec9..e2ac299b 100644 --- a/composer.lock +++ b/composer.lock @@ -173,32 +173,29 @@ }, { "name": "webmozart/assert", - "version": "1.4.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", + "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", + "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", "shasum": "" }, "require": { "php": "^5.3.3 || ^7.0", "symfony/polyfill-ctype": "^1.8" }, + "conflict": { + "vimeo/psalm": "<3.6.0" + }, "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" + "phpunit/phpunit": "^4.8.36 || ^7.5.13" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -220,7 +217,7 @@ "check", "validate" ], - "time": "2018-12-25T11:19:39+00:00" + "time": "2019-11-24T13:36:37+00:00" } ], "packages-dev": [ diff --git a/phive.xml b/phive.xml new file mode 100644 index 00000000..51687755 --- /dev/null +++ b/phive.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/phpstan.neon b/phpstan.neon index 4ebb808e..272dd744 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -6,5 +6,3 @@ parameters: ignoreErrors: # false positive - '#Method phpDocumentor\Reflection\DocBlock\Tags\Method::filterArguments() should return array but returns array#' - - "~Parameter #1 $function of function call_user_func_array expects callable(): mixed, array(string, 'create') given.~" - - '#Cannot call method render\(\) on phpDocumentor\\Reflection\\DocBlock\\Description\|string#' diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 1460f9a5..81f914c2 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,9 @@ ./src/ - - ./vendor/ - diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 02c3651d..59caf8c5 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -177,8 +177,8 @@ public function addService(object $service, ?string $alias = null) : void public function registerTagHandler(string $tagName, string $handler) : void { Assert::stringNotEmpty($tagName); - Assert::stringNotEmpty($handler); Assert::classExists($handler); + /** @var object $handler stupid hack to make phpstan happy. */ Assert::implementsInterface($handler, StaticMethod::class); if (strpos($tagName, '\\') && $tagName[0] !== '\\') { @@ -224,7 +224,9 @@ private function createTag(string $body, string $name, TypeContext $context) : ? ); try { - return call_user_func_array([$handlerClassName, 'create'], $arguments); + /** @var callable $callable */ + $callable = [$handlerClassName, 'create']; + return call_user_func_array($callable, $arguments); } catch (InvalidArgumentException $e) { return null; } diff --git a/src/DocBlock/Tags/BaseTag.php b/src/DocBlock/Tags/BaseTag.php index 7a1b9492..fbcd4022 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -24,7 +24,7 @@ abstract class BaseTag implements DocBlock\Tag /** @var string Name of the tag */ protected $name = ''; - /** @var Description|string|null Description of the tag. */ + /** @var Description|null Description of the tag. */ protected $description; /** @@ -37,10 +37,7 @@ public function getName() : string return $this->name; } - /** - * @return Description|string|null - */ - public function getDescription() + public function getDescription() : ?Description { return $this->description; } diff --git a/src/DocBlock/Tags/Deprecated.php b/src/DocBlock/Tags/Deprecated.php index 824ec739..130d8449 100644 --- a/src/DocBlock/Tags/Deprecated.php +++ b/src/DocBlock/Tags/Deprecated.php @@ -94,6 +94,6 @@ public function getVersion() : ?string */ public function __toString() : string { - return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + return ($this->version ?? '') . ($this->description ? ' ' . $this->description->render() : ''); } } diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 122d6d34..020145fd 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -13,7 +13,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; -use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\Tag; use Webmozart\Assert\Assert; use function array_key_exists; @@ -26,7 +25,7 @@ /** * Reflection class for a {@}example tag in a Docblock. */ -final class Example extends BaseTag +final class Example implements Tag { /** @var string Path to a file to use as an example. May also be an absolute URI. */ private $filePath; @@ -43,10 +42,10 @@ final class Example extends BaseTag /** @var int */ private $lineCount; - /** - * @param string|Description|null $description - */ - public function __construct(string $filePath, bool $isURI, int $startingLine, int $lineCount, $description) + /** @var string|null */ + private $content; + + public function __construct(string $filePath, bool $isURI, int $startingLine, int $lineCount, ?string $content) { Assert::notEmpty($filePath); Assert::greaterThanEq($startingLine, 0); @@ -55,20 +54,16 @@ public function __construct(string $filePath, bool $isURI, int $startingLine, in $this->filePath = $filePath; $this->startingLine = $startingLine; $this->lineCount = $lineCount; - $this->name = 'example'; - if ($description !== null) { - $this->description = trim((string) $description); + if ($content !== null) { + $this->content = trim((string) $content); } $this->isURI = $isURI; } - /** - * {@inheritdoc} - */ - public function getContent() + public function getContent() : string { - if ($this->description === null) { + if ($this->content === null) { $filePath = '"' . $this->filePath . '"'; if ($this->isURI) { $filePath = $this->isUriRelative($this->filePath) @@ -76,10 +71,15 @@ public function getContent() : $this->filePath; } - return trim($filePath . ' ' . parent::getDescription()); + return trim($filePath); } - return $this->description; + return $this->content; + } + + public function getDescription() : ?string + { + return $this->content; } /** @@ -121,7 +121,7 @@ public static function create(string $body) : ?Tag } return new static( - $filePath ?? $fileUri, + $filePath ?? ($fileUri ?? ''), $fileUri !== null, $startingLine, $lineCount, @@ -145,7 +145,7 @@ public function getFilePath() : string */ public function __toString() : string { - return $this->filePath . ($this->description ? ' ' . $this->description : ''); + return $this->filePath . ($this->content ? ' ' . $this->content : ''); } /** @@ -165,4 +165,18 @@ public function getLineCount() : int { return $this->lineCount; } + + public function getName() : string + { + return 'example'; + } + + public function render(?Formatter $formatter = null) : string + { + if ($formatter === null) { + $formatter = new Formatter\PassthroughFormatter(); + } + + return $formatter->format($this); + } } diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index ffb4a5b7..7509ff1a 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -24,7 +24,7 @@ /** * Parses a tag definition for a DocBlock. */ -class Generic extends BaseTag implements Factory\StaticMethod +final class Generic extends BaseTag implements Factory\StaticMethod { /** * Parses a tag and populates the member variables. diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 8f9ab591..4d42961c 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -27,7 +27,6 @@ use function is_string; use function preg_match; use function sort; -use function strlen; use function strpos; use function substr; use function trim; @@ -54,7 +53,9 @@ final class Method extends BaseTag implements Factory\StaticMethod private $returnType; /** - * @param mixed[][] $arguments $arguments + * @param mixed[][] $arguments + * + * @psalm-param array|string> $arguments */ public function __construct( string $methodName, @@ -64,7 +65,6 @@ public function __construct( ?Description $description = null ) { Assert::stringNotEmpty($methodName); - Assert::boolean($static); if ($returnType === null) { $returnType = new Void_(); @@ -151,7 +151,7 @@ public static function create( $returnType = $typeResolver->resolve($returnType, $context); $description = $descriptionFactory->create($description, $context); - if (is_string($arguments) && strlen($arguments) > 0) { + if ($arguments !== '') { $arguments = explode(',', $arguments); foreach ($arguments as &$argument) { $argument = explode(' ', self::stripRestArg(trim($argument)), 2); @@ -222,13 +222,17 @@ public function __toString() : string } /** - * @param mixed[][] $arguments + * @param mixed[][]|string[] $arguments * * @return mixed[][] + * + * @psalm-param array|string> $arguments + * @psalm-return array> $arguments */ private function filterArguments(array $arguments = []) : array { - foreach ($arguments as &$argument) { + $result = []; + foreach ($arguments as $argument) { if (is_string($argument)) { $argument = ['name' => $argument]; } @@ -244,9 +248,11 @@ private function filterArguments(array $arguments = []) : array 'Arguments can only have the "name" and "type" fields, found: ' . var_export($keys, true) ); } + + $result[] = $argument; } - return $arguments; + return $result; } private static function stripRestArg(string $argument) : string diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 74e984d7..967ed844 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -37,14 +37,14 @@ final class Param extends BaseTag implements Factory\StaticMethod /** @var Type|null */ private $type; - /** @var string */ - private $variableName = ''; + /** @var string|null */ + private $variableName; /** @var bool determines whether this is a variadic argument */ - private $isVariadic = false; + private $isVariadic; public function __construct( - string $variableName, + ?string $variableName, ?Type $type = null, bool $isVariadic = false, ?Description $description = null @@ -105,7 +105,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName() : string + public function getVariableName() : ?string { return $this->variableName; } @@ -133,7 +133,7 @@ public function __toString() : string { return ($this->type ? $this->type . ' ' : '') . ($this->isVariadic() ? '...' : '') - . '$' . $this->variableName + . ($this->variableName !== null ? '$' . $this->variableName : '') . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 55f40b71..290a4fa6 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -29,7 +29,7 @@ /** * Reflection class for a {@}property tag in a Docblock. */ -class Property extends BaseTag implements Factory\StaticMethod +final class Property extends BaseTag implements Factory\StaticMethod { /** @var string */ protected $name = 'property'; @@ -37,10 +37,10 @@ class Property extends BaseTag implements Factory\StaticMethod /** @var Type|null */ private $type; - /** @var string */ + /** @var string|null */ protected $variableName = ''; - public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) + public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -89,7 +89,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName() : string + public function getVariableName() : ?string { return $this->variableName; } @@ -108,7 +108,7 @@ public function getType() : ?Type public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . '$' . $this->variableName + . ($this->variableName ? '$' . $this->variableName : '') . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 9cdd4f89..4e0c9041 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -29,7 +29,7 @@ /** * Reflection class for a {@}property-read tag in a Docblock. */ -class PropertyRead extends BaseTag implements Factory\StaticMethod +final class PropertyRead extends BaseTag implements Factory\StaticMethod { /** @var string */ protected $name = 'property-read'; @@ -37,10 +37,10 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** @var Type|null */ private $type; - /** @var string */ + /** @var string|null */ protected $variableName = ''; - public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) + public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -89,7 +89,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName() : string + public function getVariableName() : ?string { return $this->variableName; } @@ -108,7 +108,7 @@ public function getType() : ?Type public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . '$' . $this->variableName + . ($this->variableName ? '$' . $this->variableName : '') . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index edeed5f1..014b1acc 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -30,7 +30,7 @@ /** * Reflection class for a {@}property-write tag in a Docblock. */ -class PropertyWrite extends BaseTag implements Factory\StaticMethod +final class PropertyWrite extends BaseTag implements Factory\StaticMethod { /** @var string */ protected $name = 'property-write'; @@ -38,10 +38,10 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** @var Type|null */ private $type; - /** @var string */ + /** @var string|null */ protected $variableName = ''; - public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) + public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -90,7 +90,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName() : string + public function getVariableName() : ?string { return $this->variableName; } @@ -109,7 +109,7 @@ public function getType() : ?Type public function __toString() : string { return ($this->type ? $this->type . ' ' : '') - . '$' . $this->variableName + . ($this->variableName ? '$' . $this->variableName : '') . ($this->description ? ' ' . $this->description : ''); } } diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 1efdfbb7..2fb81353 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -69,6 +69,6 @@ public function getType() : Type public function __toString() : string { - return $this->type . ' ' . $this->description; + return $this->type . ' ' . (string) $this->description; } } diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index cb79e48c..21d85910 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -27,7 +27,7 @@ /** * Reflection class for an {@}see tag in a Docblock. */ -class See extends BaseTag implements Factory\StaticMethod +final class See extends BaseTag implements Factory\StaticMethod { /** @var string */ protected $name = 'see'; diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index 8e714a8f..31ce54c9 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -88,6 +88,6 @@ public function getVersion() : ?string */ public function __toString() : string { - return $this->version . ($this->description ? ' ' . $this->description->render() : ''); + return (string) $this->version . ($this->description ? ' ' . (string) $this->description : ''); } } diff --git a/src/DocBlock/Tags/Source.php b/src/DocBlock/Tags/Source.php index c6286fde..b678806e 100644 --- a/src/DocBlock/Tags/Source.php +++ b/src/DocBlock/Tags/Source.php @@ -72,7 +72,7 @@ public static function create( $description = $matches[3]; } - return new static($startingLine, $lineCount, $descriptionFactory->create($description, $context)); + return new static($startingLine, $lineCount, $descriptionFactory->create($description??'', $context)); } /** @@ -101,6 +101,6 @@ public function __toString() : string { return $this->startingLine . ($this->lineCount !== null ? ' ' . $this->lineCount : '') - . ($this->description ? ' ' . $this->description->render() : ''); + . ($this->description ? ' ' . (string) $this->description : ''); } } diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 3e9047ee..1a2328d5 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -69,6 +69,6 @@ public function getType() : Type public function __toString() : string { - return $this->type . ' ' . $this->description; + return (string) $this->type . ' ' . (string) $this->description; } } diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index 529c2b75..7a69642d 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -76,6 +76,6 @@ public function getReference() : Fqsen */ public function __toString() : string { - return $this->refers . ' ' . $this->description->render(); + return $this->refers . ' ' . (string) $this->description; } } diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index cf5b4d9a..1bd5b8ad 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -29,7 +29,7 @@ /** * Reflection class for a {@}var tag in a Docblock. */ -class Var_ extends BaseTag implements Factory\StaticMethod +final class Var_ extends BaseTag implements Factory\StaticMethod { /** @var string */ protected $name = 'var'; @@ -37,10 +37,10 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** @var Type|null */ private $type; - /** @var string */ + /** @var string|null */ protected $variableName = ''; - public function __construct(string $variableName, ?Type $type = null, ?Description $description = null) + public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { $this->variableName = $variableName; $this->type = $type; @@ -68,9 +68,7 @@ public static function create( // if the first item that is encountered is not a variable; it is a type if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { - if ($typeResolver !== null) { - $type = $typeResolver->resolve(array_shift($parts), $context); - } + $type = $typeResolver->resolve(array_shift($parts), $context); array_shift($parts); } @@ -92,7 +90,7 @@ public static function create( /** * Returns the variable's name. */ - public function getVariableName() : string + public function getVariableName() : ?string { return $this->variableName; } diff --git a/tests/unit/DocBlock/ExampleFinderTest.php b/tests/unit/DocBlock/ExampleFinderTest.php index 19a32f18..d135892b 100644 --- a/tests/unit/DocBlock/ExampleFinderTest.php +++ b/tests/unit/DocBlock/ExampleFinderTest.php @@ -39,7 +39,7 @@ public function setUp() : void */ public function testFileNotFound() : void { - $example = new Example('./example.php', false, 1, 0, new Description('Test')); + $example = new Example('./example.php', false, 1, 0, 'Test'); $this->assertSame('** File not found : ./example.php **', $this->fixture->find($example)); } } diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 91f06be5..1c965ad0 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -221,7 +221,8 @@ public function provideSummaryAndDescriptions() : array << Date: Wed, 11 Dec 2019 09:13:46 +0100 Subject: [PATCH 093/126] Bump minimal required php version --- composer.json | 2 +- composer.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index a072f63b..008f1d86 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ } ], "require": { - "php": "^7.1", + "php": "^7.2", "phpdocumentor/type-resolver": "^1.0", "webmozart/assert": "^1", "phpdocumentor/reflection-common": "^2.0", diff --git a/composer.lock b/composer.lock index e2ac299b..207ce3eb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "93c5a8174b30802326730535c6b1479f", + "content-hash": "2f0301d81fbb8c707a619b4e2bdb3a9c", "packages": [ { "name": "phpdocumentor/reflection-common", @@ -397,7 +397,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": "^7.1", + "php": "^7.2", "ext-filter": "^7.1" }, "platform-dev": [] From fc2eb2355ec51142a73ddc784cd09bdd782dc90b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 11 Dec 2019 09:18:05 +0100 Subject: [PATCH 094/126] Add phpdoc workflow --- .github/workflows/push.yml | 238 ++++++++++++++++++++++++++++++++----- 1 file changed, 208 insertions(+), 30 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4e53593b..dedadea8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,35 +1,213 @@ on: push name: Qa workflow jobs: - qa-checks: + setup: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master - - name: composer - uses: docker://composer - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: install --no-interaction --prefer-dist --optimize-autoloader - - name: Code style check - uses: docker://phpdoc/phpcs-ga:master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: -d memory_limit=1024M -s - - name: composer-require-checker - uses: docker://phpga/composer-require-checker-ga - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: check --config-file ./composer-require-config.json composer.json - - name: Psalm - uses: docker://mickaelandrieu/psalm-ga - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: PHPStan - uses: docker://oskarstark/phpstan-ga - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: analyse src --level max --configuration phpstan.neon + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: composer + uses: docker://composer + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: install --no-interaction --prefer-dist --optimize-autoloader + - name: composer-require-checker + uses: docker://phpga/composer-require-checker-ga + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: check --config-file ./composer-require-config.json composer.json + - name: Install phive + run: make install-phive + - name: Install PHAR dependencies + run: tools/phive.phar --no-progress install --copy --trust-gpg-keys 4AA394086372C20A,D2CCAC42F6295E7D,E82B2FB314E9906E,8E730BA25823D8B5 --force-accept-unsigned + + phpunit-with-coverage: + runs-on: ubuntu-latest + name: Unit tests + needs: setup + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Setup PHP + uses: shivammathur/setup-php@master + with: + php-version: 7.2 + extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib + ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 + coverage: xdebug + pecl: false + - name: Run PHPUnit + run: php tools/phpunit + + phpunit: + runs-on: ${{ matrix.operating-system }} + strategy: + matrix: + operating-system: + - ubuntu-latest + - windows-latest + - macOS-latest + php-versions: ['7.2', '7.3', '7.4'] + name: Unit tests for PHP version ${{ matrix.php-versions }} on ${{ matrix.operating-system }} + needs: + - setup + - phpunit-with-coverage + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Setup PHP + uses: shivammathur/setup-php@master + with: + php-version: ${{ matrix.php-versions }} + extension-csv: mbstring, intl, iconv, libxml, dom, json, simplexml, zlib + ini-values-csv: memory_limit=2G, display_errors=On, error_reporting=-1 + pecl: false + - name: Run PHPUnit + continue-on-error: true + run: php tools/phpunit + + codestyle: + runs-on: ubuntu-latest + needs: [setup, phpunit] + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Code style check + uses: docker://phpdoc/phpcs-ga:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: -d memory_limit=1024M + + phpstan: + runs-on: ubuntu-latest + needs: [setup, phpunit] + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: PHPStan + uses: docker://phpdoc/phpstan-ga:latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + args: analyse src --level max --configuration phpstan.neon + + psalm: + runs-on: ubuntu-latest + needs: [setup, phpunit] + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Restore/cache tools folder + uses: actions/cache@v1 + with: + path: tools + key: all-tools-${{ github.sha }} + restore-keys: | + all-tools-${{ github.sha }}- + all-tools- + - name: Psalm + uses: docker://mickaelandrieu/psalm-ga + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + bc_check: + name: BC Check + runs-on: ubuntu-latest + needs: [setup, phpunit] + steps: + - uses: actions/checkout@master + - name: Restore/cache vendor folder + uses: actions/cache@v1 + with: + path: vendor + key: all-build-${{ hashFiles('**/composer.lock') }} + restore-keys: | + all-build-${{ hashFiles('**/composer.lock') }} + all-build- + - name: Roave BC Check + uses: docker://nyholm/roave-bc-check-ga From 0bbc74b119d2b616eb9a1dfe1540f7d8f3e7506b Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 11 Dec 2019 09:32:27 +0100 Subject: [PATCH 095/126] Remove ci configs to switch to github actions --- .travis.yml | 40 -------------------------------------- appveyor.yml | 54 ---------------------------------------------------- 2 files changed, 94 deletions(-) delete mode 100644 .travis.yml delete mode 100644 appveyor.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f4cc4b39..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: php -php: [ 7.1, 7.2, 7.3, nightly ] -sudo: false - -env: - -matrix: - fast_finish: true - allow_failures: - - php: nightly - -install: - - travis_retry composer install --no-interaction --prefer-dist --optimize-autoloader - - travis_retry composer global require phpunit/phpunit ^6 # cannot use phpunit.phar or require-dev, because this package is a phpunit dep - - travis_retry wget --no-verbose https://phar.io/releases/phive.phar - -script: - - /home/travis/.composer/vendor/bin/phpunit --no-coverage - -jobs: - include: - - stage: coverage - php: 7.1 - script: - - /home/travis/.composer/vendor/bin/phpunit - after_script: - - travis_retry php phive.phar --no-progress install --trust-gpg-keys E82B2FB314E9906E php-coveralls/php-coveralls && ./tools/php-coveralls --verbose - - travis_retry wget --no-verbose https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - -cache: - directories: - - $HOME/.composer/cache/files - -notifications: - irc: "irc.freenode.org#phpdocumentor" - slack: - secure: "fjumM0h+4w3EYM4dpgqvpiCug7m4sSIC5+HATgwga/Nrc6IjlbWvGOv3JPgD3kQUhi18VmZfUYPmCv916SIbMnv8JWcrSaJXnPCgmxidvYkuzQDIw1HDJbVppGnkmwQA/qjIrM3sIEMfnu/arLRJQLI363aStZzGPxwIa4PDKcg=" - email: - - me@mikevanriel.com - - ashnazg@php.net diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2a650d99..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,54 +0,0 @@ -build: false -clone_folder: c:\reflectiondocblock -max_jobs: 3 -platform: x86 -pull_requests: - do_not_increment_build_number: true -version: '{build}.{branch}' -skip_tags: true -branches: - only: - - master - -environment: - matrix: - - php_ver_target: 7.1 - - php_ver_target: 7.2 -matrix: - fast_finish: false - -cache: - - c:\php -> appveyor.yml - - '%LOCALAPPDATA%\Composer\files' - -init: - - SET PATH=C:\Program Files\OpenSSL;c:\tools\php;%PATH% - - SET COMPOSER_NO_INTERACTION=1 - - SET PHP=1 - - SET ANSICON=121x90 (121x90) - - -install: - - IF EXIST c:\tools\php (SET PHP=0) - - ps: appveyor-retry cinst --params '""/InstallDir:C:\tools\php""' --ignore-checksums -y php --version ((choco search php --exact --all-versions -r | select-string -pattern $env:php_ver_target | sort { [version]($_ -split '\|' | select -last 1) } -Descending | Select-Object -first 1) -replace '[php|]','') - - cd c:\tools\php - - IF %PHP%==1 copy /Y php.ini-development php.ini - - IF %PHP%==1 echo max_execution_time=1200 >> php.ini - - IF %PHP%==1 echo date.timezone="UTC" >> php.ini - - IF %PHP%==1 echo extension_dir=ext >> php.ini - - IF %PHP%==1 echo extension=php_curl.dll >> php.ini - - IF %PHP%==1 echo extension=php_openssl.dll >> php.ini - - IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini - - IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini - - IF %PHP%==1 echo zend.assertions=1 >> php.ini - - IF %PHP%==1 echo assert.exception=On >> php.ini - - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat - - appveyor-retry appveyor DownloadFile https://getcomposer.org/composer.phar - - cd c:\reflectiondocblock - - composer install --no-interaction --prefer-dist --no-progress - - composer global require phpunit/phpunit ^6 - - composer global config bin-dir --absolute - -test_script: - - cd c:\reflectiondocblock - - c:\Users\appveyor\AppData\Roaming\Composer\vendor\bin\phpunit --no-coverage From 043df2c565a2d355c49ba559ebadd8c548e2a8f9 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 13 Dec 2019 15:31:58 +0100 Subject: [PATCH 096/126] remove bc check for now --- .github/workflows/push.yml | 17 ----------------- Makefile | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index dedadea8..d3ead8a4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -194,20 +194,3 @@ jobs: uses: docker://mickaelandrieu/psalm-ga env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - bc_check: - name: BC Check - runs-on: ubuntu-latest - needs: [setup, phpunit] - steps: - - uses: actions/checkout@master - - name: Restore/cache vendor folder - uses: actions/cache@v1 - with: - path: vendor - key: all-build-${{ hashFiles('**/composer.lock') }} - restore-keys: | - all-build-${{ hashFiles('**/composer.lock') }} - all-build- - - name: Roave BC Check - uses: docker://nyholm/roave-bc-check-ga diff --git a/Makefile b/Makefile index 374f1bde..b83dd98b 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ phpcs: .PHONY: phpstan phpstan: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpstan-ga:latest analyse src --debug --no-progress --level max --configuration phpstan.neon + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpstan-ga:latest analyse src --no-progress --level max --configuration phpstan.neon .PHONY: psaml psalm: From 79fd4a94752f1ec853aed8cf4ef12d4d5356044c Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 13 Dec 2019 16:01:35 +0100 Subject: [PATCH 097/126] Allow dependabot automerge --- .dependabot/config.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .dependabot/config.yml diff --git a/.dependabot/config.yml b/.dependabot/config.yml new file mode 100644 index 00000000..31264fe5 --- /dev/null +++ b/.dependabot/config.yml @@ -0,0 +1,12 @@ +version: 1 +update_configs: + - package_manager: "php:composer" + directory: "/" + update_schedule: "weekly" + automerged_updates: + - match: + dependency_type: "development" + update_type: "all" + - match: + dependency_type: "production" + update_type: "semver:patch" From 0461e3ca1a90f3b2e45475d6560bd91661c6edc0 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2019 14:43:48 +0000 Subject: [PATCH 098/126] Bump doctrine/instantiator from 1.1.0 to 1.3.0 Bumps [doctrine/instantiator](https://github.com/doctrine/instantiator) from 1.1.0 to 1.3.0. - [Release notes](https://github.com/doctrine/instantiator/releases) - [Commits](https://github.com/doctrine/instantiator/compare/1.1.0...1.3.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/composer.lock b/composer.lock index 207ce3eb..0f169f10 100644 --- a/composer.lock +++ b/composer.lock @@ -92,11 +92,7 @@ "phpDocumentor\\Reflection\\": "src" } }, - "autoload-dev": { - "psr-4": { - "phpDocumentor\\Reflection\\": "tests/unit" - } - }, + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -107,10 +103,6 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "support": { - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.0.0", - "issues": "https://github.com/phpDocumentor/TypeResolver/issues" - }, "time": "2019-07-08T19:35:58+00:00" }, { @@ -223,16 +215,16 @@ "packages-dev": [ { "name": "doctrine/instantiator", - "version": "1.2.0", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", "shasum": "" }, "require": { @@ -275,7 +267,7 @@ "constructor", "instantiate" ], - "time": "2019-03-17T17:37:11+00:00" + "time": "2019-10-21T16:45:58+00:00" }, { "name": "hamcrest/hamcrest-php", From 1aef412299c8901c2a80c384f026574557975894 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2019 14:43:49 +0000 Subject: [PATCH 099/126] Bump mockery/mockery from 1.1.0 to 1.3.0 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.1.0 to 1.3.0. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.1.0...1.3.0) Signed-off-by: dependabot-preview[bot] --- composer.lock | 255 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 248 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 0f169f10..f40e91c4 100644 --- a/composer.lock +++ b/composer.lock @@ -319,22 +319,23 @@ }, { "name": "mockery/mockery", - "version": "1.2.2", + "version": "1.3.0", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2" + "reference": "5571962a4f733fbb57bede39778f71647fae8e66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", - "reference": "0eb0b48c3f07b3b89f5169ce005b7d05b18cf1d2", + "url": "https://api.github.com/repos/mockery/mockery/zipball/5571962a4f733fbb57bede39778f71647fae8e66", + "reference": "5571962a4f733fbb57bede39778f71647fae8e66", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "~2.0", "lib-pcre": ">=7.0", - "php": ">=5.6.0" + "php": ">=5.6.0", + "sebastian/comparator": "^1.2.4|^3.0" }, "require-dev": { "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" @@ -342,7 +343,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.2.x-dev" } }, "autoload": { @@ -380,7 +381,247 @@ "test double", "testing" ], - "time": "2019-02-13T09:37:52+00:00" + "time": "2019-11-24T07:54:50+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" } ], "aliases": [], From 549d235cf426209ecb6d4dac3181c4da479050b5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Fri, 13 Dec 2019 15:04:03 +0000 Subject: [PATCH 100/126] Bump phpdocumentor/type-resolver from 0.6.2 to 1.0.1 Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 0.6.2 to 1.0.1. - [Release notes](https://github.com/phpDocumentor/TypeResolver/releases) - [Commits](https://github.com/phpDocumentor/TypeResolver/compare/0.6.2...1.0.1) Signed-off-by: dependabot-preview[bot] --- composer.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index f40e91c4..2b0a74e9 100644 --- a/composer.lock +++ b/composer.lock @@ -60,16 +60,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.0.0", + "version": "1.0.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "4dfca962ce4d6c11ae17efcc65621cc4b22004c7" + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/4dfca962ce4d6c11ae17efcc65621cc4b22004c7", - "reference": "4dfca962ce4d6c11ae17efcc65621cc4b22004c7", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", "shasum": "" }, "require": { @@ -103,7 +103,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-07-08T19:35:58+00:00" + "time": "2019-08-22T18:11:29+00:00" }, { "name": "symfony/polyfill-ctype", From 97b796040a47a11d2de09608d3c064434e3d2d50 Mon Sep 17 00:00:00 2001 From: Corey Taylor Date: Wed, 18 Dec 2019 17:21:02 -0600 Subject: [PATCH 101/126] Fixed @method annotations with an empty argument list and description --- src/DocBlock/Tags/Method.php | 6 +---- tests/unit/DocBlock/Tags/MethodTest.php | 34 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 4d42961c..984686db 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -120,12 +120,8 @@ public static function create( ) \s+ )? - # Legacy method name (not captured) - (?: - [\w_]+\(\)\s+ - )? # Method name - ([\w\|_\\\\]+) + ([\w_]+) # Arguments (?: \(([^\)]*)\) diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index f0ef1ff3..1b973799 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -472,6 +472,40 @@ public function testCreateMethodParenthesisMissing() : void $this->assertSame($description, $fixture->getDescription()); } + /** + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Fqsen + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create + */ + public function testCreateMethodEmptyArguments() : void + { + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + + $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); + + $fixture = Method::create( + 'static void myMethod() My Description', + $resolver, + $descriptionFactory, + $context + ); + + $this->assertSame('static void myMethod() My Description', (string) $fixture); + $this->assertSame('myMethod', $fixture->getMethodName()); + $this->assertEquals([], $fixture->getArguments()); + $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); + $this->assertSame($description, $fixture->getDescription()); + } + /** * @uses \phpDocumentor\Reflection\DocBlock\Tags\Method:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory From c19ab7ef57e75b5790aa912fd1cd14708e811970 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 20 Dec 2019 14:36:14 +0100 Subject: [PATCH 102/126] Upgrade phive phpstan:0.12.2 --- phive.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phive.xml b/phive.xml index 51687755..76a2c6a1 100644 --- a/phive.xml +++ b/phive.xml @@ -1,5 +1,5 @@ - + From 19dd184a2b067b3e54371299453c4074f50819bf Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Tue, 24 Dec 2019 20:14:32 +0100 Subject: [PATCH 103/126] Support braces in types for @return In this change, I have introduced a miniature automaton-light to parse the type from the @return body. This will prevent issues with people using generics and other unsupported forms of types. This change does _not_ allow for the use of Generics or similar; the TypeResolver will still fail to resolve this type. This will remove a breaking issue in consuming applications where a runtime exception used to be thrown. Please note that this change is only for @return; other tags still need to be done. This will resolve issue #186 --- src/DocBlock/Tags/Return_.php | 32 +++++++++++++++++++--- tests/unit/DocBlock/Tags/ReturnTest.php | 35 +++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 4 deletions(-) diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 2fb81353..1ae6632d 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -50,11 +50,10 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/\s+/Su', $body, 2); - Assert::isArray($parts); + list($type, $description) = self::splitBodyIntoTypeAndTheRest($body); - $type = $typeResolver->resolve($parts[0] ?? '', $context); - $description = $descriptionFactory->create($parts[1] ?? '', $context); + $type = $typeResolver->resolve($type, $context); + $description = $descriptionFactory->create($description, $context); return new static($type, $description); } @@ -71,4 +70,29 @@ public function __toString() : string { return $this->type . ' ' . (string) $this->description; } + + private static function splitBodyIntoTypeAndTheRest(string $body) : array + { + $type = ''; + $nestingLevel = 0; + for ($i = 0; $i < strlen($body); $i++) { + $character = $body[$i]; + + if (trim($character) === '' && $nestingLevel === 0) { + break; + } + + $type .= $character; + if (in_array($character, ['<', '(', '[', '{'])) { + $nestingLevel++; + } + if (in_array($character, ['>', ')', ']', '}'])) { + $nestingLevel--; + } + } + + $description = trim(substr($body, strlen($type))); + + return [$type, $description]; + } } diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 63ace030..18a0dc53 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -148,6 +148,41 @@ public function testFactoryMethod() : void $this->assertSame($description, $fixture->getDescription()); } + /** + * This test checks whether a braces in a Type are allowed. + * + * The advent of generics poses a few issues, one of them is that spaces can now be part of a type. In the past we + * could purely rely on spaces to split the individual parts of the body of a tag; but when there is a type in play + * we now need to check for braces. + * + * This test tests whether an error occurs demonstrating that the braces were taken into account; this test is still + * expected to produce an exception because the TypeResolver does not support generics. + * + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethodWithGenericWithSpace() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('"\array😁" is not a valid Fqsen.'); + + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); + + Return_::create('array😁 My Description', $resolver, $descriptionFactory, $context); + } + /** * @covers ::create */ From 0a9b8ea383f488d4b22076ce57464b92cba16434 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 27 Dec 2019 19:58:19 +0100 Subject: [PATCH 104/126] Add extra tests to check for multibyte behaviour --- tests/unit/DocBlock/Tags/ReturnTest.php | 57 ++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 18a0dc53..4fa23040 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -167,6 +167,34 @@ public function testFactoryMethod() : void * @uses \phpDocumentor\Reflection\Types\Context */ public function testFactoryMethodWithGenericWithSpace() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('"\array" is not a valid Fqsen.'); + + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); + + Return_::create('array My Description', $resolver, $descriptionFactory, $context); + } + + /** + * @see self::testFactoryMethodWithGenericWithSpace() + * + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('"\array😁" is not a valid Fqsen.'); @@ -180,7 +208,34 @@ public function testFactoryMethodWithGenericWithSpace() ->with('My Description', $context) ->andReturn($description); - Return_::create('array😁 My Description', $resolver, $descriptionFactory, $context); + Return_::create('array😁 My Description', $resolver, $descriptionFactory, $context); + } + + /** + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() + { + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); + + $fixture = Return_::create('\My😁Class My Description', $resolver, $descriptionFactory, $context); + + $this->assertSame('\My😁Class My Description', (string) $fixture); + $this->assertEquals('\My😁Class', $fixture->getType()); + $this->assertSame($description, $fixture->getDescription()); } /** From 506fd89d43d21f2c09d3db917e286749e7407361 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 27 Dec 2019 20:30:31 +0100 Subject: [PATCH 105/126] Move type extraction to base class and re-use in Throws --- src/DocBlock/Tags/Return_.php | 50 ++----------- src/DocBlock/Tags/TagWithType.php | 59 +++++++++++++++ src/DocBlock/Tags/Throws.php | 28 ++------ tests/unit/DocBlock/Tags/ThrowsTest.php | 96 ++++++++++++++++++++++++- 4 files changed, 165 insertions(+), 68 deletions(-) create mode 100644 src/DocBlock/Tags/TagWithType.php diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 1ae6632d..6d60b1d8 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -24,17 +24,12 @@ /** * Reflection class for a {@}return tag in a Docblock. */ -final class Return_ extends BaseTag implements Factory\StaticMethod +final class Return_ extends TagWithType implements Factory\StaticMethod { - /** @var string */ - protected $name = 'return'; - - /** @var Type */ - private $type; - - public function __construct(Type $type, ?Description $description = null) + public function __construct(Type $type, Description $description = null) { - $this->type = $type; + $this->name = 'return'; + $this->type = $type; $this->description = $description; } @@ -50,7 +45,7 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($type, $description) = self::splitBodyIntoTypeAndTheRest($body); + list($type, $description) = self::extractTypeFromBody($body); $type = $typeResolver->resolve($type, $context); $description = $descriptionFactory->create($description, $context); @@ -58,41 +53,8 @@ public static function create( return new static($type, $description); } - /** - * Returns the type section of the variable. - */ - public function getType() : Type - { - return $this->type; - } - - public function __toString() : string + public function __toString() :string { return $this->type . ' ' . (string) $this->description; } - - private static function splitBodyIntoTypeAndTheRest(string $body) : array - { - $type = ''; - $nestingLevel = 0; - for ($i = 0; $i < strlen($body); $i++) { - $character = $body[$i]; - - if (trim($character) === '' && $nestingLevel === 0) { - break; - } - - $type .= $character; - if (in_array($character, ['<', '(', '[', '{'])) { - $nestingLevel++; - } - if (in_array($character, ['>', ')', ']', '}'])) { - $nestingLevel--; - } - } - - $description = trim(substr($body, strlen($type))); - - return [$type, $description]; - } } diff --git a/src/DocBlock/Tags/TagWithType.php b/src/DocBlock/Tags/TagWithType.php new file mode 100644 index 00000000..e75ea321 --- /dev/null +++ b/src/DocBlock/Tags/TagWithType.php @@ -0,0 +1,59 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection\DocBlock\Tags; + +use phpDocumentor\Reflection\Type; + +abstract class TagWithType extends BaseTag +{ + /** @var Type */ + protected $type; + + /** + * Returns the type section of the variable. + * + * @return Type + */ + public function getType() + { + return $this->type; + } + + protected static function extractTypeFromBody(string $body) : array + { + $type = ''; + $nestingLevel = 0; + for ($i = 0; $i < strlen($body); $i++) { + $character = $body[$i]; + + if (trim($character) === '' && $nestingLevel === 0) { + break; + } + + $type .= $character; + if (in_array($character, ['<', '(', '[', '{'])) { + $nestingLevel++; + } + if (in_array($character, ['>', ')', ']', '}'])) { + $nestingLevel--; + } + } + + $description = trim(substr($body, strlen($type))); + + return [$type, $description]; + } +} diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index 1a2328d5..dc86c636 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -24,17 +24,12 @@ /** * Reflection class for a {@}throws tag in a Docblock. */ -final class Throws extends BaseTag implements Factory\StaticMethod +final class Throws extends TagWithType implements Factory\StaticMethod { - /** @var string */ - protected $name = 'throws'; - - /** @var Type */ - private $type; - - public function __construct(Type $type, ?Description $description = null) + public function __construct(Type $type, Description $description = null) { - $this->type = $type; + $this->name = 'throws'; + $this->type = $type; $this->description = $description; } @@ -50,23 +45,14 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/\s+/Su', $body, 2); - Assert::isArray($parts); + list($type, $description) = self::extractTypeFromBody($body); - $type = $typeResolver->resolve($parts[0] ?? '', $context); - $description = $descriptionFactory->create($parts[1] ?? '', $context); + $type = $typeResolver->resolve($type, $context); + $description = $descriptionFactory->create($description, $context); return new static($type, $description); } - /** - * Returns the type section of the variable. - */ - public function getType() : Type - { - return $this->type; - } - public function __toString() : string { return (string) $this->type . ' ' . (string) $this->description; diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index b4dec5eb..a5745e85 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -134,10 +134,10 @@ public function testStringRepresentationIsReturned() : void public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $type = new String_(); + $type = new String_(); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -148,6 +148,96 @@ public function testFactoryMethod() : void $this->assertSame($description, $fixture->getDescription()); } + /** + * This test checks whether a braces in a Type are allowed. + * + * The advent of generics poses a few issues, one of them is that spaces can now be part of a type. In the past we + * could purely rely on spaces to split the individual parts of the body of a tag; but when there is a type in play + * we now need to check for braces. + * + * This test tests whether an error occurs demonstrating that the braces were taken into account; this test is still + * expected to produce an exception because the TypeResolver does not support generics. + * + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethodWithGenericWithSpace() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('"\array" is not a valid Fqsen.'); + + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); + + Throws::create('array My Description', $resolver, $descriptionFactory, $context); + } + + /** + * @see self::testFactoryMethodWithGenericWithSpace() + * + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() + { + $this->expectException(\InvalidArgumentException::class); + $this->expectExceptionMessage('"\array😁" is not a valid Fqsen.'); + + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); + + Throws::create('array😁 My Description', $resolver, $descriptionFactory, $context); + } + + /** + * @covers ::create + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: + * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory + * @uses \phpDocumentor\Reflection\TypeResolver + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\Types\String_ + * @uses \phpDocumentor\Reflection\Types\Context + */ + public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() + { + $descriptionFactory = m::mock(DescriptionFactory::class); + $resolver = new TypeResolver(); + $context = new Context(''); + + $description = new Description('My Description'); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); + + $fixture = Throws::create('\My😁Class My Description', $resolver, $descriptionFactory, $context); + + $this->assertSame('\My😁Class My Description', (string) $fixture); + $this->assertEquals('\My😁Class', $fixture->getType()); + $this->assertSame($description, $fixture->getDescription()); + } + /** * @covers ::create */ From bb19583948aca4833e049487aeac247002ac811b Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 27 Dec 2019 20:44:28 +0100 Subject: [PATCH 106/126] Support braces in types for `@param` --- src/DocBlock/Tags/Param.php | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 967ed844..d8c5a047 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -29,14 +29,8 @@ /** * Reflection class for the {@}param tag in a Docblock. */ -final class Param extends BaseTag implements Factory\StaticMethod +final class Param extends TagWithType implements Factory\StaticMethod { - /** @var string */ - protected $name = 'param'; - - /** @var Type|null */ - private $type; - /** @var string|null */ private $variableName; @@ -49,6 +43,7 @@ public function __construct( bool $isVariadic = false, ?Description $description = null ) { + $this->name = 'param'; $this->variableName = $variableName; $this->type = $type; $this->isVariadic = $isVariadic; @@ -68,21 +63,24 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - Assert::isArray($parts); - $type = null; + list($firstPart, $body) = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; $isVariadic = false; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { - $type = $typeResolver->resolve(array_shift($parts), $context); - array_shift($parts); + if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { + $type = $typeResolver->resolve($firstPart, $context); + } else { + // first part is not a type; we should prepend it to the parts array for further processing + array_unshift($parts, $firstPart); } // if the next item starts with a $ or ...$ it must be the variable name - if (isset($parts[0]) && ($parts[0] !== '') && - (strpos($parts[0], '$') === 0 || strpos($parts[0], '...$') === 0) + if (isset($parts[0]) + && (strlen($parts[0]) > 0) + && ($parts[0][0] === '$' || substr($parts[0], 0, 4) === '...$') ) { $variableName = array_shift($parts); array_shift($parts); @@ -110,14 +108,6 @@ public function getVariableName() : ?string return $this->variableName; } - /** - * Returns the variable's type or null if unknown. - */ - public function getType() : ?Type - { - return $this->type; - } - /** * Returns whether this tag is variadic. */ From 1a5d9a2dbc54b48239a6c4b82db52e11a58212b6 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 27 Dec 2019 20:51:03 +0100 Subject: [PATCH 107/126] Add braces support to Property, Property-Read, Property-Write and Var --- src/DocBlock/Tags/Property.php | 33 +++++++++---------------- src/DocBlock/Tags/PropertyRead.php | 33 +++++++++---------------- src/DocBlock/Tags/PropertyWrite.php | 33 +++++++++---------------- src/DocBlock/Tags/Var_.php | 38 +++++++++++------------------ 4 files changed, 50 insertions(+), 87 deletions(-) diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 290a4fa6..76cd0984 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -29,19 +29,16 @@ /** * Reflection class for a {@}property tag in a Docblock. */ -final class Property extends BaseTag implements Factory\StaticMethod +final class Property extends TagWithType implements Factory\StaticMethod { - /** @var string */ - protected $name = 'property'; - - /** @var Type|null */ - private $type; - /** @var string|null */ protected $variableName = ''; public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { + Assert::string($variableName); + + $this->name = 'property'; $this->variableName = $variableName; $this->type = $type; $this->description = $description; @@ -60,15 +57,17 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - Assert::isArray($parts); - $type = null; + list($firstPart, $body) = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { - $type = $typeResolver->resolve(array_shift($parts), $context); - array_shift($parts); + if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { + $type = $typeResolver->resolve($firstPart, $context); + } else { + // first part is not a type; we should prepend it to the parts array for further processing + array_unshift($parts, $firstPart); } // if the next item starts with a $ or ...$ it must be the variable name @@ -94,14 +93,6 @@ public function getVariableName() : ?string return $this->variableName; } - /** - * Returns the variable's type or null if unknown. - */ - public function getType() : ?Type - { - return $this->type; - } - /** * Returns a string representation for this tag. */ diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 4e0c9041..762286b3 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -29,19 +29,16 @@ /** * Reflection class for a {@}property-read tag in a Docblock. */ -final class PropertyRead extends BaseTag implements Factory\StaticMethod +final class PropertyRead extends TagWithType implements Factory\StaticMethod { - /** @var string */ - protected $name = 'property-read'; - - /** @var Type|null */ - private $type; - /** @var string|null */ protected $variableName = ''; public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { + Assert::string($variableName); + + $this->name = 'property-read'; $this->variableName = $variableName; $this->type = $type; $this->description = $description; @@ -60,15 +57,17 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - Assert::isArray($parts); - $type = null; + list($firstPart, $body) = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { - $type = $typeResolver->resolve(array_shift($parts), $context); - array_shift($parts); + if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { + $type = $typeResolver->resolve($firstPart, $context); + } else { + // first part is not a type; we should prepend it to the parts array for further processing + array_unshift($parts, $firstPart); } // if the next item starts with a $ or ...$ it must be the variable name @@ -94,14 +93,6 @@ public function getVariableName() : ?string return $this->variableName; } - /** - * Returns the variable's type or null if unknown. - */ - public function getType() : ?Type - { - return $this->type; - } - /** * Returns a string representation for this tag. */ diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 014b1acc..98f61410 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -30,19 +30,16 @@ /** * Reflection class for a {@}property-write tag in a Docblock. */ -final class PropertyWrite extends BaseTag implements Factory\StaticMethod +final class PropertyWrite extends TagWithType implements Factory\StaticMethod { /** @var string */ - protected $name = 'property-write'; - - /** @var Type|null */ - private $type; - - /** @var string|null */ protected $variableName = ''; public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { + Assert::string($variableName); + + $this->name = 'property-write'; $this->variableName = $variableName; $this->type = $type; $this->description = $description; @@ -61,15 +58,17 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - Assert::isArray($parts); - $type = null; + list($firstPart, $body) = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { - $type = $typeResolver->resolve(array_shift($parts), $context); - array_shift($parts); + if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { + $type = $typeResolver->resolve($firstPart, $context); + } else { + // first part is not a type; we should prepend it to the parts array for further processing + array_unshift($parts, $firstPart); } // if the next item starts with a $ or ...$ it must be the variable name @@ -95,14 +94,6 @@ public function getVariableName() : ?string return $this->variableName; } - /** - * Returns the variable's type or null if unknown. - */ - public function getType() : ?Type - { - return $this->type; - } - /** * Returns a string representation for this tag. */ diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 1bd5b8ad..cc217589 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -29,22 +29,19 @@ /** * Reflection class for a {@}var tag in a Docblock. */ -final class Var_ extends BaseTag implements Factory\StaticMethod +final class Var_ extends TagWithType implements Factory\StaticMethod { - /** @var string */ - protected $name = 'var'; - - /** @var Type|null */ - private $type; - /** @var string|null */ protected $variableName = ''; public function __construct(?string $variableName, ?Type $type = null, ?Description $description = null) { + Assert::string($variableName); + + $this->name = 'var'; $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -60,16 +57,17 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - $parts = preg_split('/(\s+)/Su', $body, 3, PREG_SPLIT_DELIM_CAPTURE); - Assert::isArray($parts); - Assert::allString($parts); - $type = null; + list($firstPart, $body) = self::extractTypeFromBody($body); + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type - if (isset($parts[0]) && ($parts[0] !== '') && ($parts[0][0] !== '$')) { - $type = $typeResolver->resolve(array_shift($parts), $context); - array_shift($parts); + if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { + $type = $typeResolver->resolve($firstPart, $context); + } else { + // first part is not a type; we should prepend it to the parts array for further processing + array_unshift($parts, $firstPart); } // if the next item starts with a $ or ...$ it must be the variable name @@ -95,14 +93,6 @@ public function getVariableName() : ?string return $this->variableName; } - /** - * Returns the variable's type or null if unknown. - */ - public function getType() : ?Type - { - return $this->type; - } - /** * Returns a string representation for this tag. */ From b668892da47e1cb3c5d3f15b321050c87b61d518 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 27 Dec 2019 21:38:28 +0100 Subject: [PATCH 108/126] Fix tests and linting errors after merging in release 4.x --- src/DocBlock/Tags/Param.php | 11 ++++-- src/DocBlock/Tags/Property.php | 12 +++--- src/DocBlock/Tags/PropertyRead.php | 12 +++--- src/DocBlock/Tags/PropertyWrite.php | 11 +++--- src/DocBlock/Tags/Return_.php | 15 ++++---- src/DocBlock/Tags/TagWithType.php | 20 ++++++---- src/DocBlock/Tags/Throws.php | 11 +++--- src/DocBlock/Tags/Var_.php | 15 +++++--- tests/unit/DocBlock/Tags/ReturnTest.php | 43 ++++++++++++---------- tests/unit/DocBlock/Tags/ThrowsTest.php | 49 ++++++++++++++----------- 10 files changed, 112 insertions(+), 87 deletions(-) diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index d8c5a047..658ea973 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -21,8 +21,10 @@ use Webmozart\Assert\Assert; use const PREG_SPLIT_DELIM_CAPTURE; use function array_shift; +use function array_unshift; use function implode; use function preg_split; +use function strlen; use function strpos; use function substr; @@ -43,7 +45,7 @@ public function __construct( bool $isVariadic = false, ?Description $description = null ) { - $this->name = 'param'; + $this->name = 'param'; $this->variableName = $variableName; $this->type = $type; $this->isVariadic = $isVariadic; @@ -63,9 +65,10 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($firstPart, $body) = self::extractTypeFromBody($body); - $type = null; - $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + [$firstPart, $body] = self::extractTypeFromBody($body); + + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); $variableName = ''; $isVariadic = false; diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 76cd0984..81bff40c 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -21,8 +21,10 @@ use Webmozart\Assert\Assert; use const PREG_SPLIT_DELIM_CAPTURE; use function array_shift; +use function array_unshift; use function implode; use function preg_split; +use function strlen; use function strpos; use function substr; @@ -38,7 +40,7 @@ public function __construct(?string $variableName, ?Type $type = null, ?Descript { Assert::string($variableName); - $this->name = 'property'; + $this->name = 'property'; $this->variableName = $variableName; $this->type = $type; $this->description = $description; @@ -57,10 +59,10 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($firstPart, $body) = self::extractTypeFromBody($body); - $type = null; - $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); - $variableName = ''; + [$firstPart, $body] = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $variableName = ''; // if the first item that is encountered is not a variable; it is a type if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index 762286b3..a1f8c8a5 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -21,8 +21,10 @@ use Webmozart\Assert\Assert; use const PREG_SPLIT_DELIM_CAPTURE; use function array_shift; +use function array_unshift; use function implode; use function preg_split; +use function strlen; use function strpos; use function substr; @@ -38,7 +40,7 @@ public function __construct(?string $variableName, ?Type $type = null, ?Descript { Assert::string($variableName); - $this->name = 'property-read'; + $this->name = 'property-read'; $this->variableName = $variableName; $this->type = $type; $this->description = $description; @@ -57,10 +59,10 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($firstPart, $body) = self::extractTypeFromBody($body); - $type = null; - $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); - $variableName = ''; + [$firstPart, $body] = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $variableName = ''; // if the first item that is encountered is not a variable; it is a type if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 98f61410..ae57fdc3 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -21,6 +21,7 @@ use Webmozart\Assert\Assert; use const PREG_SPLIT_DELIM_CAPTURE; use function array_shift; +use function array_unshift; use function implode; use function preg_split; use function strlen; @@ -39,7 +40,7 @@ public function __construct(?string $variableName, ?Type $type = null, ?Descript { Assert::string($variableName); - $this->name = 'property-write'; + $this->name = 'property-write'; $this->variableName = $variableName; $this->type = $type; $this->description = $description; @@ -58,10 +59,10 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($firstPart, $body) = self::extractTypeFromBody($body); - $type = null; - $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); - $variableName = ''; + [$firstPart, $body] = self::extractTypeFromBody($body); + $type = null; + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $variableName = ''; // if the first item that is encountered is not a variable; it is a type if ($firstPart && (strlen($firstPart) > 0) && ($firstPart[0] !== '$')) { diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index 6d60b1d8..96808757 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -19,17 +19,16 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; -use function preg_split; /** * Reflection class for a {@}return tag in a Docblock. */ final class Return_ extends TagWithType implements Factory\StaticMethod { - public function __construct(Type $type, Description $description = null) + public function __construct(Type $type, ?Description $description = null) { - $this->name = 'return'; - $this->type = $type; + $this->name = 'return'; + $this->type = $type; $this->description = $description; } @@ -45,16 +44,16 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($type, $description) = self::extractTypeFromBody($body); + [$type, $description] = self::extractTypeFromBody($body); - $type = $typeResolver->resolve($type, $context); + $type = $typeResolver->resolve($type, $context); $description = $descriptionFactory->create($description, $context); return new static($type, $description); } - public function __toString() :string + public function __toString() : string { - return $this->type . ' ' . (string) $this->description; + return ($this->type ?: 'mixed') . ' ' . (string) $this->description; } } diff --git a/src/DocBlock/Tags/TagWithType.php b/src/DocBlock/Tags/TagWithType.php index e75ea321..9cd485cb 100644 --- a/src/DocBlock/Tags/TagWithType.php +++ b/src/DocBlock/Tags/TagWithType.php @@ -8,33 +8,36 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. * - * @copyright 2010-2015 Mike van Riel - * @license http://www.opensource.org/licenses/mit-license.php MIT * @link http://phpdoc.org */ namespace phpDocumentor\Reflection\DocBlock\Tags; use phpDocumentor\Reflection\Type; +use function in_array; +use function strlen; +use function substr; +use function trim; abstract class TagWithType extends BaseTag { - /** @var Type */ + /** @var ?Type */ protected $type; /** * Returns the type section of the variable. - * - * @return Type */ - public function getType() + public function getType() : ?Type { return $this->type; } + /** + * @return string[] + */ protected static function extractTypeFromBody(string $body) : array { - $type = ''; + $type = ''; $nestingLevel = 0; for ($i = 0; $i < strlen($body); $i++) { $character = $body[$i]; @@ -46,9 +49,12 @@ protected static function extractTypeFromBody(string $body) : array $type .= $character; if (in_array($character, ['<', '(', '[', '{'])) { $nestingLevel++; + continue; } + if (in_array($character, ['>', ')', ']', '}'])) { $nestingLevel--; + continue; } } diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index dc86c636..549883aa 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -19,17 +19,16 @@ use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; use Webmozart\Assert\Assert; -use function preg_split; /** * Reflection class for a {@}throws tag in a Docblock. */ final class Throws extends TagWithType implements Factory\StaticMethod { - public function __construct(Type $type, Description $description = null) + public function __construct(Type $type, ?Description $description = null) { - $this->name = 'throws'; - $this->type = $type; + $this->name = 'throws'; + $this->type = $type; $this->description = $description; } @@ -45,9 +44,9 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($type, $description) = self::extractTypeFromBody($body); + [$type, $description] = self::extractTypeFromBody($body); - $type = $typeResolver->resolve($type, $context); + $type = $typeResolver->resolve($type, $context); $description = $descriptionFactory->create($description, $context); return new static($type, $description); diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index cc217589..8f1ae426 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -21,8 +21,10 @@ use Webmozart\Assert\Assert; use const PREG_SPLIT_DELIM_CAPTURE; use function array_shift; +use function array_unshift; use function implode; use function preg_split; +use function strlen; use function strpos; use function substr; @@ -38,10 +40,10 @@ public function __construct(?string $variableName, ?Type $type = null, ?Descript { Assert::string($variableName); - $this->name = 'var'; + $this->name = 'var'; $this->variableName = $variableName; - $this->type = $type; - $this->description = $description; + $this->type = $type; + $this->description = $description; } /** @@ -57,9 +59,10 @@ public static function create( Assert::notNull($typeResolver); Assert::notNull($descriptionFactory); - list($firstPart, $body) = self::extractTypeFromBody($body); - $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); - $type = null; + [$firstPart, $body] = self::extractTypeFromBody($body); + + $parts = preg_split('/(\s+)/Su', $body, 2, PREG_SPLIT_DELIM_CAPTURE); + $type = null; $variableName = ''; // if the first item that is encountered is not a variable; it is a type diff --git a/tests/unit/DocBlock/Tags/ReturnTest.php b/tests/unit/DocBlock/Tags/ReturnTest.php index 4fa23040..aad958ce 100644 --- a/tests/unit/DocBlock/Tags/ReturnTest.php +++ b/tests/unit/DocBlock/Tags/ReturnTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; +use InvalidArgumentException; use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; @@ -158,50 +159,53 @@ public function testFactoryMethod() : void * This test tests whether an error occurs demonstrating that the braces were taken into account; this test is still * expected to produce an exception because the TypeResolver does not support generics. * - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithGenericWithSpace() + public function testFactoryMethodWithGenericWithSpace() : void { - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('"\array" is not a valid Fqsen.'); - $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create') ->with('My Description', $context) ->andReturn($description); - Return_::create('array My Description', $resolver, $descriptionFactory, $context); + $fixture = Return_::create('array My Description', $resolver, $descriptionFactory, $context); + + $this->assertSame('array My Description', (string) $fixture); + $this->assertEquals('array', $fixture->getType()); + $this->assertSame($description, $fixture->getDescription()); } /** - * @see self::testFactoryMethodWithGenericWithSpace() - * - * @covers ::create + * @see self::testFactoryMethodWithGenericWithSpace() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() + public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() : void { - $this->expectException(\InvalidArgumentException::class); + $this->markTestSkipped('A bug in the TypeResolver breaks this test'); + $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('"\array😁" is not a valid Fqsen.'); $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create') @@ -212,19 +216,20 @@ public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMulti } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Return_:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() + public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create') diff --git a/tests/unit/DocBlock/Tags/ThrowsTest.php b/tests/unit/DocBlock/Tags/ThrowsTest.php index a5745e85..ab1f759a 100644 --- a/tests/unit/DocBlock/Tags/ThrowsTest.php +++ b/tests/unit/DocBlock/Tags/ThrowsTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; +use InvalidArgumentException; use Mockery as m; use phpDocumentor\Reflection\DocBlock\Description; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; @@ -134,10 +135,10 @@ public function testStringRepresentationIsReturned() : void public function testFactoryMethod() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); - $type = new String_(); + $type = new String_(); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -158,50 +159,53 @@ public function testFactoryMethod() : void * This test tests whether an error occurs demonstrating that the braces were taken into account; this test is still * expected to produce an exception because the TypeResolver does not support generics. * - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithGenericWithSpace() + public function testFactoryMethodWithGenericWithSpace() : void { - $this->expectException(\InvalidArgumentException::class); - $this->expectExceptionMessage('"\array" is not a valid Fqsen.'); - $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create') ->with('My Description', $context) ->andReturn($description); - Throws::create('array My Description', $resolver, $descriptionFactory, $context); + $fixture = Throws::create('array My Description', $resolver, $descriptionFactory, $context); + + $this->assertSame('array My Description', (string) $fixture); + $this->assertEquals('array', $fixture->getType()); + $this->assertSame($description, $fixture->getDescription()); } /** - * @see self::testFactoryMethodWithGenericWithSpace() - * - * @covers ::create + * @see self::testFactoryMethodWithGenericWithSpace() * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() + public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMultiByteBehaviour() : void { - $this->expectException(\InvalidArgumentException::class); + $this->markTestSkipped('A bug in the TypeResolver breaks this test'); + $this->expectException(InvalidArgumentException::class); $this->expectExceptionMessage('"\array😁" is not a valid Fqsen.'); $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create') @@ -212,19 +216,20 @@ public function testFactoryMethodWithGenericWithSpaceAndAddedEmojisToVerifyMulti } /** - * @covers ::create * @uses \phpDocumentor\Reflection\DocBlock\Tags\Throws:: * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory * @uses \phpDocumentor\Reflection\TypeResolver * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\String_ * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::create */ - public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() + public function testFactoryMethodWithEmojisToVerifyMultiByteBehaviour() : void { $descriptionFactory = m::mock(DescriptionFactory::class); - $resolver = new TypeResolver(); - $context = new Context(''); + $resolver = new TypeResolver(); + $context = new Context(''); $description = new Description('My Description'); $descriptionFactory->shouldReceive('create') From c5a39003d5c0ef8e605d123d23355b1cb4112735 Mon Sep 17 00:00:00 2001 From: Mike van Riel Date: Fri, 27 Dec 2019 21:42:04 +0100 Subject: [PATCH 109/126] Fixes #181: Example did not implement interface --- src/DocBlock/Tags/Example.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 020145fd..d27ed477 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -25,7 +25,7 @@ /** * Reflection class for a {@}example tag in a Docblock. */ -final class Example implements Tag +final class Example implements Tag, Factory\StaticMethod { /** @var string Path to a file to use as an example. May also be an absolute URI. */ private $filePath; From 43f90ab91c74983651778dfcb4b906cd6d6e7fa2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 30 Dec 2019 09:29:14 +0000 Subject: [PATCH 110/126] Bump mockery/mockery from 1.3.0 to 1.3.1 Bumps [mockery/mockery](https://github.com/mockery/mockery) from 1.3.0 to 1.3.1. - [Release notes](https://github.com/mockery/mockery/releases) - [Changelog](https://github.com/mockery/mockery/blob/master/CHANGELOG.md) - [Commits](https://github.com/mockery/mockery/compare/1.3.0...1.3.1) Signed-off-by: dependabot-preview[bot] --- composer.lock | 255 ++------------------------------------------------ 1 file changed, 7 insertions(+), 248 deletions(-) diff --git a/composer.lock b/composer.lock index 2b0a74e9..14b2b0bb 100644 --- a/composer.lock +++ b/composer.lock @@ -319,23 +319,22 @@ }, { "name": "mockery/mockery", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "5571962a4f733fbb57bede39778f71647fae8e66" + "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/5571962a4f733fbb57bede39778f71647fae8e66", - "reference": "5571962a4f733fbb57bede39778f71647fae8e66", + "url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", + "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "~2.0", "lib-pcre": ">=7.0", - "php": ">=5.6.0", - "sebastian/comparator": "^1.2.4|^3.0" + "php": ">=5.6.0" }, "require-dev": { "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" @@ -343,7 +342,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -381,247 +380,7 @@ "test double", "testing" ], - "time": "2019-11-24T07:54:50+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2019-02-04T06:01:07+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", - "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2019-09-14T09:02:43+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" + "time": "2019-12-26T09:49:15+00:00" } ], "aliases": [], From bdecc2d3bfd4019b506b77815a75c88771b95009 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 3 Jan 2020 13:33:06 +0100 Subject: [PATCH 111/126] Fix issue when processing invalid tags When invalid tags are processed a null was returned causing all kind of issues in the normal behavior of this libary. As a solution a generic tag could be created. But that would just drop the error information in. Therefore a new tag was introduced, `invalidTag` the tag is just like the generic tag but does contain the error triggered during the creation of the tag. Which might help applications like phpdocumentor to display validation issues. --- src/DocBlock/DescriptionFactory.php | 5 +- src/DocBlock/StandardTagFactory.php | 7 +- src/DocBlock/TagFactory.php | 2 +- src/DocBlock/Tags/InvalidTag.php | 72 +++++++++++++++++++ src/DocBlockFactory.php | 8 +-- .../unit/DocBlock/DescriptionFactoryTest.php | 27 +++++++ tests/unit/DocBlockFactoryTest.php | 33 --------- 7 files changed, 106 insertions(+), 48 deletions(-) create mode 100644 src/DocBlock/Tags/InvalidTag.php diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 746a2c2e..267e5af4 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -69,10 +69,7 @@ public function create(string $contents, ?TypeContext $context = null) : Descrip $tags = []; for ($i = 1; $i < $count; $i += 2) { - $tag = $this->tagFactory->create($tokens[$i], $context); - if ($tag !== null) { - $tags[] = $tag; - } + $tags[] = $this->tagFactory->create($tokens[$i], $context); $tokens[$i] = '%' . ++$tagCount . '$s'; } diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 59caf8c5..c7f5736b 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Deprecated; use phpDocumentor\Reflection\DocBlock\Tags\Factory\StaticMethod; use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; use phpDocumentor\Reflection\DocBlock\Tags\Method; use phpDocumentor\Reflection\DocBlock\Tags\Param; @@ -138,7 +139,7 @@ public function __construct(FqsenResolver $fqsenResolver, ?array $tagHandlers = /** * {@inheritDoc} */ - public function create(string $tagLine, ?TypeContext $context = null) : ?Tag + public function create(string $tagLine, ?TypeContext $context = null) : Tag { if (!$context) { $context = new TypeContext(''); @@ -215,7 +216,7 @@ private function extractTagParts(string $tagLine) : array * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. */ - private function createTag(string $body, string $name, TypeContext $context) : ?Tag + private function createTag(string $body, string $name, TypeContext $context) : Tag { $handlerClassName = $this->findHandlerClassName($name, $context); $arguments = $this->getArgumentsForParametersFromWiring( @@ -228,7 +229,7 @@ private function createTag(string $body, string $name, TypeContext $context) : ? $callable = [$handlerClassName, 'create']; return call_user_func_array($callable, $arguments); } catch (InvalidArgumentException $e) { - return null; + return InvalidTag::create($body, $name, $e); } } diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index e52e88d7..1a2dc893 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -49,7 +49,7 @@ public function addParameter(string $name, $value) : void; * * @throws InvalidArgumentException If an invalid tag line was presented. */ - public function create(string $tagLine, ?TypeContext $context = null) : ?Tag; + public function create(string $tagLine, ?TypeContext $context = null) : Tag; /** * Registers a service with the Service Locator using the FQCN of the class or the alias, if provided. diff --git a/src/DocBlock/Tags/InvalidTag.php b/src/DocBlock/Tags/InvalidTag.php new file mode 100644 index 00000000..f098c55c --- /dev/null +++ b/src/DocBlock/Tags/InvalidTag.php @@ -0,0 +1,72 @@ +name = $name; + $this->body = $body; + $this->throwable = $throwable; + } + + public function getException() : Throwable + { + return $this->throwable; + } + + public function getName() : string + { + return $this->name; + } + + /** + * @inheritDoc + */ + public static function create(string $body, string $name = '', ?Throwable $exception = null) + { + Assert::notNull($exception); + + return new self($name, $body, $exception); + } + + public function render(?Formatter $formatter = null) : string + { + if ($formatter === null) { + $formatter = new Formatter\PassthroughFormatter(); + } + + return $formatter->format($this); + } + + public function __toString() : string + { + return $this->body; + } +} diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 30559682..1e669b5e 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -17,7 +17,6 @@ use LogicException; use phpDocumentor\Reflection\DocBlock\DescriptionFactory; use phpDocumentor\Reflection\DocBlock\StandardTagFactory; -use phpDocumentor\Reflection\DocBlock\Tag; use phpDocumentor\Reflection\DocBlock\TagFactory; use Webmozart\Assert\Assert; use function array_shift; @@ -236,12 +235,7 @@ private function parseTagBlock(string $tags, Types\Context $context) : array $result = []; $lines = $this->splitTagBlockIntoTagLines($tags); foreach ($lines as $key => $tagLine) { - $tag = $this->tagFactory->create(trim($tagLine), $context); - if (!($tag instanceof Tag)) { - continue; - } - - $result[$key] = $tag; + $result[$key] = $this->tagFactory->create(trim($tagLine), $context); } return $result; diff --git a/tests/unit/DocBlock/DescriptionFactoryTest.php b/tests/unit/DocBlock/DescriptionFactoryTest.php index e10978e5..3c4647f3 100644 --- a/tests/unit/DocBlock/DescriptionFactoryTest.php +++ b/tests/unit/DocBlock/DescriptionFactoryTest.php @@ -13,7 +13,9 @@ namespace phpDocumentor\Reflection\DocBlock; +use Exception; use Mockery as m; +use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; use phpDocumentor\Reflection\DocBlock\Tags\Link as LinkTag; use phpDocumentor\Reflection\Types\Context; use PHPUnit\Framework\TestCase; @@ -162,6 +164,31 @@ public function testIfSuperfluousStartingSpacesAreRemoved() : void $this->assertSame($expectedDescription, $description->render()); } + /** + * @uses \phpDocumentor\Reflection\DocBlock\Description + * @uses \phpDocumentor\Reflection\DocBlock\Tags\InvalidTag + * @uses \phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter + * @uses \phpDocumentor\Reflection\Types\Context + * + * @covers ::__construct + * @covers ::create + */ + public function testDescriptionWithBrokenInlineTags() : void + { + $contents = 'This {@see $name} is a broken use case, but used in real life.'; + $context = new Context(''); + $tagFactory = m::mock(TagFactory::class); + $tagFactory->shouldReceive('create') + ->once() + ->with('@see $name', $context) + ->andReturn(InvalidTag::create('$name', 'see', new Exception())); + + $factory = new DescriptionFactory($tagFactory); + $description = $factory->create($contents, $context); + + $this->assertSame($contents, $description->render()); + } + /** * Provides a series of example strings that the parser should correctly interpret and return. * diff --git a/tests/unit/DocBlockFactoryTest.php b/tests/unit/DocBlockFactoryTest.php index 1c965ad0..2298a01a 100644 --- a/tests/unit/DocBlockFactoryTest.php +++ b/tests/unit/DocBlockFactoryTest.php @@ -279,37 +279,4 @@ public function testTagsWithContextNamespace() : void $this->assertInstanceOf(DocBlock::class, $docblock); } - - /** - * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory - * @uses \phpDocumentor\Reflection\DocBlock\Description - * - * @covers ::__construct - * @covers ::create - */ - public function testTagsAreFilteredForNullValues() : void - { - $tagString = << This is with - multiline description. -TAG; - - $tagFactory = m::mock(TagFactory::class); - $tagFactory->shouldReceive('create')->with($tagString, m::any())->andReturn(null); - - $fixture = new DocBlockFactory(new DescriptionFactory($tagFactory), $tagFactory); - - $given = << This is with - * multiline description. - */ -DOCBLOCK; - - $docblock = $fixture->create($given, new Context('')); - - $this->assertEquals([], $docblock->getTags()); - } } From 1b78639b8bc20d8dc26fa55da62caa36d197e9dc Mon Sep 17 00:00:00 2001 From: Jaapio Date: Fri, 3 Jan 2020 14:06:44 +0100 Subject: [PATCH 112/126] Add testcase for invalid tag creation --- tests/unit/DocBlock/StandardTagFactoryTest.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 5e4ee4cb..25542f9e 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -18,6 +18,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Formatter; use phpDocumentor\Reflection\DocBlock\Tags\Formatter\PassthroughFormatter; use phpDocumentor\Reflection\DocBlock\Tags\Generic; +use phpDocumentor\Reflection\DocBlock\Tags\InvalidTag; use phpDocumentor\Reflection\DocBlock\Tags\Return_; use phpDocumentor\Reflection\DocBlock\Tags\See; use phpDocumentor\Reflection\Fqsen; @@ -330,4 +331,14 @@ public function testReturnTagIsMappedCorrectly() : void $this->assertInstanceOf(Return_::class, $tag); $this->assertSame('return', $tag->getName()); } + + public function testInvalidTagIsReturnedOnFailure() + { + $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); + + /** @var InvalidTag $tag */ + $tag = $tagFactory->create('@see $name some invalid tag'); + + $this->assertInstanceOf(InvalidTag::class, $tag); + } } From bb629f6469b23ebe0470b48578e33beeeea0517e Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 12 Jan 2020 13:17:36 +0100 Subject: [PATCH 113/126] Improvements to code --- src/DocBlock/StandardTagFactory.php | 2 +- src/DocBlock/Tags/InvalidTag.php | 26 +++++++----- .../unit/DocBlock/StandardTagFactoryTest.php | 2 +- tests/unit/DocBlock/Tags/InvalidTagTest.php | 41 +++++++++++++++++++ 4 files changed, 59 insertions(+), 12 deletions(-) create mode 100644 tests/unit/DocBlock/Tags/InvalidTagTest.php diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index c7f5736b..3abbc4ae 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -229,7 +229,7 @@ private function createTag(string $body, string $name, TypeContext $context) : T $callable = [$handlerClassName, 'create']; return call_user_func_array($callable, $arguments); } catch (InvalidArgumentException $e) { - return InvalidTag::create($body, $name, $e); + return InvalidTag::create($body, $name)->withError($e); } } diff --git a/src/DocBlock/Tags/InvalidTag.php b/src/DocBlock/Tags/InvalidTag.php index f098c55c..373d6653 100644 --- a/src/DocBlock/Tags/InvalidTag.php +++ b/src/DocBlock/Tags/InvalidTag.php @@ -6,7 +6,6 @@ use phpDocumentor\Reflection\DocBlock\Tag; use Throwable; -use Webmozart\Assert\Assert; /** * This class represents an exception during the tag creation @@ -26,17 +25,16 @@ final class InvalidTag implements Tag /** @var string */ private $body; - /** @var Throwable */ + /** @var Throwable|null */ private $throwable; - private function __construct(string $name, string $body, Throwable $throwable) + private function __construct(string $name, string $body) { - $this->name = $name; - $this->body = $body; - $this->throwable = $throwable; + $this->name = $name; + $this->body = $body; } - public function getException() : Throwable + public function getException() : ?Throwable { return $this->throwable; } @@ -47,13 +45,21 @@ public function getName() : string } /** + * @return self + * * @inheritDoc */ - public static function create(string $body, string $name = '', ?Throwable $exception = null) + public static function create(string $body, string $name = '') { - Assert::notNull($exception); + return new self($name, $body); + } + + public function withError(Throwable $exception) : self + { + $tag = new self($this->name, $this->body); + $tag->throwable = $exception; - return new self($name, $body, $exception); + return $tag; } public function render(?Formatter $formatter = null) : string diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 25542f9e..9235344c 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -332,7 +332,7 @@ public function testReturnTagIsMappedCorrectly() : void $this->assertSame('return', $tag->getName()); } - public function testInvalidTagIsReturnedOnFailure() + public function testInvalidTagIsReturnedOnFailure() : void { $tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class)); diff --git a/tests/unit/DocBlock/Tags/InvalidTagTest.php b/tests/unit/DocBlock/Tags/InvalidTagTest.php new file mode 100644 index 00000000..2fc045b2 --- /dev/null +++ b/tests/unit/DocBlock/Tags/InvalidTagTest.php @@ -0,0 +1,41 @@ + + * @covers ::getName + * @covers ::render + * @covers ::getException + * @covers ::create + */ +final class InvalidTagTest extends TestCase +{ + public function testCreationWithoutError() : void + { + $tag = InvalidTag::create('Body', 'name'); + + self::assertSame('name', $tag->getName()); + self::assertSame('@name Body', $tag->render()); + self::assertNull($tag->getException()); + } + + /** + * @covers ::withError + */ + public function testCreationWithError() : void + { + $exception = new Exception(); + $tag = InvalidTag::create('Body', 'name')->withError($exception); + + self::assertSame('name', $tag->getName()); + self::assertSame('@name Body', $tag->render()); + self::assertSame($exception, $tag->getException()); + } +} From ce65c06bb699fe31b43aaddfe9292c2b8f55e784 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 16 Jan 2020 09:38:58 +0100 Subject: [PATCH 114/126] Fix serialization issue of InvalidTag --- src/DocBlock/Tags/InvalidTag.php | 45 +++++++++++++++++ tests/unit/DocBlock/Tags/InvalidTagTest.php | 55 +++++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/src/DocBlock/Tags/InvalidTag.php b/src/DocBlock/Tags/InvalidTag.php index 373d6653..a3b68d41 100644 --- a/src/DocBlock/Tags/InvalidTag.php +++ b/src/DocBlock/Tags/InvalidTag.php @@ -4,7 +4,10 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; +use Closure; use phpDocumentor\Reflection\DocBlock\Tag; +use ReflectionClass; +use ReflectionFunction; use Throwable; /** @@ -56,12 +59,54 @@ public static function create(string $body, string $name = '') public function withError(Throwable $exception) : self { + $this->flattenExceptionBacktrace($exception); $tag = new self($this->name, $this->body); $tag->throwable = $exception; return $tag; } + /** + * Removes all complex types from backtrace + * + * Not all objects are serializable. So we need to remove them from the + * stored exception to be sure that we do not break existing library usage. + */ + private function flattenExceptionBacktrace(Throwable $exception) : void + { + $traceProperty = (new ReflectionClass('Exception'))->getProperty('trace'); + $traceProperty->setAccessible(true); + + $flatten = static function (&$value) { + if ($value instanceof Closure) { + $closureReflection = new ReflectionFunction($value); + $value = sprintf( + '(Closure at %s:%s)', + $closureReflection->getFileName(), + $closureReflection->getStartLine() + ); + } elseif (is_object($value)) { + $value = sprintf('object(%s)', get_class($value)); + } elseif (is_resource($value)) { + $value = sprintf('resource(%s)', get_resource_type($value)); + } + }; + + do { + $trace = array_map( + static function($call) use ($flatten) { + array_walk_recursive($call['args'], $flatten); + + return $call; + }, + $exception->getTrace() + ); + $traceProperty->setValue($exception, $trace); + } while ($exception = $exception->getPrevious()); + + $traceProperty->setAccessible(false); + } + public function render(?Formatter $formatter = null) : string { if ($formatter === null) { diff --git a/tests/unit/DocBlock/Tags/InvalidTagTest.php b/tests/unit/DocBlock/Tags/InvalidTagTest.php index 2fc045b2..c562ef3f 100644 --- a/tests/unit/DocBlock/Tags/InvalidTagTest.php +++ b/tests/unit/DocBlock/Tags/InvalidTagTest.php @@ -5,6 +5,7 @@ namespace phpDocumentor\Reflection\DocBlock\Tags; use Exception; +use InvalidArgumentException; use PHPUnit\Framework\TestCase; /** @@ -28,6 +29,7 @@ public function testCreationWithoutError() : void /** * @covers ::withError + * @covers ::__toString */ public function testCreationWithError() : void { @@ -36,6 +38,59 @@ public function testCreationWithError() : void self::assertSame('name', $tag->getName()); self::assertSame('@name Body', $tag->render()); + self::assertSame('Body', (string)$tag); self::assertSame($exception, $tag->getException()); } + + public function testCreationWithErrorContainingClosure() : void + { + try { + $this->throwExceptionFromClosureWithClosureArgument(); + } catch (Exception $e) { + $parentException = new Exception('test', 0, $e); + $tag = InvalidTag::create('Body', 'name')->withError($parentException); + self::assertSame('name', $tag->getName()); + self::assertSame('@name Body', $tag->render()); + self::assertSame($parentException, $tag->getException()); + self::assertStringStartsWith('(Closure at', $tag->getException()->getPrevious()->getTrace()[0]['args'][0]); + self::assertStringContainsString(__FILE__, $tag->getException()->getPrevious()->getTrace()[0]['args'][0]); + self::assertEquals($parentException, unserialize(serialize($parentException))); + } + } + + private function throwExceptionFromClosureWithClosureArgument() + { + $function = function() { + throw new InvalidArgumentException(); + }; + + $function($function); + } + + public function testCreationWithErrorContainingResource() + { + try { + $this->throwExceptionWithResourceArgument(); + } catch (Exception $e) { + $parentException = new Exception('test', 0, $e); + $tag = InvalidTag::create('Body', 'name')->withError($parentException); + self::assertSame('name', $tag->getName()); + self::assertSame('@name Body', $tag->render()); + self::assertSame($parentException, $tag->getException()); + self::assertStringStartsWith( + 'resource(stream)', + $tag->getException()->getPrevious()->getTrace()[0]['args'][0]) + ; + self::assertEquals($parentException, unserialize(serialize($parentException))); + } + } + + private function throwExceptionWithResourceArgument() + { + $function = function() { + throw new InvalidArgumentException(); + }; + + $function(fopen(__FILE__, 'r')); + } } From cf16f630f2211d388b8d254bf2ea936c232b3cb4 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Thu, 16 Jan 2020 09:49:07 +0100 Subject: [PATCH 115/126] Fix code style --- src/DocBlock/Tags/InvalidTag.php | 42 +++++++++++++-------- tests/unit/DocBlock/Tags/InvalidTagTest.php | 28 ++++++++------ 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/DocBlock/Tags/InvalidTag.php b/src/DocBlock/Tags/InvalidTag.php index a3b68d41..a531c036 100644 --- a/src/DocBlock/Tags/InvalidTag.php +++ b/src/DocBlock/Tags/InvalidTag.php @@ -9,6 +9,13 @@ use ReflectionClass; use ReflectionFunction; use Throwable; +use function array_map; +use function array_walk_recursive; +use function get_class; +use function get_resource_type; +use function is_object; +use function is_resource; +use function sprintf; /** * This class represents an exception during the tag creation @@ -77,24 +84,26 @@ private function flattenExceptionBacktrace(Throwable $exception) : void $traceProperty = (new ReflectionClass('Exception'))->getProperty('trace'); $traceProperty->setAccessible(true); - $flatten = static function (&$value) { - if ($value instanceof Closure) { - $closureReflection = new ReflectionFunction($value); - $value = sprintf( - '(Closure at %s:%s)', - $closureReflection->getFileName(), - $closureReflection->getStartLine() - ); - } elseif (is_object($value)) { - $value = sprintf('object(%s)', get_class($value)); - } elseif (is_resource($value)) { - $value = sprintf('resource(%s)', get_resource_type($value)); - } - }; + $flatten = + /** @param mixed $value */ + static function (&$value) : void { + if ($value instanceof Closure) { + $closureReflection = new ReflectionFunction($value); + $value = sprintf( + '(Closure at %s:%s)', + $closureReflection->getFileName(), + $closureReflection->getStartLine() + ); + } elseif (is_object($value)) { + $value = sprintf('object(%s)', get_class($value)); + } elseif (is_resource($value)) { + $value = sprintf('resource(%s)', get_resource_type($value)); + } + }; do { $trace = array_map( - static function($call) use ($flatten) { + static function (array $call) use ($flatten) : array { array_walk_recursive($call['args'], $flatten); return $call; @@ -102,7 +111,8 @@ static function($call) use ($flatten) { $exception->getTrace() ); $traceProperty->setValue($exception, $trace); - } while ($exception = $exception->getPrevious()); + $exception = $exception->getPrevious(); + } while ($exception !== null); $traceProperty->setAccessible(false); } diff --git a/tests/unit/DocBlock/Tags/InvalidTagTest.php b/tests/unit/DocBlock/Tags/InvalidTagTest.php index c562ef3f..49d79a61 100644 --- a/tests/unit/DocBlock/Tags/InvalidTagTest.php +++ b/tests/unit/DocBlock/Tags/InvalidTagTest.php @@ -7,6 +7,10 @@ use Exception; use InvalidArgumentException; use PHPUnit\Framework\TestCase; +use Throwable; +use function fopen; +use function serialize; +use function unserialize; /** * @coversDefaultClass \phpDocumentor\Reflection\DocBlock\Tags\InvalidTag @@ -38,7 +42,7 @@ public function testCreationWithError() : void self::assertSame('name', $tag->getName()); self::assertSame('@name Body', $tag->render()); - self::assertSame('Body', (string)$tag); + self::assertSame('Body', (string) $tag); self::assertSame($exception, $tag->getException()); } @@ -46,9 +50,9 @@ public function testCreationWithErrorContainingClosure() : void { try { $this->throwExceptionFromClosureWithClosureArgument(); - } catch (Exception $e) { + } catch (Throwable $e) { $parentException = new Exception('test', 0, $e); - $tag = InvalidTag::create('Body', 'name')->withError($parentException); + $tag = InvalidTag::create('Body', 'name')->withError($parentException); self::assertSame('name', $tag->getName()); self::assertSame('@name Body', $tag->render()); self::assertSame($parentException, $tag->getException()); @@ -58,36 +62,36 @@ public function testCreationWithErrorContainingClosure() : void } } - private function throwExceptionFromClosureWithClosureArgument() + private function throwExceptionFromClosureWithClosureArgument() : void { - $function = function() { + $function = static function () : void { throw new InvalidArgumentException(); }; $function($function); } - public function testCreationWithErrorContainingResource() + public function testCreationWithErrorContainingResource() : void { try { $this->throwExceptionWithResourceArgument(); - } catch (Exception $e) { + } catch (Throwable $e) { $parentException = new Exception('test', 0, $e); - $tag = InvalidTag::create('Body', 'name')->withError($parentException); + $tag = InvalidTag::create('Body', 'name')->withError($parentException); self::assertSame('name', $tag->getName()); self::assertSame('@name Body', $tag->render()); self::assertSame($parentException, $tag->getException()); self::assertStringStartsWith( 'resource(stream)', - $tag->getException()->getPrevious()->getTrace()[0]['args'][0]) - ; + $tag->getException()->getPrevious()->getTrace()[0]['args'][0] + ); self::assertEquals($parentException, unserialize(serialize($parentException))); } } - private function throwExceptionWithResourceArgument() + private function throwExceptionWithResourceArgument() : void { - $function = function() { + $function = static function () : void { throw new InvalidArgumentException(); }; From 31fd6db84fdf3a8b003ab88d70345dd812a38d8d Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sat, 25 Jan 2020 15:52:34 +0100 Subject: [PATCH 116/126] Return invalid tag when factory returned null --- src/DocBlock/StandardTagFactory.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 3abbc4ae..78a2590f 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -227,7 +227,8 @@ private function createTag(string $body, string $name, TypeContext $context) : T try { /** @var callable $callable */ $callable = [$handlerClassName, 'create']; - return call_user_func_array($callable, $arguments); + $tag = call_user_func_array($callable, $arguments); + return $tag ?? InvalidTag::create($body, $name); } catch (InvalidArgumentException $e) { return InvalidTag::create($body, $name)->withError($e); } From 93919e334b0cb304fb04429b4b3a3b1e1787c873 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Mon, 27 Jan 2020 21:01:09 +0100 Subject: [PATCH 117/126] Fix code style --- src/DocBlock/StandardTagFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 78a2590f..61cba18f 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -227,7 +227,7 @@ private function createTag(string $body, string $name, TypeContext $context) : T try { /** @var callable $callable */ $callable = [$handlerClassName, 'create']; - $tag = call_user_func_array($callable, $arguments); + $tag = call_user_func_array($callable, $arguments); return $tag ?? InvalidTag::create($body, $name); } catch (InvalidArgumentException $e) { return InvalidTag::create($body, $name)->withError($e); From 6239e0d18407472688d055b8d171f8a3b012d7aa Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Feb 2020 11:33:17 +0100 Subject: [PATCH 118/126] Switch to phpdoc coding-standard --- .github/workflows/push.yml | 6 +----- Makefile | 8 ++++++-- phpcs.xml.dist | 16 +--------------- 3 files changed, 8 insertions(+), 22 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d3ead8a4..83961bcd 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -135,11 +135,7 @@ jobs: all-tools-${{ github.sha }}- all-tools- - name: Code style check - uses: docker://phpdoc/phpcs-ga:latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - args: -d memory_limit=1024M + uses: phpDocumentor/coding-standard@v1.0.0 phpstan: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index b83dd98b..bdeae3d8 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,11 @@ setup: install-phive .PHONY: phpcs phpcs: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:latest -d memory_limit=1024M + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 -s + +.PHONY: phpcbf +phpcbf: + docker run -it --rm -v${PWD}:/opt/project -w /opt/project phpdoc/phpcs-ga:v1.0.0 phpcbf .PHONY: phpstan phpstan: @@ -25,7 +29,7 @@ psalm: .PHONY: test test: - docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.2 tools/phpunit + docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4-pcov tools/phpunit .PHONY: pre-commit-test pre-commit-test: test phpcs phpstan psalm diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c030e8de..1cb3002e 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -6,25 +6,11 @@ tests/unit */tests/unit/Types/ContextFactoryTest.php - - *\.php - - - - - - - */src/*_.php + */src/*/Abstract*.php - - - - - - From da71602ae92163cfa94f5e5dbdd969629e060a05 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 2 Feb 2020 20:24:25 +0100 Subject: [PATCH 119/126] Fix issue on workflow --- .github/workflows/push.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 83961bcd..e06c4af6 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -136,6 +136,8 @@ jobs: all-tools- - name: Code style check uses: phpDocumentor/coding-standard@v1.0.0 + with: + args: -s phpstan: runs-on: ubuntu-latest From 6a88d1ae42db82ae8274bbf55880d0876ee24323 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 5 Feb 2020 21:17:02 +0100 Subject: [PATCH 120/126] use phpstan action --- .github/workflows/push.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e06c4af6..88e1b424 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -126,14 +126,6 @@ jobs: restore-keys: | all-build-${{ hashFiles('**/composer.lock') }} all-build- - - name: Restore/cache tools folder - uses: actions/cache@v1 - with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- - name: Code style check uses: phpDocumentor/coding-standard@v1.0.0 with: @@ -152,16 +144,8 @@ jobs: restore-keys: | all-build-${{ hashFiles('**/composer.lock') }} all-build- - - name: Restore/cache tools folder - uses: actions/cache@v1 - with: - path: tools - key: all-tools-${{ github.sha }} - restore-keys: | - all-tools-${{ github.sha }}- - all-tools- - name: PHPStan - uses: docker://phpdoc/phpstan-ga:latest + uses: phpDocumentor/phpstan-ga@0.12.3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: From ed7b7919e3b3051daca7328a767510545da99406 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 08:52:20 +0100 Subject: [PATCH 121/126] Limit characters after tag name Previously we allowed all characters after a tag name which made it a bit fuzzy how tags are handled. Psr-5 is more strict about the characters that are allowed in tags and those that are part of the body. A tag name can now be followed by `(`, and `{` all other characters are forbidden. The first character of the body is not restricted anymore. fixes #165 --- src/DocBlock/StandardTagFactory.php | 11 +-- .../unit/DocBlock/StandardTagFactoryTest.php | 87 +++++++++++++++++++ 2 files changed, 90 insertions(+), 8 deletions(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 61cba18f..2ed5be5d 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -46,6 +46,7 @@ use function get_class; use function preg_match; use function strpos; +use function trim; /** * Creates a Tag object given the contents of a tag. @@ -147,13 +148,7 @@ public function create(string $tagLine, ?TypeContext $context = null) : Tag [$tagName, $tagBody] = $this->extractTagParts($tagLine); - if ($tagBody !== '' && strpos($tagBody, '[') === 0) { - throw new InvalidArgumentException( - 'The tag "' . $tagLine . '" does not seem to be wellformed, please check it for errors' - ); - } - - return $this->createTag($tagBody, $tagName, $context); + return $this->createTag(trim($tagBody), $tagName, $context); } /** @@ -199,7 +194,7 @@ public function registerTagHandler(string $tagName, string $handler) : void private function extractTagParts(string $tagLine) : array { $matches = []; - if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')(?:\s*([^\s].*)|$)/us', $tagLine, $matches)) { + if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{:])\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/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 9235344c..cd6b99a8 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -13,6 +13,7 @@ namespace phpDocumentor\Reflection\DocBlock; +use InvalidArgumentException; use Mockery as m; use phpDocumentor\Reflection\DocBlock\Tags\Author; use phpDocumentor\Reflection\DocBlock\Tags\Formatter; @@ -341,4 +342,90 @@ public function testInvalidTagIsReturnedOnFailure() : void $this->assertInstanceOf(InvalidTag::class, $tag); } + + /** + * @dataProvider validTagProvider + */ + public function testValidFormattedTags(string $input, string $tagName, string $render) : void + { + $fqsenResolver = $this->prophesize(FqsenResolver::class); + $tagFactory = new StandardTagFactory($fqsenResolver->reveal()); + $tagFactory->registerTagHandler('tag', Generic::class); + $tag = $tagFactory->create($input); + + self::assertSame($tagName, $tag->getName()); + self::assertSame($render, $tag->render()); + } + + /** + * @return string[][] + * + * @phpstan-return array> + */ + public function validTagProvider() : array + { + //rendered result is adding a space, because the tags are not rendered properly. + return [ + 'tag without body' => [ + '@tag', + 'tag', + '@tag', + ], + 'tag specialization' => [ + '@tag:some-spec', + 'tag', + '@tag :some-spec', + ], + 'tag with textual description' => [ + '@tag some text', + 'tag', + '@tag some text', + ], + 'tag [a]' => [ + '@tag [is valid]', + 'tag', + '@tag [is valid]', + ], + 'tag {a}' => [ + '@tag {is valid}', + 'tag', + '@tag {is valid}', + ], + 'tag{a}' => [ + '@tag{is valid}', + 'tag', + '@tag {is valid}', + ], + 'tag(a)' => [ + '@tag(is valid)', + 'tag', + '@tag (is valid)', + ], + ]; + } + + /** + * @dataProvider invalidTagProvider + */ + public function testInValidFormattedTags(string $input) : void + { + $this->expectException(InvalidArgumentException::class); + $fqsenResolver = $this->prophesize(FqsenResolver::class); + $tagFactory = new StandardTagFactory($fqsenResolver->reveal()); + $tagFactory->registerTagHandler('tag', Generic::class); + $tagFactory->create($input); + } + + /** + * @return string[][] + * + * @phpstan-return list> + */ + public function invalidTagProvider() : array + { + return [ + ['@tag[invalid]'], + ['@tag@invalid'], + ]; + } } From 264bd1fff7f4679a81e41bcb959b6587c73af844 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 09:05:22 +0100 Subject: [PATCH 122/126] Handle tag specialization correctly --- src/DocBlock/StandardTagFactory.php | 4 ++-- tests/unit/DocBlock/StandardTagFactoryTest.php | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 2ed5be5d..7b348c7f 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -68,7 +68,7 @@ final class StandardTagFactory implements TagFactory { /** PCRE regular expression matching a tag name. */ - public const REGEX_TAGNAME = '[\w\-\_\\\\]+'; + public const REGEX_TAGNAME = '[\w\-\_\\\\:]+'; /** * @var string[] An array with a tag as a key, and an @@ -194,7 +194,7 @@ public function registerTagHandler(string $tagName, string $handler) : void private function extractTagParts(string $tagLine) : array { $matches = []; - if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{:])\s*([^\s].*)|$)/us', $tagLine, $matches)) { + if (!preg_match('/^@(' . self::REGEX_TAGNAME . ')((?:[\s\(\{])\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/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index cd6b99a8..8ca3e57d 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -372,9 +372,14 @@ public function validTagProvider() : array '@tag', ], 'tag specialization' => [ - '@tag:some-spec', - 'tag', - '@tag :some-spec', + '@tag:some-spec body', + 'tag:some-spec', + '@tag:some-spec body', + ], + 'tag specialization(a)' => [ + '@tag:some-spec(body)', + 'tag:some-spec', + '@tag:some-spec (body)', ], 'tag with textual description' => [ '@tag some text', From 9169749b9e57c74fe4b58188801cf87dbbe1fd69 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 09:11:55 +0100 Subject: [PATCH 123/126] Improve test descriptions --- tests/unit/DocBlock/StandardTagFactoryTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/unit/DocBlock/StandardTagFactoryTest.php b/tests/unit/DocBlock/StandardTagFactoryTest.php index 8ca3e57d..33372045 100644 --- a/tests/unit/DocBlock/StandardTagFactoryTest.php +++ b/tests/unit/DocBlock/StandardTagFactoryTest.php @@ -376,7 +376,7 @@ public function validTagProvider() : array 'tag:some-spec', '@tag:some-spec body', ], - 'tag specialization(a)' => [ + 'tag specialization followed by parenthesis' => [ '@tag:some-spec(body)', 'tag:some-spec', '@tag:some-spec (body)', @@ -386,22 +386,22 @@ public function validTagProvider() : array 'tag', '@tag some text', ], - 'tag [a]' => [ + 'tag body starting with sqare brackets is allowed' => [ '@tag [is valid]', 'tag', '@tag [is valid]', ], - 'tag {a}' => [ + 'tag body starting with curly brackets is allowed' => [ '@tag {is valid}', 'tag', '@tag {is valid}', ], - 'tag{a}' => [ + 'tag name followed by curly brackets directly is allowed' => [ '@tag{is valid}', 'tag', '@tag {is valid}', ], - 'tag(a)' => [ + 'parenthesis directly following a tag name is valid' => [ '@tag(is valid)', 'tag', '@tag (is valid)', From 1e5bd86da1802f5e362f37482fa08161ceb1ecd5 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 09:31:53 +0100 Subject: [PATCH 124/126] Fix invalid void type default for arguments --- src/DocBlock/Tags/Method.php | 5 +++-- tests/unit/DocBlock/Tags/MethodTest.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 984686db..c7a00e4d 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -19,6 +19,7 @@ use phpDocumentor\Reflection\Type; use phpDocumentor\Reflection\TypeResolver; use phpDocumentor\Reflection\Types\Context as TypeContext; +use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\Void_; use Webmozart\Assert\Assert; use function array_keys; @@ -153,7 +154,7 @@ public static function create( $argument = explode(' ', self::stripRestArg(trim($argument)), 2); if ($argument[0][0] === '$') { $argumentName = substr($argument[0], 1); - $argumentType = new Void_(); + $argumentType = new Mixed_(); } else { $argumentType = $typeResolver->resolve($argument[0], $context); $argumentName = ''; @@ -234,7 +235,7 @@ private function filterArguments(array $arguments = []) : array } if (!isset($argument['type'])) { - $argument['type'] = new Void_(); + $argument['type'] = new Mixed_(); } $keys = array_keys($argument); diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index 1b973799..dcc05de2 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -22,6 +22,7 @@ use phpDocumentor\Reflection\Types\Compound; use phpDocumentor\Reflection\Types\Context; use phpDocumentor\Reflection\Types\Integer; +use phpDocumentor\Reflection\Types\Mixed_; use phpDocumentor\Reflection\Types\Object_; use phpDocumentor\Reflection\Types\String_; use phpDocumentor\Reflection\Types\This; @@ -137,7 +138,7 @@ public function testArgumentsMayBePassedAsString() : void { $arguments = ['argument1']; $expected = [ - ['name' => $arguments[0], 'type' => new Void_()], + ['name' => $arguments[0], 'type' => new Mixed_()], ]; $fixture = new Method('myMethod', $arguments); @@ -149,11 +150,11 @@ public function testArgumentsMayBePassedAsString() : void * @covers ::__construct * @covers ::getArguments */ - public function testArgumentTypeCanBeInferredAsVoid() : void + public function testArgumentTypeCanBeInferredAsMixed() : void { $arguments = [['name' => 'argument1']]; $expected = [ - ['name' => $arguments[0]['name'], 'type' => new Void_()], + ['name' => $arguments[0]['name'], 'type' => new Mixed_()], ]; $fixture = new Method('myMethod', $arguments); @@ -171,8 +172,8 @@ public function testArgumentTypeCanBeInferredAsVoid() : void public function testRestArgumentIsParsedAsRegularArg() : void { $expected = [ - ['name' => 'arg1', 'type' => new Void_()], - ['name' => 'rest', 'type' => new Void_()], + ['name' => 'arg1', 'type' => new Mixed_()], + ['name' => 'rest', 'type' => new Mixed_()], ['name' => 'rest2', 'type' => new Array_()], ]; @@ -286,7 +287,7 @@ public function testFactoryMethod() : void $description = new Description('My Description'); $expectedArguments = [ ['name' => 'argument1', 'type' => new String_()], - ['name' => 'argument2', 'type' => new Void_()], + ['name' => 'argument2', 'type' => new Mixed_()], ]; $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); @@ -298,7 +299,7 @@ public function testFactoryMethod() : void $context ); - $this->assertSame('static void myMethod(string $argument1, void $argument2) My Description', (string) $fixture); + $this->assertSame('static void myMethod(string $argument1, mixed $argument2) My Description', (string) $fixture); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertEquals($expectedArguments, $fixture->getArguments()); $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); From a83a19f71b8032e1d2b80ed0fe527df9f48c881a Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 10:13:47 +0100 Subject: [PATCH 125/126] Fix code style --- tests/unit/DocBlock/Tags/MethodTest.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index dcc05de2..03bd1b61 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -290,7 +290,9 @@ public function testFactoryMethod() : void ['name' => 'argument2', 'type' => new Mixed_()], ]; - $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); $fixture = Method::create( 'static void myMethod(string $argument1, $argument2) My Description', @@ -299,7 +301,10 @@ public function testFactoryMethod() : void $context ); - $this->assertSame('static void myMethod(string $argument1, mixed $argument2) My Description', (string) $fixture); + $this->assertSame( + 'static void myMethod(string $argument1, mixed $argument2) My Description', + (string) $fixture + ); $this->assertSame('myMethod', $fixture->getMethodName()); $this->assertEquals($expectedArguments, $fixture->getArguments()); $this->assertInstanceOf(Void_::class, $fixture->getReturnType()); @@ -371,7 +376,9 @@ public function testCollectionReturnTypes( ) : void { $resolver = new TypeResolver(); $descriptionFactory = m::mock(DescriptionFactory::class); - $descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description('')); + $descriptionFactory->shouldReceive('create') + ->with('', null) + ->andReturn(new Description('')); $fixture = Method::create("${returnType} myMethod(\$arg)", $resolver, $descriptionFactory); $returnType = $fixture->getReturnType(); @@ -457,7 +464,10 @@ public function testCreateMethodParenthesisMissing() : void $description = new Description('My Description'); - $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); + $descriptionFactory->shouldReceive('create')->with( + 'My Description', + $context + )->andReturn($description); $fixture = Method::create( 'static void myMethod My Description', @@ -491,7 +501,9 @@ public function testCreateMethodEmptyArguments() : void $description = new Description('My Description'); - $descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description); + $descriptionFactory->shouldReceive('create') + ->with('My Description', $context) + ->andReturn($description); $fixture = Method::create( 'static void myMethod() My Description', From a48807183a4b819072f26e347bbd0b5199a9d15f Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 9 Feb 2020 10:16:15 +0100 Subject: [PATCH 126/126] Add github action status badge --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 265da362..51f10883 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Travis Status](https://img.shields.io/travis/phpDocumentor/ReflectionDocBlock.svg?label=Linux)](https://travis-ci.org/phpDocumentor/ReflectionDocBlock) -[![Appveyor Status](https://img.shields.io/appveyor/ci/phpDocumentor/ReflectionDocBlock.svg?label=Windows)](https://ci.appveyor.com/project/phpDocumentor/ReflectionDocBlock/branch/master) +![Qa workflow](https://github.com/phpDocumentor/ReflectionDocBlock/workflows/Qa%20workflow/badge.svg) [![Coveralls Coverage](https://img.shields.io/coveralls/github/phpDocumentor/ReflectionDocBlock.svg)](https://coveralls.io/github/phpDocumentor/ReflectionDocBlock?branch=master) [![Scrutinizer Code Coverage](https://img.shields.io/scrutinizer/coverage/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/phpDocumentor/ReflectionDocBlock.svg)](https://scrutinizer-ci.com/g/phpDocumentor/ReflectionDocBlock/?branch=master)