Skip to content

Commit ede8f6d

Browse files
authored
Merge pull request #383 from phpDocumentor/bump-phpstam
Bump phpstan
2 parents 6a5a3b7 + 2911a48 commit ede8f6d

File tree

8 files changed

+61
-74
lines changed

8 files changed

+61
-74
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fix-code-style:
1212

1313
.PHONY: static-code-analysis
1414
static-code-analysis: vendor ## Runs a static code analysis with phpstan/phpstan and vimeo/psalm
15-
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon
15+
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=1024M
1616
docker run -it --rm -v${PWD}:/opt/project -w /opt/project php:7.4 vendor/bin/psalm.phar
1717

1818
.PHONY: test

composer.lock

Lines changed: 56 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,5 @@ parameters:
22
level: max
33
ignoreErrors:
44
- '#Method phpDocumentor\\Reflection\\DocBlock\\StandardTagFactory::createTag\(\) should return phpDocumentor\\Reflection\\DocBlock\\Tag but returns mixed#'
5-
- "#Strict comparison using !== between array{'name', 'type'} and array{'name', 'type'} will always evaluate to false#"
6-
- '#Call to static method Webmozart\\Assert\\Assert::implementsInterface\(\) with class-string#'
7-
- '#Class PHPStan\\PhpDocParser\\Lexer\\Lexer does not have a constructor and must be instantiated without any parameters\.#'
8-
- '#Class PHPStan\\PhpDocParser\\Parser\\ConstExprParser constructor invoked with 3 parameters, 0\-1 required\.#'
9-
- '#Class PHPStan\\PhpDocParser\\Parser\\PhpDocParser constructor invoked with 6 parameters, 2\-3 required\.#'
10-
- '#Class PHPStan\\PhpDocParser\\Parser\\TypeParser constructor invoked with 3 parameters\, 0\-1 required\.#'
115
paths:
126
- src

src/DocBlock/StandardTagFactory.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
use function array_merge;
4848
use function array_slice;
4949
use function call_user_func_array;
50-
use function count;
5150
use function get_class;
5251
use function is_object;
5352
use function preg_match;
@@ -205,10 +204,6 @@ private function extractTagParts(string $tagLine): array
205204
);
206205
}
207206

208-
if (count($matches) < 3) {
209-
$matches[] = '';
210-
}
211-
212207
return array_slice($matches, 1);
213208
}
214209

src/DocBlock/Tags/Example.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,10 @@ public static function create(string $body): ?Tag
9494

9595
$filePath = null;
9696
$fileUri = null;
97-
if ($matches[1] !== '') {
97+
if (array_key_exists(1, $matches) && $matches[1] !== '') {
9898
$filePath = $matches[1];
9999
} else {
100-
$fileUri = $matches[2];
100+
$fileUri = array_key_exists(2, $matches) ? $matches[2] : '';
101101
}
102102

103103
$startingLine = 1;

src/DocBlock/Tags/Factory/AbstractPHPStanFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,12 @@ private function tokenizeLine(string $tagLine): TokenIterator
104104
$fixed[] = [
105105
rtrim($token[Lexer::VALUE_OFFSET], " \t"),
106106
Lexer::TOKEN_PHPDOC_EOL,
107-
$token[2] ?? null,
107+
$token[2],
108108
];
109109
$fixed[] = [
110110
ltrim($token[Lexer::VALUE_OFFSET], "\n\r"),
111111
Lexer::TOKEN_HORIZONTAL_WS,
112-
($token[2] ?? null) + 1,
112+
$token[2] + 1,
113113
];
114114
continue;
115115
}

src/DocBlock/Tags/Factory/TemplateFactory.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace phpDocumentor\Reflection\DocBlock\Tags\Factory;
66

7-
use InvalidArgumentException;
87
use phpDocumentor\Reflection\DocBlock\DescriptionFactory;
98
use phpDocumentor\Reflection\DocBlock\Tag;
109
use phpDocumentor\Reflection\DocBlock\Tags\Template;
@@ -36,9 +35,6 @@ public function create(PhpDocTagNode $node, Context $context): Tag
3635

3736
Assert::isInstanceOf($tagValue, TemplateTagValueNode::class);
3837
$name = $tagValue->name;
39-
if ($name === '') {
40-
throw new InvalidArgumentException('Template name cannot be empty');
41-
}
4238

4339
$description = $tagValue->getAttribute('description');
4440
if (is_string($description) === false) {

src/DocBlock/Tags/MethodParameter.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
use phpDocumentor\Reflection\DocBlock\Tags\Factory\MethodParameterFactory;
1616
use phpDocumentor\Reflection\Type;
1717

18-
use function implode;
19-
use function is_array;
20-
2118
final class MethodParameter
2219
{
2320
private Type $type;

0 commit comments

Comments
 (0)