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
PHP Fatal error: Uncaught TypeError: Return value of foo() must be an instance of mixed, string returned
# phpstan.neonparameters:phpVersion:70400level:9
Expected output
PHPStan should report errors like:
------ -------------------------------------------------------
Line untitled.php
------ -------------------------------------------------------
3 Function foo() has invalid return type mixed.
5 Function foo() should return mixed but returns string.
8 Function bar() has invalid return type never.
------ -------------------------------------------------------
but reports "no errors".
The problem occurs both in php 7.4 runtime and php 8.1 runtime.
The problem has a quite big impact on the CI/CD - PHPStan didn't report the problem when a developer declared return type mixed in php 7.4 code.
The text was updated successfully, but these errors were encountered:
Bug report
PHPStan reports "no errors" in the code that would not run in the required version of PHP (7.4).
The problem was detected in 1.9.17. Updating to 1.10.10 does not solve the issue.
Code snippet that reproduces the problem
Of course, this code won't run in php 7.4:
Expected output
PHPStan should report errors like:
but reports "no errors".
The problem occurs both in php 7.4 runtime and php 8.1 runtime.
The problem has a quite big impact on the CI/CD - PHPStan didn't report the problem when a developer declared return type
mixed
in php 7.4 code.The text was updated successfully, but these errors were encountered: