Bump phpstan

Fixes a number of phpstan issues.
This commit is contained in:
Jaapio
2024-11-04 21:17:08 +01:00
parent 6a5a3b7748
commit 2911a4807e
8 changed files with 61 additions and 74 deletions
-5
View File
@@ -47,7 +47,6 @@ use function array_key_exists;
use function array_merge;
use function array_slice;
use function call_user_func_array;
use function count;
use function get_class;
use function is_object;
use function preg_match;
@@ -205,10 +204,6 @@ final class StandardTagFactory implements TagFactory
);
}
if (count($matches) < 3) {
$matches[] = '';
}
return array_slice($matches, 1);
}
+2 -2
View File
@@ -94,10 +94,10 @@ final class Example implements Tag, Factory\StaticMethod
$filePath = null;
$fileUri = null;
if ($matches[1] !== '') {
if (array_key_exists(1, $matches) && $matches[1] !== '') {
$filePath = $matches[1];
} else {
$fileUri = $matches[2];
$fileUri = array_key_exists(2, $matches) ? $matches[2] : '';
}
$startingLine = 1;
@@ -104,12 +104,12 @@ class AbstractPHPStanFactory implements Factory
$fixed[] = [
rtrim($token[Lexer::VALUE_OFFSET], " \t"),
Lexer::TOKEN_PHPDOC_EOL,
$token[2] ?? null,
$token[2],
];
$fixed[] = [
ltrim($token[Lexer::VALUE_OFFSET], "\n\r"),
Lexer::TOKEN_HORIZONTAL_WS,
($token[2] ?? null) + 1,
$token[2] + 1,
];
continue;
}
@@ -4,7 +4,6 @@ declare(strict_types=1);
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
use InvalidArgumentException;
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
use phpDocumentor\Reflection\DocBlock\Tag;
use phpDocumentor\Reflection\DocBlock\Tags\Template;
@@ -36,9 +35,6 @@ final class TemplateFactory implements PHPStanFactory
Assert::isInstanceOf($tagValue, TemplateTagValueNode::class);
$name = $tagValue->name;
if ($name === '') {
throw new InvalidArgumentException('Template name cannot be empty');
}
$description = $tagValue->getAttribute('description');
if (is_string($description) === false) {
-3
View File
@@ -15,9 +15,6 @@ namespace phpDocumentor\Reflection\DocBlock\Tags;
use phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodParameterFactory;
use phpDocumentor\Reflection\Type;
use function implode;
use function is_array;
final class MethodParameter
{
private Type $type;