-
Notifications
You must be signed in to change notification settings - Fork 1.5k
integer type hints appearing as TypeHintMissing instead of ScalarTypeHintMissing #1394
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
Comments
integer
type hints appearing as TypeHintMissing
instead of ScalarTypeHintMissing
2.8.0 didn't generate any type hint missing errors for that code. So it wasn't that it was a different code - it didn't generate any codes. 2.8.1 did fix this, but the code you get (scalar or not) seems to depend on if you used |
I've pushed up a fix for this inconsistency when using PHP7+. The sniff was expecting you to write The PHP7 check is now done even if the first check fails to find the value in the whitelist. The result is that I think this fixes your specific issue. But please let me know if I've misunderstood and there is another issues as well. |
This fixes my issue, thanks! |
Although running through the tests with 5.6 it will still complain about this (I guess because it is actually expecting |
…P5, and with the wrong hint text (integer vs int)
@h-bragg Thanks for that extra report. The unit tests had this behaviour coded into them, but it doesn't make sense to show scalar type hints for PHP5. It's left-over code from before the sniff supported the php_version config var, and has now been fixed. |
@gsherwood This is now working in 5.6, 7.0, 7.1 and hhvm 👍 Thanks for the excellent responses and speedy fixes! 👏 |
Uh oh!
There was an error while loading. Please reload this page.
Since upgrading to 2.8.1 integer types on method arguments have been throwing
TypeHintMissing
instead ofScalarTypeHintMissing
.Config:
Code:
2.8.0:
2.8.1:
The text was updated successfully, but these errors were encountered: