Skip to content

Commit 68d01a5

Browse files
committed
Update BetterReflection
1 parent 3b47bc0 commit 68d01a5

File tree

5 files changed

+18
-24
lines changed

5 files changed

+18
-24
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"nette/utils": "^3.2.5",
2525
"nikic/php-parser": "^5.3.0",
2626
"ondram/ci-detector": "^3.4.0",
27-
"ondrejmirtes/better-reflection": "6.42.0.11",
27+
"ondrejmirtes/better-reflection": "6.43.0.2",
2828
"phpstan/php-8-stubs": "0.4.6",
2929
"phpstan/phpdoc-parser": "2.0.0",
3030
"psr/http-message": "^1.1",

composer.lock

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

src/Reflection/BetterReflection/Type/AdapterReflectionEnumCaseDynamicReturnTypeExtension.php

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

55
use PhpParser\Node\Expr\MethodCall;
66
use PHPStan\Analyser\Scope;
7-
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionIntersectionType;
8-
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType;
9-
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionUnionType;
7+
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionType;
108
use PHPStan\Php\PhpVersion;
119
use PHPStan\Reflection\MethodReflection;
1210
use PHPStan\Type\Constant\ConstantBooleanType;
@@ -56,9 +54,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
5654

5755
if ($methodReflection->getName() === 'getType') {
5856
return new UnionType([
59-
new ObjectType(ReflectionIntersectionType::class),
60-
new ObjectType(ReflectionNamedType::class),
61-
new ObjectType(ReflectionUnionType::class),
57+
new ObjectType(ReflectionType::class),
6258
new NullType(),
6359
]);
6460
}

src/Reflection/BetterReflection/Type/AdapterReflectionEnumDynamicReturnTypeExtension.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,7 @@ public function getTypeFromMethodCall(MethodReflection $methodReflection, Method
7272
}
7373

7474
if (in_array($methodReflection->getName(), ['getStartLine', 'getEndLine'], true)) {
75-
return new UnionType([
76-
new IntegerType(),
77-
new ConstantBooleanType(false),
78-
]);
75+
return new IntegerType();
7976
}
8077

8178
if ($methodReflection->getName() === 'getReflectionConstant') {

tests/PHPStan/Analyser/nsrt/adapter-reflection-enum-return-types.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@
55
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnum;
66
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnumBackedCase;
77
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionEnumUnitCase;
8+
use PHPStan\BetterReflection\Reflection\Adapter\ReflectionType;
89
use function PHPStan\Testing\assertType;
910

1011
function (ReflectionEnum $r, string $s): void {
1112
assertType('non-empty-string|false', $r->getFileName());
12-
assertType('int|false', $r->getStartLine());
13-
assertType('int|false', $r->getEndLine());
13+
assertType('int', $r->getStartLine());
14+
assertType('int', $r->getEndLine());
1415
assertType('string|false', $r->getDocComment());
1516
assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionClassConstant|false', $r->getReflectionConstant($s));
1617
assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionClass|false', $r->getParentClass());
@@ -20,10 +21,10 @@ function (ReflectionEnum $r, string $s): void {
2021

2122
function (ReflectionEnumBackedCase $r): void {
2223
assertType('string|false', $r->getDocComment());
23-
assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionIntersectionType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionUnionType|null', $r->getType());
24+
assertType(ReflectionType::class . '|null', $r->getType());
2425
};
2526

2627
function (ReflectionEnumUnitCase $r): void {
2728
assertType('string|false', $r->getDocComment());
28-
assertType('PHPStan\BetterReflection\Reflection\Adapter\ReflectionIntersectionType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionNamedType|PHPStan\BetterReflection\Reflection\Adapter\ReflectionUnionType|null', $r->getType());
29+
assertType(ReflectionType::class . '|null', $r->getType());
2930
};

0 commit comments

Comments
 (0)