-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add new sniff for strict _types declaration #911
Comments
Do you add |
It is file local and must be the first directive. https://secure.php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration.strict
Feature rfc page: https://wiki.php.net/rfc/scalar_type_hints_v5 |
In mixed content file, strict type declaration must be before anything non-php(fatal error otherwise):
So, for the sniff only first directive needs to be checked, except for comments. |
Feel free to send a PR adding that sniff to |
Or leave this here as a feature request and I'll get around to it eventually. |
|
I just missed this feature yet again. Hope to get around implementing it next week. |
@gsherwood / @sebastianbergmann any progress on this issue? I think there should be a sniff for the existence of a The draft of PSR-12 (Extended Coding Style Guide) states that The question is of course if the second sniff (formatting) falls within the scope of this issue. Perhaps it is enough to start with the existence of the declaration, and add a sniff for the formatting later on. |
There has been no progress within this project and no ETA for starting. |
It looks like this is available here. |
This is resolved in #2365 which added RequireStrictTypesSniff |
That PR was not merged - but a sniff was written and released as part of PSR12 support. So you are right, this can be closed. Thanks. |
New sniff for php 7 is needed to allow to enforce
declare(strict_types=1)
The text was updated successfully, but these errors were encountered: