diff --git a/src/DocBlock/Tags/Mixin.php b/src/DocBlock/Tags/Mixin.php index f0d1fa6..c15d30c 100644 --- a/src/DocBlock/Tags/Mixin.php +++ b/src/DocBlock/Tags/Mixin.php @@ -48,17 +48,4 @@ final class Mixin extends TagWithType implements Factory\StaticMethod return new static($type, $description); } - - public function __toString(): string - { - if ($this->description) { - $description = $this->description->render(); - } else { - $description = ''; - } - - $type = (string) $this->type; - - return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); - } } diff --git a/src/DocBlock/Tags/Return_.php b/src/DocBlock/Tags/Return_.php index f130760..7e9b0c7 100644 --- a/src/DocBlock/Tags/Return_.php +++ b/src/DocBlock/Tags/Return_.php @@ -60,17 +60,4 @@ final class Return_ extends TagWithType implements Factory\StaticMethod return new static($type, $description); } - - public function __toString(): string - { - if ($this->description) { - $description = $this->description->render(); - } else { - $description = ''; - } - - $type = $this->type ? '' . $this->type : 'mixed'; - - return $type . ($description !== '' ? ' ' . $description : ''); - } } diff --git a/src/DocBlock/Tags/TagWithType.php b/src/DocBlock/Tags/TagWithType.php index 271c41b..89e29e5 100644 --- a/src/DocBlock/Tags/TagWithType.php +++ b/src/DocBlock/Tags/TagWithType.php @@ -71,4 +71,17 @@ abstract class TagWithType extends BaseTag return [$type, $description]; } + + public function __toString(): string + { + if ($this->description) { + $description = $this->description->render(); + } else { + $description = ''; + } + + $type = (string) $this->type; + + return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); + } } diff --git a/src/DocBlock/Tags/Throws.php b/src/DocBlock/Tags/Throws.php index f21c910..e081846 100644 --- a/src/DocBlock/Tags/Throws.php +++ b/src/DocBlock/Tags/Throws.php @@ -48,17 +48,4 @@ final class Throws extends TagWithType implements Factory\StaticMethod return new static($type, $description); } - - public function __toString(): string - { - if ($this->description) { - $description = $this->description->render(); - } else { - $description = ''; - } - - $type = (string) $this->type; - - return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : ''); - } }