mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 01:57:13 +00:00
drop asserts where not needed
This commit is contained in:
committed by
Jaap van Otterdijk
parent
193731a153
commit
5e1bad3628
@@ -86,7 +86,6 @@ final class MyTag extends BaseTag implements StaticMethod
|
||||
*/
|
||||
public static function create(string $body, DescriptionFactory $descriptionFactory = null, Context $context = null): MyTag
|
||||
{
|
||||
Assert::string($body);
|
||||
Assert::notNull($descriptionFactory);
|
||||
|
||||
return new static($descriptionFactory->create($body, $context));
|
||||
|
||||
@@ -56,9 +56,6 @@ final class DocBlock
|
||||
bool $isTemplateStart = false,
|
||||
bool $isTemplateEnd = false
|
||||
) {
|
||||
Assert::string($summary);
|
||||
Assert::boolean($isTemplateStart);
|
||||
Assert::boolean($isTemplateEnd);
|
||||
Assert::allIsInstanceOf($tags, Tag::class);
|
||||
|
||||
$this->summary = $summary;
|
||||
@@ -166,8 +163,6 @@ final class DocBlock
|
||||
*/
|
||||
public function getTagsByName(string $name)
|
||||
{
|
||||
Assert::string($name);
|
||||
|
||||
$result = [];
|
||||
|
||||
/** @var Tag $tag */
|
||||
@@ -191,8 +186,6 @@ final class DocBlock
|
||||
*/
|
||||
public function hasTag(string $name): bool
|
||||
{
|
||||
Assert::string($name);
|
||||
|
||||
/** @var Tag $tag */
|
||||
foreach ($this->getTags() as $tag) {
|
||||
if ($tag->getName() === $name) {
|
||||
|
||||
@@ -45,14 +45,8 @@ class Serializer
|
||||
* @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.
|
||||
*/
|
||||
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->indentString = $indentString;
|
||||
$this->isFirstLineIndented = $indentFirstLine;
|
||||
|
||||
@@ -84,8 +84,6 @@ final class Author extends BaseTag implements Factory\StaticMethod
|
||||
*/
|
||||
public static function create(string $body)
|
||||
{
|
||||
Assert::string($body);
|
||||
|
||||
$splitTagContent = preg_match('/^([^\<]*)(?:\<([^\>]*)\>)?$/u', $body, $matches);
|
||||
if (!$splitTagContent) {
|
||||
return null;
|
||||
|
||||
@@ -35,8 +35,6 @@ final class Link extends BaseTag implements Factory\StaticMethod
|
||||
*/
|
||||
public function __construct(string $link, Description $description = null)
|
||||
{
|
||||
Assert::string($link);
|
||||
|
||||
$this->link = $link;
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,6 @@ final class Since extends BaseTag implements Factory\StaticMethod
|
||||
DescriptionFactory $descriptionFactory = null,
|
||||
TypeContext $context = null
|
||||
) {
|
||||
Assert::nullOrString($body);
|
||||
if (empty($body)) {
|
||||
return new static();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user