diff --git a/src/DocBlock.php b/src/DocBlock.php index 4d29e63..ca7ab88 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 @@ final class DocBlock /** * Returns the current context. * - * @return Types\Context */ public function getContext(): Types\Context { @@ -118,7 +117,6 @@ final class DocBlock * * @see self::isTemplateEnd() for the check whether a closing marker was provided. * - * @return boolean */ public function isTemplateStart(): bool { @@ -130,7 +128,6 @@ final class DocBlock * * @see self::isTemplateStart() for a more complete description of the Docblock Template functionality. * - * @return boolean */ public function isTemplateEnd(): bool { @@ -193,7 +190,7 @@ final class DocBlock * * @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 @@ final class DocBlock * * @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 d34c944..f559261 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -81,7 +81,7 @@ class Description * 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 532788d..1aafb4d 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -49,11 +49,10 @@ class DescriptionFactory * 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 0e9290a..2ac7b45 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -44,7 +44,7 @@ class ExampleFinder /** * 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 @@ class ExampleFinder * * @param string[] $directories */ - public function setExampleDirectories(array $directories) + public function setExampleDirectories(array $directories): void { $this->exampleDirectories = $directories; } @@ -89,9 +89,8 @@ class ExampleFinder * 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 1612e31..237d3c3 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -39,7 +39,7 @@ use Webmozart\Assert\Assert; 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 @@ final class StandardTagFactory implements TagFactory /** * {@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 @@ final class StandardTagFactory implements TagFactory /** * {@inheritDoc} */ - public function addParameter(string $name, $value) + public function addParameter(string $name, $value): void { $this->serviceLocator[$name] = $value; } @@ -133,7 +133,7 @@ final class StandardTagFactory implements TagFactory /** * {@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 @@ final class StandardTagFactory implements TagFactory /** * {@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 @@ final class StandardTagFactory implements TagFactory * 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 e6d4b88..bcd37cf 100644 --- a/src/DocBlock/Tag.php +++ b/src/DocBlock/Tag.php @@ -17,11 +17,14 @@ use phpDocumentor\Reflection\DocBlock\Tags\Formatter; 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 ae0e002..34a3cb6 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 @@ interface TagFactory * * @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 @@ interface TagFactory * * @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 @@ interface TagFactory * @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 2fbe558..2e2260c 100644 --- a/src/DocBlock/Tags/BaseTag.php +++ b/src/DocBlock/Tags/BaseTag.php @@ -42,7 +42,7 @@ abstract class BaseTag implements DocBlock\Tag 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 0de91f7..e92ee68 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 @@ final class Covers extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Covers extends BaseTag implements Factory\StaticMethod /** * 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 85f9f5e..daddd11 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 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Deprecated extends BaseTag implements Factory\StaticMethod /** * 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 b0673bd..ada9676 100644 --- a/src/DocBlock/Tags/Factory/StaticMethod.php +++ b/src/DocBlock/Tags/Factory/StaticMethod.php @@ -15,5 +15,8 @@ namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; 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 29769ee..1b7afdb 100644 --- a/src/DocBlock/Tags/Factory/Strategy.php +++ b/src/DocBlock/Tags/Factory/Strategy.php @@ -15,5 +15,5 @@ namespace phpDocumentor\Reflection\DocBlock\Tags\Factory; 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 0b45676..ce285f5 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 63604bc..0668f34 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 @@ class Generic extends BaseTag implements Factory\StaticMethod 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 @@ class Generic extends BaseTag implements Factory\StaticMethod /** * 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 2e76a54..2bbd771 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 @@ final class Link extends BaseTag implements Factory\StaticMethod /** * {@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 ab04af2..0c2c4df 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 @@ final class Method extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Method extends BaseTag implements Factory\StaticMethod return null; } - list(, $static, $returnType, $methodName, $arguments, $description) = $matches; + [, $static, $returnType, $methodName, $arguments, $description] = $matches; $static = $static === 'static'; @@ -193,7 +193,7 @@ final class Method extends BaseTag implements Factory\StaticMethod 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 62a89b1..e6fcbdc 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 @@ final class Param extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Param extends BaseTag implements Factory\StaticMethod /** * 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 @@ final class Param extends BaseTag implements Factory\StaticMethod /** * 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 aaebec6..8c4f59a 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 @@ class Property extends BaseTag implements Factory\StaticMethod */ 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 @@ class Property extends BaseTag implements Factory\StaticMethod /** * 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 6f44b22..51d6d0d 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 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod */ 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 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** * 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 2940d05..234ac7e 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 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod */ 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 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** * 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 c02e7f0..4e55252 100644 --- a/src/DocBlock/Tags/Reference/Reference.php +++ b/src/DocBlock/Tags/Reference/Reference.php @@ -18,5 +18,5 @@ namespace phpDocumentor\Reflection\DocBlock\Tags\Reference; */ 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 c051a4d..32b2070 100644 --- a/src/DocBlock/Tags/Reference/Url.php +++ b/src/DocBlock/Tags/Reference/Url.php @@ -34,7 +34,7 @@ final class Url implements Reference $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 68aa913..17e6fd9 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 @@ final class Return_ extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Return_ extends BaseTag implements Factory\StaticMethod /** * 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 2562fbb..453d313 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 @@ class See extends BaseTag implements Factory\StaticMethod */ 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 @@ class See extends BaseTag implements Factory\StaticMethod /** * 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 aee5a11..d22a72a 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 @@ final class Since extends BaseTag implements Factory\StaticMethod */ 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 1fc9e96..cc58a5a 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 @@ final class Source extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Source extends BaseTag implements Factory\StaticMethod * @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 19b6f9d..829b014 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 @@ final class Throws extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Throws extends BaseTag implements Factory\StaticMethod /** * 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 25cfa2d..05acd80 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 @@ final class Uses extends BaseTag implements Factory\StaticMethod */ 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 @@ final class Uses extends BaseTag implements Factory\StaticMethod /** * 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 37b4fa4..f6e0edf 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 @@ class Var_ extends BaseTag implements Factory\StaticMethod */ 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 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** * 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 9bc78b3..468d99d 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 @@ final class Version extends BaseTag implements Factory\StaticMethod */ 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 e3c364e..10e56ed 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -41,7 +41,6 @@ final class DocBlockFactory implements DocBlockFactoryInterface * * @param string[] $additionalTags * - * @return DocBlockFactory */ public static function createInstance(array $additionalTags = []): DocBlockFactory { @@ -64,9 +63,8 @@ final class DocBlockFactory implements DocBlockFactoryInterface * @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 @@ final class DocBlockFactory implements DocBlockFactoryInterface ); } - 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 151134f..83742a1 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 ffd9c42..87ee5c4 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 @@ DESCRIPTION; $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 23f54c8..8ff8fdf 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 ec886a1..dce845d 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 9a758e8..228723f 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 @@ class DescriptionFactoryTest extends TestCase * @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 @@ class DescriptionFactoryTest extends TestCase * @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 @@ class DescriptionFactoryTest extends TestCase * @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 @@ class DescriptionFactoryTest extends TestCase * @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 @@ class DescriptionFactoryTest extends TestCase * @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 @@ class ExampleFinderTest extends TestCase * @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 5e6caaa..20ac862 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 @@ class SerializerTest extends TestCase * @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 @@ DOCCOMMENT; * @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 @@ DOCCOMMENT; * @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 @@ DOCCOMMENT; * @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 6f0e548..f360a2a 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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @covers ::addService * @uses phpDocumentor\Reflection\DocBlock\StandardTagFactory::__construct */ - public function testAddServiceToServiceLocator() + public function testAddServiceToServiceLocator(): void { $service = new PassthroughFormatter(); @@ -196,7 +196,7 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 @@ class StandardTagFactoryTest extends TestCase * @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 9588614..183236b 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 @@ class AuthorTest extends TestCase * @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 @@ class AuthorTest extends TestCase * @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 @@ class AuthorTest extends TestCase * @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 @@ class AuthorTest extends TestCase * @covers ::__construct * @covers ::getAuthorName */ - public function testHasTheAuthorName() + public function testHasTheAuthorName(): void { $expected = 'Mike van Riel'; @@ -86,7 +86,7 @@ class AuthorTest extends TestCase * @covers ::__construct * @covers ::getEmail */ - public function testHasTheAuthorMailAddress() + public function testHasTheAuthorMailAddress(): void { $expected = 'mike@phpdoc.org'; @@ -99,7 +99,7 @@ class AuthorTest extends TestCase * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testInitializationFailsIfEmailIsNotValid() + public function testInitializationFailsIfEmailIsNotValid(): void { new Author('Mike van Riel', 'mike'); } @@ -108,7 +108,7 @@ class AuthorTest extends TestCase * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationIsReturned() + public function testStringRepresentationIsReturned(): void { $fixture = new Author('Mike van Riel', 'mike@phpdoc.org'); @@ -119,7 +119,7 @@ class AuthorTest extends TestCase * @covers ::__construct * @covers ::__toString */ - public function testStringRepresentationWithEmtpyEmail() + public function testStringRepresentationWithEmtpyEmail(): void { $fixture = new Author('Mike van Riel', ''); @@ -130,7 +130,7 @@ class AuthorTest extends TestCase * @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 @@ class AuthorTest extends TestCase * @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 48d288a..87126b4 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 @@ class CoversTest extends TestCase * @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 @@ class CoversTest extends TestCase * @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 @@ class CoversTest extends TestCase * @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 @@ class CoversTest extends TestCase * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() + public function testHasReferenceToFqsen(): void { $expected = new Fqsen('\DateTime'); @@ -96,7 +96,7 @@ class CoversTest extends TestCase * @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 @@ class CoversTest extends TestCase * @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 @@ class CoversTest extends TestCase * @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 @@ class CoversTest extends TestCase * @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 7313d37..fd70d88 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 @@ class DeprecatedTest extends TestCase * @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 @@ class DeprecatedTest extends TestCase * @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 @@ class DeprecatedTest extends TestCase * @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 @@ class DeprecatedTest extends TestCase * @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 @@ class DeprecatedTest extends TestCase * @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 49bdad1..3b3239a 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 @@ class ExampleTest extends TestCase * @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 @@ class ExampleTest extends TestCase * @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 @@ class ExampleTest extends TestCase * @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 @@ class ExampleTest extends TestCase * @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 @@ class ExampleTest extends TestCase * @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 @@ class ExampleTest extends TestCase * @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 b5eab3a..40efcb4 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 @@ class AlignFormatterTest extends TestCase * @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 6fa8055..3f7e8b4 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 @@ class PassthroughFormatterTest extends TestCase * @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 @@ class PassthroughFormatterTest extends TestCase * @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 b59aee5..7c7d986 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 @@ class GenericTest extends TestCase * @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 @@ class GenericTest extends TestCase * @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 @@ class GenericTest extends TestCase * @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 @@ class GenericTest extends TestCase * @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 @@ class GenericTest extends TestCase * @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 @@ class GenericTest extends TestCase * @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 @@ class GenericTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfNameIsNotEmpty() + public function testFactoryMethodFailsIfNameIsNotEmpty(): void { Generic::create('', ''); } @@ -139,7 +139,7 @@ class GenericTest extends TestCase * @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 829c6ef..0b1f6a7 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 @@ class LinkTest extends TestCase * @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 @@ class LinkTest extends TestCase * @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 @@ class LinkTest extends TestCase * @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 @@ class LinkTest extends TestCase * @covers ::__construct * @covers ::getLink */ - public function testHasLinkUrl() + public function testHasLinkUrl(): void { $expected = 'http://this.is.my/link'; @@ -93,7 +93,7 @@ class LinkTest extends TestCase * @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 @@ class LinkTest extends TestCase * @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 @@ class LinkTest extends TestCase * @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 @@ class LinkTest extends TestCase * @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 23b6dd4..4f811d0 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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::getMethodName */ - public function testHasMethodName() + public function testHasMethodName(): void { $expected = 'myMethod'; @@ -108,7 +108,7 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::getArguments */ - public function testHasArguments() + public function testHasArguments(): void { $arguments = [ [ 'name' => 'argument1', 'type' => new String_() ] @@ -123,7 +123,7 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::getArguments */ - public function testArgumentsMayBePassedAsString() + public function testArgumentsMayBePassedAsString(): void { $arguments = ['argument1']; $expected = [ @@ -139,7 +139,7 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::getArguments */ - public function testArgumentTypeCanBeInferredAsVoid() + public function testArgumentTypeCanBeInferredAsVoid(): void { $arguments = [ [ 'name' => 'argument1' ] ]; $expected = [ @@ -157,7 +157,7 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::getReturnType */ - public function testHasReturnType() + public function testHasReturnType(): void { $expected = new String_(); @@ -198,7 +198,7 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::getReturnType */ - public function testReturnTypeCanBeInferredAsVoid() + public function testReturnTypeCanBeInferredAsVoid(): void { $fixture = new Method('myMethod', []); @@ -209,7 +209,7 @@ class MethodTest extends TestCase * @covers ::__construct * @covers ::isStatic */ - public function testMethodCanBeStatic() + public function testMethodCanBeStatic(): void { $expected = false; $fixture = new Method('myMethod', [], null, $expected); @@ -225,7 +225,7 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase 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 @@ class MethodTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsEmpty() + public function testFactoryMethodFailsIfBodyIsEmpty(): void { Method::create(''); } @@ -377,7 +377,7 @@ class MethodTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodReturnsNullIfBodyIsIncorrect() + public function testFactoryMethodReturnsNullIfBodyIsIncorrect(): void { $this->assertNull(Method::create('body(')); } @@ -386,7 +386,7 @@ class MethodTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Method::create('body'); } @@ -395,7 +395,7 @@ class MethodTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Method::create('body', new TypeResolver()); } @@ -404,7 +404,7 @@ class MethodTest extends TestCase * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsNotString() + public function testCreationFailsIfBodyIsNotString(): void { new Method([]); } @@ -413,7 +413,7 @@ class MethodTest extends TestCase * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfBodyIsEmpty() + public function testCreationFailsIfBodyIsEmpty(): void { new Method(''); } @@ -422,7 +422,7 @@ class MethodTest extends TestCase * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfStaticIsNotBoolean() + public function testCreationFailsIfStaticIsNotBoolean(): void { new Method('body', [], null, []); } @@ -431,7 +431,7 @@ class MethodTest extends TestCase * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testCreationFailsIfArgumentRecordContainsInvalidEntry() + public function testCreationFailsIfArgumentRecordContainsInvalidEntry(): void { new Method('body', [ [ 'name' => 'myName', 'unknown' => 'nah' ] ]); } @@ -445,7 +445,7 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 @@ class MethodTest extends TestCase * @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 95e4c8a..1f0edf2 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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myParameter'; @@ -102,7 +102,7 @@ class ParamTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -115,7 +115,7 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @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 @@ class ParamTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Param::create('body'); } @@ -204,7 +204,7 @@ class ParamTest extends TestCase * @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 7e8794a..5bf0723 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 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -98,7 +98,7 @@ class PropertyReadTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -112,7 +112,7 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @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 @@ class PropertyReadTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { PropertyRead::create('body'); } @@ -190,7 +190,7 @@ class PropertyReadTest extends TestCase * @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 53a99cc..73af398 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 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -98,7 +98,7 @@ class PropertyTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -112,7 +112,7 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @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 @@ class PropertyTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Property::create('body'); } @@ -185,7 +185,7 @@ class PropertyTest extends TestCase * @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 79c2841..185dff0 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 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myProperty'; @@ -98,7 +98,7 @@ class PropertyWriteTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -112,7 +112,7 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @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 @@ class PropertyWriteTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { PropertyWrite::create('body'); } @@ -190,7 +190,7 @@ class PropertyWriteTest extends TestCase * @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 53fe992..76071ec 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 @@ class ReturnTest extends TestCase * @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 @@ class ReturnTest extends TestCase * @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 @@ class ReturnTest extends TestCase * @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 @@ class ReturnTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -95,7 +95,7 @@ class ReturnTest extends TestCase * @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 @@ class ReturnTest extends TestCase * @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 @@ class ReturnTest extends TestCase * @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 @@ class ReturnTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Return_::create('')); } @@ -155,7 +155,7 @@ class ReturnTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Return_::create('body'); } @@ -164,7 +164,7 @@ class ReturnTest extends TestCase * @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 6de4ead..598f764 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 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() + public function testHasReferenceToFqsen(): void { $expected = new FqsenRef(new Fqsen('\DateTime')); @@ -106,7 +106,7 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @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 @@ class SeeTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(See::create('')); } @@ -203,7 +203,7 @@ class SeeTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { See::create('body'); } @@ -212,7 +212,7 @@ class SeeTest extends TestCase * @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 6e39ad8..04cf35b 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 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -94,7 +94,7 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase * @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 @@ class SinceTest extends TestCase /** * @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 632bcd9..f2ab955 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 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @covers ::__construct * @covers ::getStartingLine */ - public function testHasStartingLine() + public function testHasStartingLine(): void { $expected = 1; @@ -96,7 +96,7 @@ class SourceTest extends TestCase * @covers ::__construct * @covers ::getLineCount */ - public function testHasLineCount() + public function testHasLineCount(): void { $expected = 2; @@ -110,7 +110,7 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @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 @@ class SourceTest extends TestCase * @uses \phpDocumentor\Reflection\TypeResolver * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfDescriptionFactoryIsNull() + public function testFactoryMethodFailsIfDescriptionFactoryIsNull(): void { Source::create('1'); } @@ -182,7 +182,7 @@ class SourceTest extends TestCase * @covers ::__construct * @expectedException \InvalidArgumentException */ - public function testExceptionIsThrownIfStartingLineIsNotInteger() + public function testExceptionIsThrownIfStartingLineIsNotInteger(): void { new Source('blabla'); } @@ -191,7 +191,7 @@ class SourceTest extends TestCase * @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 6e4dec3..3b42dca 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 @@ class ThrowsTest extends TestCase * @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 @@ class ThrowsTest extends TestCase * @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 @@ class ThrowsTest extends TestCase * @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 @@ class ThrowsTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -95,7 +95,7 @@ class ThrowsTest extends TestCase * @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 @@ class ThrowsTest extends TestCase * @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 @@ class ThrowsTest extends TestCase * @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 @@ class ThrowsTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Throws::create('')); } @@ -155,7 +155,7 @@ class ThrowsTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Throws::create('body'); } @@ -164,7 +164,7 @@ class ThrowsTest extends TestCase * @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 e8fcb14..e581232 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 @@ class UsesTest extends TestCase * @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 @@ class UsesTest extends TestCase * @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 @@ class UsesTest extends TestCase * @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 @@ class UsesTest extends TestCase * @covers ::__construct * @covers ::getReference */ - public function testHasReferenceToFqsen() + public function testHasReferenceToFqsen(): void { $expected = new Fqsen('\DateTime'); @@ -95,7 +95,7 @@ class UsesTest extends TestCase * @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 @@ class UsesTest extends TestCase * @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 @@ class UsesTest extends TestCase * @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 @@ class UsesTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfBodyIsNotEmpty() + public function testFactoryMethodFailsIfBodyIsNotEmpty(): void { $this->assertNull(Uses::create('')); } @@ -158,7 +158,7 @@ class UsesTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Uses::create('body'); } @@ -167,7 +167,7 @@ class UsesTest extends TestCase * @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 3b994c5..070fc7b 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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @covers ::__construct * @covers ::getVariableName */ - public function testHasVariableName() + public function testHasVariableName(): void { $expected = 'myVariable'; @@ -109,7 +109,7 @@ class VarTest extends TestCase * @covers ::__construct * @covers ::getType */ - public function testHasType() + public function testHasType(): void { $expected = new String_(); @@ -123,7 +123,7 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @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 @@ class VarTest extends TestCase * @covers ::create * @expectedException \InvalidArgumentException */ - public function testFactoryMethodFailsIfResolverIsNull() + public function testFactoryMethodFailsIfResolverIsNull(): void { Var_::create('body'); } @@ -196,7 +196,7 @@ class VarTest extends TestCase * @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 2e5837d..58cddc9 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 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase * @covers ::__construct * @covers ::getVersion */ - public function testHasVersionNumber() + public function testHasVersionNumber(): void { $expected = '1.0'; @@ -93,7 +93,7 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase * @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 @@ class VersionTest extends TestCase /** * @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 7822e55..74ff17d 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 @@ class DocBlockFactoryTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\StandardTagFactory * @uses \phpDocumentor\Reflection\DocBlock\DescriptionFactory */ - public function testCreateFactoryUsingFactoryMethod() + public function testCreateFactoryUsingFactoryMethod(): void { $fixture = DocBlockFactory::createInstance(); @@ -56,7 +56,7 @@ class DocBlockFactoryTest extends TestCase * @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 @@ class DocBlockFactoryTest extends TestCase * @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 @@ class DocBlockFactoryTest extends TestCase * @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 @@ class DocBlockFactoryTest extends TestCase * @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 @@ class DocBlockFactoryTest extends TestCase * @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 @@ DESCRIPTION; * @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 @@ DOCBLOCK * @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 @@ DOCBLOCK * @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 0bf2a0f..84580d7 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 @@ class DocBlockTest extends TestCase * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveASummary() + public function testDocBlockCanHaveASummary(): void { $summary = 'This is a summary'; @@ -54,7 +54,7 @@ class DocBlockTest extends TestCase * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockCanHaveADescription() + public function testDocBlockCanHaveADescription(): void { $description = new DocBlock\Description(''); @@ -70,7 +70,7 @@ class DocBlockTest extends TestCase * @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 @@ class DocBlockTest extends TestCase * * @expectedException \InvalidArgumentException */ - public function testDocBlockAllowsOnlyTags() + public function testDocBlockAllowsOnlyTags(): void { $tags = [ null @@ -107,7 +107,7 @@ class DocBlockTest extends TestCase * @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 @@ class DocBlockTest extends TestCase * @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 @@ class DocBlockTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Types\Context */ - public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre() + public function testDocBlockKnowsInWhichNamespaceItIsAndWhichAliasesThereAre(): void { $context = new Context(''); @@ -172,7 +172,7 @@ class DocBlockTest extends TestCase * @uses \phpDocumentor\Reflection\DocBlock\Description * @uses \phpDocumentor\Reflection\Location */ - public function testDocBlockKnowsAtWhichLineItIs() + public function testDocBlockKnowsAtWhichLineItIs(): void { $location = new Location(10); @@ -187,7 +187,7 @@ class DocBlockTest extends TestCase * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate() + public function testDocBlockKnowsIfItIsTheStartOfADocBlockTemplate(): void { $fixture = new DocBlock('', null, [], null, null, true); @@ -200,7 +200,7 @@ class DocBlockTest extends TestCase * * @uses \phpDocumentor\Reflection\DocBlock\Description */ - public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate() + public function testDocBlockKnowsIfItIsTheEndOfADocBlockTemplate(): void { $fixture = new DocBlock('', null, [], null, null, false, true); @@ -213,7 +213,7 @@ class DocBlockTest extends TestCase * * @uses \phpDocumentor\Reflection\DocBlock\Tags\Deprecated */ - public function testRemoveTag() + public function testRemoveTag(): void { $someTag = new Deprecated(); $anotherTag = new Deprecated();