Skip to content

Commit e65b553

Browse files
committed
Strict rules
1 parent 970951e commit e65b553

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
"phpunit/phpunit": "^6.3",
1414
"slevomat/coding-standard": "^4.7.2",
1515
"squizlabs/php_codesniffer": "^3.3.2",
16-
"symfony/process": "^3.4 || ^4.0"
16+
"symfony/process": "^3.4 || ^4.0",
17+
"phpstan/extension-installer": "^1.0",
18+
"phpstan/phpstan-strict-rules": "^0.12"
1719
},
1820
"autoload": {
1921
"psr-4": {"PHPStan\\PhpDocParser\\": ["src/"]}

phpstan.neon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
parameters:
2-
ignoreErrors: []
2+
ignoreErrors:
3+
- '#^Dynamic call to static method PHPUnit\\Framework\\Assert#'

src/Ast/PhpDoc/MethodTagValueNode.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(bool $isStatic, ?TypeNode $returnType, string $metho
3535
public function __toString(): string
3636
{
3737
$static = $this->isStatic ? 'static ' : '';
38-
$returnType = $this->returnType ? "{$this->returnType} " : '';
38+
$returnType = $this->returnType !== null ? "{$this->returnType} " : '';
3939
$parameters = implode(', ', $this->parameters);
4040
$description = $this->description !== '' ? " {$this->description}" : '';
4141
return "{$static}{$returnType}{$this->methodName}({$parameters}){$description}";

src/Ast/PhpDoc/MethodTagValueParameterNode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public function __construct(?TypeNode $type, bool $isReference, bool $isVariadic
3636

3737
public function __toString(): string
3838
{
39-
$type = $this->type ? "{$this->type} " : '';
39+
$type = $this->type !== null ? "{$this->type} " : '';
4040
$isReference = $this->isReference ? '&' : '';
4141
$isVariadic = $this->isVariadic ? '...' : '';
42-
$default = $this->defaultValue ? " = {$this->defaultValue}" : '';
42+
$default = $this->defaultValue !== null ? " = {$this->defaultValue}" : '';
4343
return "{$type}{$isReference}{$isVariadic}{$this->parameterName}{$default}";
4444
}
4545

src/Parser/TypeParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ private function parseNullable(TokenIterator $tokens): Ast\Type\TypeNode
108108
public function parseGeneric(TokenIterator $tokens, Ast\Type\IdentifierTypeNode $baseType): Ast\Type\GenericTypeNode
109109
{
110110
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
111-
$genericTypes[] = $this->parse($tokens);
111+
$genericTypes = [$this->parse($tokens)];
112112

113113
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
114114
$genericTypes[] = $this->parse($tokens);

0 commit comments

Comments
 (0)