New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Template type not supporting string|null although it works fine #5305
Comments
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
- 7: Parameter #1 $foo of method HelloWorld::strict() expects string, null given.
-19: PHPDoc tag @template T for method HelloWorld::normalize() with bound type null is not supported.
+-1: Internal error: PHPStan\Rules\Methods\WrongCaseOfInheritedMethodRule::findMethod(): Argument #2 ($classReflection) must be of type PHPStan\Reflection\ClassReflection, null given, called in /var/task/vendor/phpstan/phpstan-strict-rules/src/Rules/Methods/WrongCaseOfInheritedMethodRule.php on line 40
+Run PHPStan with --debug option and post the stack trace to:
+https://github.com/phpstan/phpstan/issues/new?template=Bug_report.md Full report
|
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
- 7: Parameter #1 $foo of method HelloWorld::strict() expects string, null given.
+19: Method HelloWorld::normalize() should return T of string|null but return statement is missing.
19: PHPDoc tag @template T for method HelloWorld::normalize() with bound type null is not supported. Full report
|
@janedbal After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
- 7: Parameter #1 $foo of method HelloWorld::strict() expects string, null given.
-19: PHPDoc tag @template T for method HelloWorld::normalize() with bound type null is not supported.
+ 7: Parameter #1 $foo of method HelloWorld::strict() expects string, null given. Full report
|
Fixed: phpstan/phpstan-src@1d8b2eb |
@ondrejmirtes Is it? It looks like passing |
|
@ondrejmirtes Oh, you're right. I misread the code snippet. 👍 |
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. |
Bug report
Getting
PHPDoc tag @template T for method HelloWorld::normalize() with bound type null is not supported.
in following snippet, but the functionality seems working, is that just invalid error?Code snippet that reproduces the problem
https://phpstan.org/r/04528bd4-6738-4b6e-b9f3-4756ce08c3f7
Expected output
No error on line 19
The text was updated successfully, but these errors were encountered: