From 0bac84ee68d44d6df2b30a5d50ec09d036bfe254 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 27 Nov 2017 00:32:26 +0100 Subject: [PATCH] remove unused docblocks --- src/DocBlock.php | 10 --------- src/DocBlock/Description.php | 6 ----- src/DocBlock/DescriptionFactory.php | 7 ------ src/DocBlock/ExampleFinder.php | 22 ------------------- src/DocBlock/Serializer.php | 14 ------------ src/DocBlock/StandardTagFactory.php | 11 ---------- src/DocBlock/TagFactory.php | 7 ------ src/DocBlock/Tags/Author.php | 6 ----- src/DocBlock/Tags/Covers.php | 4 ---- src/DocBlock/Tags/Example.php | 12 ---------- .../Tags/Formatter/AlignFormatter.php | 3 --- .../Tags/Formatter/PassthroughFormatter.php | 3 --- src/DocBlock/Tags/Generic.php | 8 ------- src/DocBlock/Tags/Link.php | 10 ++------- src/DocBlock/Tags/Method.php | 2 -- src/DocBlock/Tags/Param.php | 9 -------- src/DocBlock/Tags/Property.php | 8 ------- src/DocBlock/Tags/PropertyRead.php | 8 ------- src/DocBlock/Tags/PropertyWrite.php | 8 ------- src/DocBlock/Tags/See.php | 4 ---- src/DocBlock/Tags/Since.php | 2 -- src/DocBlock/Tags/Uses.php | 4 ---- src/DocBlock/Tags/Var_.php | 8 ------- src/DocBlock/Tags/Version.php | 2 -- src/DocBlockFactory.php | 7 ------ tests/unit/DocBlock/Tags/MethodTest.php | 3 --- 26 files changed, 2 insertions(+), 186 deletions(-) diff --git a/src/DocBlock.php b/src/DocBlock.php index 2263732..4d29e63 100644 --- a/src/DocBlock.php +++ b/src/DocBlock.php @@ -40,12 +40,9 @@ final class DocBlock private $isTemplateEnd = false; /** - * @param string $summary * @param DocBlock\Tag[] $tags * @param Types\Context $context The context in which the DocBlock occurs. * @param Location $location The location within the file that this DocBlock occurs in. - * @param bool $isTemplateStart - * @param bool $isTemplateEnd */ public function __construct( string $summary = '', @@ -71,9 +68,6 @@ final class DocBlock $this->isTemplateStart = $isTemplateStart; } - /** - * @return string - */ public function getSummary(): string { return $this->summary; @@ -181,8 +175,6 @@ final class DocBlock * Checks if a tag of a certain type is present in this DocBlock. * * @param string $name Tag name to check for. - * - * @return bool */ public function hasTag(string $name): bool { @@ -200,7 +192,6 @@ final class DocBlock * Remove a tag from this DocBlock. * * @param Tag $tag The tag to remove. - * */ public function removeTag(Tag $tagToRemove) { @@ -216,7 +207,6 @@ final class DocBlock * Adds a tag to this DocBlock. * * @param Tag $tag The tag to add. - * */ private function addTag(Tag $tag) { diff --git a/src/DocBlock/Description.php b/src/DocBlock/Description.php index d4bc112..d34c944 100644 --- a/src/DocBlock/Description.php +++ b/src/DocBlock/Description.php @@ -59,7 +59,6 @@ class Description /** * Initializes a Description with its body (template) and a listing of the tags used in the body template. * - * @param string $bodyTemplate * @param Tag[] $tags */ public function __construct(string $bodyTemplate, array $tags = []) @@ -81,9 +80,6 @@ class Description /** * Renders this description as a string where the provided formatter will format the tags in the expected string * format. - * - * - * @return string */ public function render(Formatter $formatter = null): string { @@ -101,8 +97,6 @@ class Description /** * Returns a plain string representation of this description. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/DescriptionFactory.php b/src/DocBlock/DescriptionFactory.php index 54453f6..532788d 100644 --- a/src/DocBlock/DescriptionFactory.php +++ b/src/DocBlock/DescriptionFactory.php @@ -39,7 +39,6 @@ class DescriptionFactory /** * Initializes this factory with the means to construct (inline) tags. - * */ public function __construct(TagFactory $tagFactory) { @@ -49,7 +48,6 @@ class DescriptionFactory /** * Returns the parsed text of this description. * - * @param string $contents * * @return Description */ @@ -63,7 +61,6 @@ class DescriptionFactory /** * Strips the contents from superfluous whitespace and splits the description into a series of tokens. * - * @param string $contents * * @return string[] A series of tokens of which the description text is composed. */ @@ -149,10 +146,6 @@ class DescriptionFactory * * If we do not normalize the indentation then we have superfluous whitespace on the second and subsequent * lines and this may cause rendering issues when, for example, using a Markdown converter. - * - * @param string $contents - * - * @return string */ private function removeSuperfluousStartingWhitespace(string $contents): string { diff --git a/src/DocBlock/ExampleFinder.php b/src/DocBlock/ExampleFinder.php index 8b77160..0e9290a 100644 --- a/src/DocBlock/ExampleFinder.php +++ b/src/DocBlock/ExampleFinder.php @@ -28,9 +28,6 @@ class ExampleFinder /** * Attempts to find the example contents for the given descriptor. - * - * - * @return string */ public function find(Example $example): string { @@ -46,9 +43,6 @@ class ExampleFinder /** * Registers the project's root directory where an 'examples' folder can be expected. - * - * @param string $directory - * */ public function setSourceDirectory(string $directory = '') { @@ -57,8 +51,6 @@ class ExampleFinder /** * Returns the project's root directory where an 'examples' folder can be expected. - * - * @return string */ public function getSourceDirectory(): string { @@ -96,7 +88,6 @@ class ExampleFinder * 3. Checks the 'examples' folder in the current working directory for examples * 4. Checks the path relative to the current working directory for the given filename * - * @param string $filename * * @return string|null */ @@ -127,10 +118,6 @@ class ExampleFinder /** * Get example filepath based on the example directory inside your project. - * - * @param string $file - * - * @return string */ private function getExamplePathFromExampleDirectory(string $file): string { @@ -139,11 +126,6 @@ class ExampleFinder /** * Returns a path to the example file in the given directory.. - * - * @param string $directory - * @param string $file - * - * @return string */ private function constructExamplePath(string $directory, string $file): string { @@ -152,10 +134,6 @@ class ExampleFinder /** * Get example filepath based on sourcecode. - * - * @param string $file - * - * @return string */ private function getExamplePathFromSource(string $file): string { diff --git a/src/DocBlock/Serializer.php b/src/DocBlock/Serializer.php index 70ae83c..9670c16 100644 --- a/src/DocBlock/Serializer.php +++ b/src/DocBlock/Serializer.php @@ -88,8 +88,6 @@ class Serializer } /** - * @param $indent - * @param $text * @return mixed */ private function removeTrailingSpaces($indent, $text) @@ -98,8 +96,6 @@ class Serializer } /** - * @param $indent - * @param $text * @return mixed */ private function addAsterisksForEachLine($indent, $text) @@ -107,10 +103,6 @@ class Serializer return str_replace("\n", "\n{$indent} * ", $text); } - /** - * @param $wrapLength - * @return string - */ private function getSummaryAndDescriptionTextBlock(DocBlock $docblock, $wrapLength): string { $text = $docblock->getSummary() . ((string)$docblock->getDescription() ? "\n\n" . $docblock->getDescription() @@ -123,12 +115,6 @@ class Serializer return $text; } - /** - * @param $wrapLength - * @param $indent - * @param $comment - * @return string - */ private function addTagBlock(DocBlock $docblock, $wrapLength, $indent, $comment): string { foreach ($docblock->getTags() as $tag) { diff --git a/src/DocBlock/StandardTagFactory.php b/src/DocBlock/StandardTagFactory.php index 736afe5..1612e31 100644 --- a/src/DocBlock/StandardTagFactory.php +++ b/src/DocBlock/StandardTagFactory.php @@ -160,7 +160,6 @@ final class StandardTagFactory implements TagFactory /** * Extracts all components for a tag. * - * @param string $tagLine * * @return string[] */ @@ -184,8 +183,6 @@ final class StandardTagFactory implements TagFactory * Creates a new tag object with the given name and body or returns null if the tag name was recognized but the * body was invalid. * - * @param string $body - * @param string $name * * @return Tag|null */ @@ -202,10 +199,6 @@ final class StandardTagFactory implements TagFactory /** * Determines the Fully Qualified Class Name of the Factory or Tag (containing a Factory Method `create`). - * - * @param string $tagName - * - * @return string */ private function findHandlerClassName(string $tagName, TypeContext $context): string { @@ -258,7 +251,6 @@ final class StandardTagFactory implements TagFactory * Retrieves a series of ReflectionParameter objects for the static 'create' method of the given * tag handler class name. * - * @param string $handlerClassName * * @return \ReflectionParameter[] */ @@ -299,11 +291,8 @@ final class StandardTagFactory implements TagFactory /** * Returns whether the given tag belongs to an annotation. * - * @param string $tagContent * * @todo this method should be populated once we implement Annotation notation support. - * - * @return bool */ private function isAnnotation(string $tagContent): bool { diff --git a/src/DocBlock/TagFactory.php b/src/DocBlock/TagFactory.php index 1ed808f..ae0e002 100644 --- a/src/DocBlock/TagFactory.php +++ b/src/DocBlock/TagFactory.php @@ -37,8 +37,6 @@ interface TagFactory * * @param string $name * @param mixed $value - * - * @return void */ public function addParameter(string $name, $value); @@ -52,9 +50,6 @@ interface TagFactory * interface is passed as alias then every time that interface is requested the provided service will be returned. * * @param object $service - * @param string $alias - * - * @return void */ public function addService($service); @@ -86,8 +81,6 @@ interface TagFactory * @throws \InvalidArgumentException if the handler is not a string * @throws \InvalidArgumentException if the handler is not an existing class * @throws \InvalidArgumentException if the handler does not implement the {@see Tag} interface - * - * @return void */ public function registerTagHandler(string $tagName, string $handler); } diff --git a/src/DocBlock/Tags/Author.php b/src/DocBlock/Tags/Author.php index 3b1be27..a8e6e3a 100644 --- a/src/DocBlock/Tags/Author.php +++ b/src/DocBlock/Tags/Author.php @@ -30,9 +30,6 @@ final class Author extends BaseTag implements Factory\StaticMethod /** * Initializes this tag with the author name and e-mail. - * - * @param string $authorName - * @param string $authorEmail */ public function __construct(string $authorName, string $authorEmail) { @@ -66,8 +63,6 @@ final class Author extends BaseTag implements Factory\StaticMethod /** * Returns this tag in string form. - * - * @return string */ public function __toString(): string { @@ -77,7 +72,6 @@ final class Author extends BaseTag implements Factory\StaticMethod /** * Attempts to create a new Author object based on †he tag body. * - * @param string $body * * @return static */ diff --git a/src/DocBlock/Tags/Covers.php b/src/DocBlock/Tags/Covers.php index 2784289..0de91f7 100644 --- a/src/DocBlock/Tags/Covers.php +++ b/src/DocBlock/Tags/Covers.php @@ -32,8 +32,6 @@ final class Covers extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. - * - * @param Description $description */ public function __construct(Fqsen $refers, Description $description = null) { @@ -72,8 +70,6 @@ final class Covers extends BaseTag implements Factory\StaticMethod /** * Returns a string representation of this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Example.php b/src/DocBlock/Tags/Example.php index 8c92355..7c2cfcc 100644 --- a/src/DocBlock/Tags/Example.php +++ b/src/DocBlock/Tags/Example.php @@ -138,8 +138,6 @@ final class Example extends BaseTag /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { @@ -148,27 +146,17 @@ final class Example extends BaseTag /** * Returns true if the provided URI is relative or contains a complete scheme (and thus is absolute). - * - * @param string $uri - * - * @return bool */ private function isUriRelative(string $uri): bool { return false === strpos($uri, ':'); } - /** - * @return int - */ public function getStartingLine(): int { return $this->startingLine; } - /** - * @return int - */ public function getLineCount(): int { return $this->lineCount; diff --git a/src/DocBlock/Tags/Formatter/AlignFormatter.php b/src/DocBlock/Tags/Formatter/AlignFormatter.php index a529782..ac908e3 100644 --- a/src/DocBlock/Tags/Formatter/AlignFormatter.php +++ b/src/DocBlock/Tags/Formatter/AlignFormatter.php @@ -36,9 +36,6 @@ class AlignFormatter implements Formatter /** * Formats the given tag to return a simple plain text version. - * - * - * @return string */ public function format(Tag $tag): string { diff --git a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php index 18d672d..3676cd5 100644 --- a/src/DocBlock/Tags/Formatter/PassthroughFormatter.php +++ b/src/DocBlock/Tags/Formatter/PassthroughFormatter.php @@ -20,9 +20,6 @@ class PassthroughFormatter implements Formatter { /** * Formats the given tag to return a simple plain text version. - * - * - * @return string */ public function format(Tag $tag): string { diff --git a/src/DocBlock/Tags/Generic.php b/src/DocBlock/Tags/Generic.php index afe87d7..63604bc 100644 --- a/src/DocBlock/Tags/Generic.php +++ b/src/DocBlock/Tags/Generic.php @@ -41,9 +41,6 @@ class Generic extends BaseTag implements Factory\StaticMethod /** * Creates a new tag that represents any unknown tag type. * - * @param string $body - * @param string $name - * @param TypeContext $context * * @return static */ @@ -63,8 +60,6 @@ class Generic extends BaseTag implements Factory\StaticMethod /** * Returns the tag as a serialized string - * - * @return string */ public function __toString(): string { @@ -73,9 +68,6 @@ class Generic extends BaseTag implements Factory\StaticMethod /** * Validates if the tag name matches the expected format, otherwise throws an exception. - * - * @param string $name - * */ private function validateTagName(string $name) { diff --git a/src/DocBlock/Tags/Link.php b/src/DocBlock/Tags/Link.php index 69cf5cf..2e76a54 100644 --- a/src/DocBlock/Tags/Link.php +++ b/src/DocBlock/Tags/Link.php @@ -30,8 +30,6 @@ final class Link extends BaseTag implements Factory\StaticMethod /** * Initializes a link to a URL. - * - * @param string $link */ public function __construct(string $link, Description $description = null) { @@ -53,10 +51,8 @@ final class Link extends BaseTag implements Factory\StaticMethod } /** - * Gets the link - * - * @return string - */ + * Gets the link + */ public function getLink(): string { return $this->link; @@ -64,8 +60,6 @@ final class Link extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Method.php b/src/DocBlock/Tags/Method.php index 65ceb44..ab04af2 100644 --- a/src/DocBlock/Tags/Method.php +++ b/src/DocBlock/Tags/Method.php @@ -161,8 +161,6 @@ final class Method extends BaseTag implements Factory\StaticMethod /** * Retrieves the method name. - * - * @return string */ public function getMethodName(): string { diff --git a/src/DocBlock/Tags/Param.php b/src/DocBlock/Tags/Param.php index 249f777..62a89b1 100644 --- a/src/DocBlock/Tags/Param.php +++ b/src/DocBlock/Tags/Param.php @@ -37,11 +37,6 @@ final class Param extends BaseTag implements Factory\StaticMethod /** @var bool determines whether this is a variadic argument */ private $isVariadic = false; - /** - * @param string $variableName - * @param bool $isVariadic - * @param Description $description - */ public function __construct(string $variableName, Type $type = null, bool $isVariadic = false, Description $description = null) { $this->variableName = $variableName; @@ -95,8 +90,6 @@ final class Param extends BaseTag implements Factory\StaticMethod /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -125,8 +118,6 @@ final class Param extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Property.php b/src/DocBlock/Tags/Property.php index 23618b1..aaebec6 100644 --- a/src/DocBlock/Tags/Property.php +++ b/src/DocBlock/Tags/Property.php @@ -34,10 +34,6 @@ class Property extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ class Property extends BaseTag implements Factory\StaticMethod /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ class Property extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/PropertyRead.php b/src/DocBlock/Tags/PropertyRead.php index c210fac..6f44b22 100644 --- a/src/DocBlock/Tags/PropertyRead.php +++ b/src/DocBlock/Tags/PropertyRead.php @@ -34,10 +34,6 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ class PropertyRead extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/PropertyWrite.php b/src/DocBlock/Tags/PropertyWrite.php index 1bba03e..2940d05 100644 --- a/src/DocBlock/Tags/PropertyWrite.php +++ b/src/DocBlock/Tags/PropertyWrite.php @@ -34,10 +34,6 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ class PropertyWrite extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/See.php b/src/DocBlock/Tags/See.php index 64a4504..2562fbb 100644 --- a/src/DocBlock/Tags/See.php +++ b/src/DocBlock/Tags/See.php @@ -34,8 +34,6 @@ class See extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. - * - * @param Description $description */ public function __construct(Reference $refers, Description $description = null) { @@ -77,8 +75,6 @@ class See extends BaseTag implements Factory\StaticMethod /** * Returns a string representation of this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Since.php b/src/DocBlock/Tags/Since.php index b403cda..aee5a11 100644 --- a/src/DocBlock/Tags/Since.php +++ b/src/DocBlock/Tags/Since.php @@ -85,8 +85,6 @@ final class Since extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Uses.php b/src/DocBlock/Tags/Uses.php index d9412e4..25cfa2d 100644 --- a/src/DocBlock/Tags/Uses.php +++ b/src/DocBlock/Tags/Uses.php @@ -32,8 +32,6 @@ final class Uses extends BaseTag implements Factory\StaticMethod /** * Initializes this tag. - * - * @param Fqsen $refers */ public function __construct(Fqsen $refers, Description $description = null) { @@ -72,8 +70,6 @@ final class Uses extends BaseTag implements Factory\StaticMethod /** * Returns a string representation of this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Var_.php b/src/DocBlock/Tags/Var_.php index 3f3c91d..37b4fa4 100644 --- a/src/DocBlock/Tags/Var_.php +++ b/src/DocBlock/Tags/Var_.php @@ -34,10 +34,6 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** @var string */ protected $variableName = ''; - /** - * @param string $variableName - * @param Type $type - */ public function __construct(string $variableName, Type $type = null, Description $description = null) { $this->variableName = $variableName; @@ -84,8 +80,6 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** * Returns the variable's name. - * - * @return string */ public function getVariableName(): string { @@ -104,8 +98,6 @@ class Var_ extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlock/Tags/Version.php b/src/DocBlock/Tags/Version.php index 1f0fc53..9bc78b3 100644 --- a/src/DocBlock/Tags/Version.php +++ b/src/DocBlock/Tags/Version.php @@ -85,8 +85,6 @@ final class Version extends BaseTag implements Factory\StaticMethod /** * Returns a string representation for this tag. - * - * @return string */ public function __toString(): string { diff --git a/src/DocBlockFactory.php b/src/DocBlockFactory.php index 246b74b..e3c364e 100644 --- a/src/DocBlockFactory.php +++ b/src/DocBlockFactory.php @@ -29,8 +29,6 @@ final class DocBlockFactory implements DocBlockFactoryInterface /** * Initializes this factory with the required subcontractors. - * - * @param TagFactory $tagFactory */ public function __construct(DescriptionFactory $descriptionFactory, TagFactory $tagFactory) { @@ -65,7 +63,6 @@ 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). - * @param Location $location * * @return DocBlock */ @@ -111,8 +108,6 @@ final class DocBlockFactory implements DocBlockFactoryInterface * Strips the asterisks from the DocBlock comment. * * @param string $comment String containing the comment text. - * - * @return string */ private function stripDocComment(string $comment): string { @@ -234,8 +229,6 @@ final class DocBlockFactory implements DocBlockFactoryInterface } /** - * @param string $tags - * * @return string[] */ private function splitTagBlockIntoTagLines(string $tags) diff --git a/tests/unit/DocBlock/Tags/MethodTest.php b/tests/unit/DocBlock/Tags/MethodTest.php index b6d1b01..23b6dd4 100644 --- a/tests/unit/DocBlock/Tags/MethodTest.php +++ b/tests/unit/DocBlock/Tags/MethodTest.php @@ -342,9 +342,6 @@ class MethodTest extends TestCase * @uses \phpDocumentor\Reflection\Types\Compound * @uses \phpDocumentor\Reflection\Types\Integer * @uses \phpDocumentor\Reflection\Types\Object_ - * @param string $returnType - * @param string $expectedType - * @param string $expectedValueType * @param string null $expectedKeyType */ public function testCollectionReturnTypes(