Skip to content

Commit 8405df9

Browse files
Update dependency phpstan/phpstan to v2.1.50 (#1899)
* Update dependency phpstan/phpstan to v2.1.50 * Fix PHPStan error with ReflectionAttribute::newInstance() return type PHPStan 2.1.50 no longer infers the generic type parameter of ReflectionAttribute when getAttributes() is called on a union type (ReflectionClassConstant|ReflectionClass), resulting in object instead of the expected Description type. 🤖 Generated with Claude Code --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benedikt Franke <benedikt.franke@mll.com>
1 parent e8f77f8 commit 8405df9

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"nyholm/psr7": "^1.5",
2424
"phpbench/phpbench": "^1.2",
2525
"phpstan/extension-installer": "^1.1",
26-
"phpstan/phpstan": "2.1.46",
26+
"phpstan/phpstan": "2.1.50",
2727
"phpstan/phpstan-phpunit": "2.0.16",
2828
"phpstan/phpstan-strict-rules": "2.0.10",
2929
"phpunit/phpunit": "^9.5 || ^10.5.21 || ^11",

src/Type/Definition/PhpEnumType.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,10 @@ protected function extractDescription(\ReflectionClassConstant|\ReflectionClass
108108
$attributes = $reflection->getAttributes(Description::class);
109109

110110
if (count($attributes) === 1) {
111-
return $attributes[0]->newInstance()->description;
111+
$description = $attributes[0]->newInstance();
112+
assert($description instanceof Description);
113+
114+
return $description->description;
112115
}
113116

114117
if (count($attributes) > 1) {

0 commit comments

Comments
 (0)