Skip to content

Commit 5e1bad3

Browse files
TomasVotrubajaapio
authored andcommitted
drop asserts where not needed
1 parent 193731a commit 5e1bad3

File tree

6 files changed

+1
-20
lines changed

6 files changed

+1
-20
lines changed

examples/04-adding-your-own-tag.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ public function __construct(Description $description = null)
8686
*/
8787
public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag
8888
{
89-
Assert::string($body);
9089
Assert::notNull($descriptionFactory);
9190

9291
return new static($descriptionFactory->create($body, $context));

src/DocBlock.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ public function __construct(
5656
bool $isTemplateStart = false,
5757
bool $isTemplateEnd = false
5858
) {
59-
Assert::string($summary);
60-
Assert::boolean($isTemplateStart);
61-
Assert::boolean($isTemplateEnd);
6259
Assert::allIsInstanceOf($tags, Tag::class);
6360

6461
$this->summary = $summary;
@@ -166,8 +163,6 @@ public function getTags()
166163
*/
167164
public function getTagsByName(string $name)
168165
{
169-
Assert::string($name);
170-
171166
$result = [];
172167

173168
/** @var Tag $tag */
@@ -191,8 +186,6 @@ public function getTagsByName(string $name)
191186
*/
192187
public function hasTag(string $name): bool
193188
{
194-
Assert::string($name);
195-
196189
/** @var Tag $tag */
197190
foreach ($this->getTags() as $tag) {
198191
if ($tag->getName() === $name) {

src/DocBlock/Serializer.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,8 @@ class Serializer
4545
* @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
4646
* @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter.
4747
*/
48-
public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, int $lineLength = null, DocBlock\Tags\Formatter $tagFormatter = null)
48+
public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, ?int $lineLength = null, ?DocBlock\Tags\Formatter $tagFormatter = null)
4949
{
50-
Assert::integer($indent);
51-
Assert::string($indentString);
52-
Assert::boolean($indentFirstLine);
53-
Assert::nullOrInteger($lineLength);
54-
Assert::nullOrIsInstanceOf($tagFormatter, 'phpDocumentor\Reflection\DocBlock\Tags\Formatter');
55-
5650
$this->indent = $indent;
5751
$this->indentString = $indentString;
5852
$this->isFirstLineIndented = $indentFirstLine;

src/DocBlock/Tags/Author.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@ public function __toString(): string
8484
*/
8585
public static function create(string $body)
8686
{
87-
Assert::string($body);
88-
8987
$splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches);
9088
if (!$splitTagContent) {
9189
return null;

src/DocBlock/Tags/Link.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ final class Link extends BaseTag implements Factory\StaticMethod
3535
*/
3636
public function __construct(string $link, Description $description = null)
3737
{
38-
Assert::string($link);
39-
4038
$this->link = $link;
4139
$this->description = $description;
4240
}

src/DocBlock/Tags/Since.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ public static function create(
6060
DescriptionFactory $descriptionFactory = null,
6161
TypeContext $context = null
6262
) {
63-
Assert::nullOrString($body);
6463
if (empty($body)) {
6564
return new static();
6665
}

0 commit comments

Comments
 (0)