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
False positive: MethodSignatureMustProvideReturnType in __toString() #8557
Comments
I found these snippets: https://psalm.dev/r/687115a153<?php
class MyClass
{
/** @return string */
public function __toString()
{
return 'foo';
}
}
|
Thanks for the feedback! Unfortunately, this issue only exists on the website(and our master branch) for now but it was disabled on 4.x and soon will be disabled on master. It was causing a lot of false positives for plugin users because Psalm wrongly considers plugin stubs as part of php core. We won't fix your bug for now because we don't know when this issue will be enabled again. |
Sorry, I should've mentioned that I found this issue while testing Psalm 5. Psalm 4 is not affected as far as I can tell. |
Thank you for your answer! |
Thank you for testing Psalm 5 :) It's very helpful to get feedback! |
The error is still present in 5.0.0-rc1. Shall we reopen the issue? |
Most definitely! |
@danog do you know what happened here? We merged your PR for this issue here: #7363 But it still end up in master? Do you remember us re-adding it later? Or maybe a mishandling on my part? |
The MethodSignatureMustProvideReturnType check tells me if I need to add a native return type to a function in order to avoid a deprecation notice on PHP 8.1+.
However, it is also triggered on
__toString()
although PHP does not trigger a deprecation here.https://psalm.dev/r/687115a153
https://3v4l.org/uHsSj
The text was updated successfully, but these errors were encountered: