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
{{ message }}
Repository navigation
Always evaluated scope is not detected if condition is stronger #9685
in the repro, there are two methods with the same code, in the 2nd method, an extra condition is added making the condition later stronger - but phpstan does handle it as weaker
@@ @@+PHP 8.4 (3 errors)+==========++24: Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.+39: Variable $scopeRestored might not be defined.+47: Variable $scopeRestored might not be defined.+
PHP 8.0 – 8.3 (2 errors)
==========
Full report
PHP 8.4 (3 errors)
Line
Error
24
Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.
39
Variable $scopeRestored might not be defined.
47
Variable $scopeRestored might not be defined.
PHP 8.0 – 8.3 (2 errors)
Line
Error
39
Variable $scopeRestored might not be defined.
47
Variable $scopeRestored might not be defined.
PHP 7.2 – 7.4 (3 errors)
Line
Error
4
Promoted properties are supported only on PHP 8.0 and later.
@@ @@-PHP 8.0 – 8.3 (2 errors)+PHP 8.4 – 8.5 (4 errors)
==========
+24: Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.
39: Variable $scopeRestored might not be defined.
47: Variable $scopeRestored might not be defined.
+48: Value assigned to variable $scopeRestored is never read.-PHP 7.2 – 7.4 (3 errors)+PHP 8.0 – 8.3 (3 errors)
==========
+39: Variable $scopeRestored might not be defined.+47: Variable $scopeRestored might not be defined.+48: Value assigned to variable $scopeRestored is never read.++PHP 7.2 – 7.4 (4 errors)+==========+
4: Promoted properties are supported only on PHP 8.0 and later.
39: Variable $scopeRestored might not be defined.
-47: Variable $scopeRestored might not be defined.+47: Variable $scopeRestored might not be defined.+48: Value assigned to variable $scopeRestored is never read.
Full report
PHP 8.4 – 8.5 (4 errors)
Line
Error
24
Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.
39
Variable $scopeRestored might not be defined.
47
Variable $scopeRestored might not be defined.
48
Value assigned to variable $scopeRestored is never read.
PHP 8.0 – 8.3 (3 errors)
Line
Error
39
Variable $scopeRestored might not be defined.
47
Variable $scopeRestored might not be defined.
48
Value assigned to variable $scopeRestored is never read.
PHP 7.2 – 7.4 (4 errors)
Line
Error
4
Promoted properties are supported only on PHP 8.0 and later.
39
Variable $scopeRestored might not be defined.
47
Variable $scopeRestored might not be defined.
48
Value assigned to variable $scopeRestored is never read.
Activity
mvorisek commentedon Sep 2, 2023
another repro: https://phpstan.org/r/412b11c8-d545-4152-b629-46f5e9544846
phpstan-bot commentedon Sep 5, 2024
@mvorisek After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.4 (3 errors)
Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.PHP 8.0 – 8.3 (2 errors)
Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.PHP 7.2 – 7.4 (3 errors)
Promoted properties are supported only on PHP 8.0 and later.Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.phpstan-bot commentedon Nov 1, 2025
@mvorisek After the latest push in 2.1.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.4 – 8.5 (3 errors)
Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.PHP 8.0 – 8.3 (2 errors)
Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.PHP 7.2 – 7.4 (3 errors)
Promoted properties are supported only on PHP 8.0 and later.Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.phpstan-bot commentedon Sep 11, 2026
@mvorisek After the latest push in 2.3.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.4 – 8.5 (4 errors)
Deprecated in PHP 8.4: Parameter #1 $field (string) is implicitly nullable via default value null.Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.Value assigned to variable $scopeRestored is never read.PHP 8.0 – 8.3 (3 errors)
Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.Value assigned to variable $scopeRestored is never read.PHP 7.2 – 7.4 (4 errors)
Promoted properties are supported only on PHP 8.0 and later.Variable $scopeRestored might not be defined.Variable $scopeRestored might not be defined.Value assigned to variable $scopeRestored is never read.github-actions commentedon Oct 13, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.