You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix get_class($this) losing static type information
- StaticType::getClassStringType() was delegating to getStaticObjectType() which
returned the base ObjectType, losing the static/this type information
- Changed it to return GenericClassStringType($this) directly, preserving the
static type so get_class($this) correctly returns class-string<static(T)>
- This fixes false positives when passing get_class($this) to template methods
expecting class-string<T> and returning T, where the return should be static
- New regression test in tests/PHPStan/Analyser/nsrt/bug-4860.php
- Updated existing test expectations to reflect the more precise type
Copy file name to clipboardExpand all lines: tests/PHPStan/Rules/Comparison/StrictComparisonOfDifferentTypesRuleTest.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -566,7 +566,7 @@ public function testBug3633(): void
566
566
$tipText = 'Because the type is coming from a PHPDoc, you can turn off this check by setting <fg=cyan>treatPhpDocTypesAsCertain: false</> in your <fg=cyan>%configurationFile%</>.';
0 commit comments