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
Says string is mixed after checked and exception thrown #9647
@@ @@-19: Property test::$properString (string) does not accept mixed.+PHP 8.0 – 8.3 (1 error)+==========++19: Property test::$properString (string) does not accept mixed.++PHP 7.2 – 7.4 (6 errors)+==========++ 5: Property test::$properString is never written, only read.+ 7: Tip: Method test::doSomething() always throws an exception, it should have return type "never".+ 7: Parameter $string of method test::doSomething() has invalid type mixed.+11: Call to function is_string() with mixed will always evaluate to false.+15: Variable $errors in empty() always exists and is not falsy.+19: Unreachable statement - code above always terminates.
Full report
PHP 8.0 – 8.3 (1 error)
Line
Error
19
Property test::$properString (string) does not accept mixed.
PHP 7.2 – 7.4 (6 errors)
Line
Error
5
Property test::$properString is never written, only read.
7
Tip: Method test::doSomething() always throws an exception, it should have return type "never".
7
Parameter $string of method test::doSomething() has invalid type mixed.
11
Call to function is_string() with mixed will always evaluate to false.
15
Variable $errors in empty() always exists and is not falsy.
@@ @@-No errors+PHP 8.0 – 8.3+==========++No errors++PHP 7.2 – 7.4 (6 errors)+==========++ 5: Property test::$properString is never written, only read.+ 7: Tip: Method test::doSomething() always throws an exception, it should have return type "never".+ 7: Parameter $string of method test::doSomething() has invalid type mixed.+11: Call to function is_string() with mixed will always evaluate to false.+15: Variable $errors in empty() always exists and is not falsy.+19: Unreachable statement - code above always terminates.
Full report
PHP 8.0 – 8.3
No errors
PHP 7.2 – 7.4 (6 errors)
Line
Error
5
Property test::$properString is never written, only read.
7
Tip: Method test::doSomething() always throws an exception, it should have return type "never".
7
Parameter $string of method test::doSomething() has invalid type mixed.
11
Call to function is_string() with mixed will always evaluate to false.
15
Variable $errors in empty() always exists and is not falsy.
@@ @@-19: Property test::$properString (string) does not accept mixed.+PHP 8.0 – 8.3 (1 error)+==========++19: Property test::$properString (string) does not accept mixed.++PHP 7.2 – 7.4 (8 errors)+==========++ 5: Property test::$properString is never written, only read.+ 7: Tip: Method test::doSomething() always throws an exception, it should have return type "never".+ 7: Parameter $string of method test::doSomething() has invalid type mixed.+11: Call to function is_string() with mixed will always evaluate to false.+11: Strict comparison using === between false and false will always evaluate to true.+15: Strict comparison using === between false and false will always evaluate to true.+15: Variable $errors in empty() always exists and is not falsy.+19: Unreachable statement - code above always terminates.
Full report
PHP 8.0 – 8.3 (1 error)
Line
Error
19
Property test::$properString (string) does not accept mixed.
PHP 7.2 – 7.4 (8 errors)
Line
Error
5
Property test::$properString is never written, only read.
7
Tip: Method test::doSomething() always throws an exception, it should have return type "never".
7
Parameter $string of method test::doSomething() has invalid type mixed.
11
Call to function is_string() with mixed will always evaluate to false.
11
Strict comparison using === between false and false will always evaluate to true.
15
Strict comparison using === between false and false will always evaluate to true.
15
Variable $errors in empty() always exists and is not falsy.
@@ @@-No errors+PHP 8.0 – 8.3+==========++No errors++PHP 7.2 – 7.4 (7 errors)+==========++ 5: Property test::$properString is never written, only read.+ 7: Tip: Method test::doSomething() always throws an exception, it should have return type "never".+ 7: Parameter $string of method test::doSomething() has invalid type mixed.+11: Call to function is_string() with mixed will always evaluate to false.+15: Strict comparison using === between false and false will always evaluate to true.+15: Variable $errors in empty() always exists and is not falsy.+19: Unreachable statement - code above always terminates.
Full report
PHP 8.0 – 8.3
No errors
PHP 7.2 – 7.4 (7 errors)
Line
Error
5
Property test::$properString is never written, only read.
7
Tip: Method test::doSomething() always throws an exception, it should have return type "never".
7
Parameter $string of method test::doSomething() has invalid type mixed.
11
Call to function is_string() with mixed will always evaluate to false.
15
Strict comparison using === between false and false will always evaluate to true.
15
Variable $errors in empty() always exists and is not falsy.
Activity
ondrejmirtes commentedon Jul 19, 2023
It's a bug, here's a workaround that works: https://phpstan.org/r/afd85807-fbc0-4874-b3cb-1d5b28ee20a4
phpstan-bot commentedon Sep 4, 2024
@hopstad After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.0 – 8.3 (1 error)
Property test::$properString (string) does not accept mixed.PHP 7.2 – 7.4 (6 errors)
Property test::$properString is never written, only read.Tip: Method test::doSomething() always throws an exception, it should have return type "never".Parameter $string of method test::doSomething() has invalid type mixed.Call to function is_string() with mixed will always evaluate to false.Variable $errors in empty() always exists and is not falsy.Unreachable statement - code above always terminates.phpstan-bot commentedon Sep 4, 2024
@ondrejmirtes After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.0 – 8.3
No errors
PHP 7.2 – 7.4 (6 errors)
Property test::$properString is never written, only read.Tip: Method test::doSomething() always throws an exception, it should have return type "never".Parameter $string of method test::doSomething() has invalid type mixed.Call to function is_string() with mixed will always evaluate to false.Variable $errors in empty() always exists and is not falsy.Unreachable statement - code above always terminates.phpstan-bot commentedon Sep 24, 2024
@hopstad After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.0 – 8.3 (1 error)
Property test::$properString (string) does not accept mixed.PHP 7.2 – 7.4 (8 errors)
Property test::$properString is never written, only read.Tip: Method test::doSomething() always throws an exception, it should have return type "never".Parameter $string of method test::doSomething() has invalid type mixed.Call to function is_string() with mixed will always evaluate to false.Strict comparison using === between false and false will always evaluate to true.Strict comparison using === between false and false will always evaluate to true.Variable $errors in empty() always exists and is not falsy.Unreachable statement - code above always terminates.phpstan-bot commentedon Sep 24, 2024
@ondrejmirtes After the latest push in 2.0.x, PHPStan now reports different result with your code snippet:
Full report
PHP 8.0 – 8.3
No errors
PHP 7.2 – 7.4 (7 errors)
Property test::$properString is never written, only read.Tip: Method test::doSomething() always throws an exception, it should have return type "never".Parameter $string of method test::doSomething() has invalid type mixed.Call to function is_string() with mixed will always evaluate to false.Strict comparison using === between false and false will always evaluate to true.Variable $errors in empty() always exists and is not falsy.Unreachable statement - code above always terminates.phpstan-bot commentedon Feb 27, 2026
Closed via merging phpstan/phpstan-src#5058
github-actions commentedon Mar 31, 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.