Skip to content

Commit ab2c140

Browse files
committed
PHPStan 1.10.59
1 parent feb27f0 commit ab2c140

File tree

3 files changed

+10
-18
lines changed

3 files changed

+10
-18
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"doctrine/annotations": "^1.13 || ^2",
4343
"doctrine/coding-standard": "^9.0.2 || ^12.0",
4444
"phpbench/phpbench": "^0.16.10 || ^1.0",
45-
"phpstan/phpstan": "~1.4.10 || 1.10.35",
45+
"phpstan/phpstan": "~1.4.10 || 1.10.59",
4646
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.6",
4747
"psr/log": "^1 || ^2 || ^3",
4848
"squizlabs/php_codesniffer": "3.7.2",

phpstan-baseline.neon

+3-13
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ parameters:
231231
path: src/Mapping/Driver/XmlDriver.php
232232

233233
-
234-
message: "#^Offset 'version' on \\*NEVER\\* in isset\\(\\) always exists and is always null\\.$#"
234+
message: "#^Offset 'version' on \\*NEVER\\* in isset\\(\\) always exists and is not nullable\\.$#"
235235
count: 1
236236
path: src/Mapping/Driver/XmlDriver.php
237237

@@ -326,7 +326,7 @@ parameters:
326326
path: src/Query/AST/Functions/DateSubFunction.php
327327

328328
-
329-
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\AST\\\\IndexBy\\:\\:dispatch\\(\\) should return string but returns void\\.$#"
329+
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\AST\\\\IndexBy\\:\\:dispatch\\(\\) should return string but returns null\\.$#"
330330
count: 1
331331
path: src/Query/AST/IndexBy.php
332332

@@ -375,11 +375,6 @@ parameters:
375375
count: 1
376376
path: src/Query/Expr/Select.php
377377

378-
-
379-
message: "#^Comparison operation \"\\<\" between null and 102 is always true\\.$#"
380-
count: 1
381-
path: src/Query/Parser.php
382-
383378
-
384379
message: "#^Method Doctrine\\\\ORM\\\\Query\\\\Parser\\:\\:ArithmeticFactor\\(\\) should return Doctrine\\\\ORM\\\\Query\\\\AST\\\\ArithmeticFactor but returns Doctrine\\\\ORM\\\\Query\\\\AST\\\\Node\\|string\\.$#"
385380
count: 1
@@ -395,14 +390,9 @@ parameters:
395390
count: 1
396391
path: src/Query/Parser.php
397392

398-
-
399-
message: "#^Result of && is always true\\.$#"
400-
count: 1
401-
path: src/Query/Parser.php
402-
403393
-
404394
message: "#^Unreachable statement \\- code above always terminates\\.$#"
405-
count: 4
395+
count: 3
406396
path: src/Query/Parser.php
407397

408398
-

src/Mapping/DefaultTypedFieldMapper.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Doctrine\ORM\Mapping;
66

7+
use BackedEnum;
78
use DateInterval;
89
use DateTime;
910
use DateTimeImmutable;
@@ -16,6 +17,7 @@
1617
use function array_merge;
1718
use function assert;
1819
use function enum_exists;
20+
use function is_a;
1921

2022
use const PHP_VERSION_ID;
2123

@@ -54,18 +56,18 @@ public function validateAndComplete(array $mapping, ReflectionProperty $field):
5456
&& ($type instanceof ReflectionNamedType)
5557
) {
5658
if (PHP_VERSION_ID >= 80100 && ! $type->isBuiltin() && enum_exists($type->getName())) {
57-
$mapping['enumType'] = $type->getName();
58-
5959
$reflection = new ReflectionEnum($type->getName());
6060
if (! $reflection->isBacked()) {
6161
throw MappingException::backedEnumTypeRequired(
6262
$field->class,
6363
$mapping['fieldName'],
64-
$mapping['enumType']
64+
$type->getName(),
6565
);
6666
}
6767

68-
$type = $reflection->getBackingType();
68+
assert(is_a($type->getName(), BackedEnum::class, true));
69+
$mapping['enumType'] = $type->getName();
70+
$type = $reflection->getBackingType();
6971

7072
assert($type instanceof ReflectionNamedType);
7173
}

0 commit comments

Comments
 (0)