drop asserts where not needed

This commit is contained in:
TomasVotruba
2017-11-30 10:27:01 +01:00
committed by Jaap van Otterdijk
parent 193731a153
commit 5e1bad3628
6 changed files with 1 additions and 20 deletions
-1
View File
@@ -86,7 +86,6 @@ final class MyTag extends BaseTag implements StaticMethod
*/ */
public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag
{ {
Assert::string($body);
Assert::notNull($descriptionFactory); Assert::notNull($descriptionFactory);
return new static($descriptionFactory->create($body, $context)); return new static($descriptionFactory->create($body, $context));
-7
View File
@@ -56,9 +56,6 @@ final class DocBlock
bool $isTemplateStart = false, bool $isTemplateStart = false,
bool $isTemplateEnd = false bool $isTemplateEnd = false
) { ) {
Assert::string($summary);
Assert::boolean($isTemplateStart);
Assert::boolean($isTemplateEnd);
Assert::allIsInstanceOf($tags, Tag::class); Assert::allIsInstanceOf($tags, Tag::class);
$this->summary = $summary; $this->summary = $summary;
@@ -166,8 +163,6 @@ final class DocBlock
*/ */
public function getTagsByName(string $name) public function getTagsByName(string $name)
{ {
Assert::string($name);
$result = []; $result = [];
/** @var Tag $tag */ /** @var Tag $tag */
@@ -191,8 +186,6 @@ final class DocBlock
*/ */
public function hasTag(string $name): bool public function hasTag(string $name): bool
{ {
Assert::string($name);
/** @var Tag $tag */ /** @var Tag $tag */
foreach ($this->getTags() as $tag) { foreach ($this->getTags() as $tag) {
if ($tag->getName() === $name) { if ($tag->getName() === $name) {
+1 -7
View File
@@ -45,14 +45,8 @@ class Serializer
* @param int|null $lineLength The max length of a line or NULL to disable line wrapping. * @param int|null $lineLength The max length of a line or NULL to disable line wrapping.
* @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter. * @param DocBlock\Tags\Formatter $tagFormatter A custom tag formatter, defaults to PassthroughFormatter.
*/ */
public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, int $lineLength = null, DocBlock\Tags\Formatter $tagFormatter = null) public function __construct(int $indent = 0, string $indentString = ' ', bool $indentFirstLine = true, ?int $lineLength = null, ?DocBlock\Tags\Formatter $tagFormatter = null)
{ {
Assert::integer($indent);
Assert::string($indentString);
Assert::boolean($indentFirstLine);
Assert::nullOrInteger($lineLength);
Assert::nullOrIsInstanceOf($tagFormatter, 'phpDocumentor\Reflection\DocBlock\Tags\Formatter');
$this->indent = $indent; $this->indent = $indent;
$this->indentString = $indentString; $this->indentString = $indentString;
$this->isFirstLineIndented = $indentFirstLine; $this->isFirstLineIndented = $indentFirstLine;
-2
View File
@@ -84,8 +84,6 @@ final class Author extends BaseTag implements Factory\StaticMethod
*/ */
public static function create(string $body) public static function create(string $body)
{ {
Assert::string($body);
$splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches); $splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches);
if (!$splitTagContent) { if (!$splitTagContent) {
return null; return null;
-2
View File
@@ -35,8 +35,6 @@ final class Link extends BaseTag implements Factory\StaticMethod
*/ */
public function __construct(string $link, Description $description = null) public function __construct(string $link, Description $description = null)
{ {
Assert::string($link);
$this->link = $link; $this->link = $link;
$this->description = $description; $this->description = $description;
} }
-1
View File
@@ -60,7 +60,6 @@ final class Since extends BaseTag implements Factory\StaticMethod
DescriptionFactory $descriptionFactory = null, DescriptionFactory $descriptionFactory = null,
TypeContext $context = null TypeContext $context = null
) { ) {
Assert::nullOrString($body);
if (empty($body)) { if (empty($body)) {
return new static(); return new static();
} }