-
Notifications
You must be signed in to change notification settings - Fork 179
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
[PHPCS] Add sniff for declaration of strict_types #5342
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
The Stale label is being removed automatically because some activity has occurred or because the developers have decided that this pull request is important and should not continue to be overlooked. |
Blocked by #5396 which adds the Slevomat dependency and also handles many typing issue that will make the strict types sniff much more feasible to implement. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Previous attempts to force type hints or strict typing en masse have failed because it's just too darn complicated to do it all at once. This introduces a new Strict Type coding standard that we can selectively apply to files by adding to an array in test/run-php-linter.sh. Hopefully this will provide an approach to using stricter typing that is easier to author and review. Using vendor/bin/phpcbf --standard=test/StrictTypesCS.xml $file will now allow PHPCBF to automatically provide return types param types strict_types =1 based on PHPDocs. It will also throw errors if Traversable types do not have specific type annotations. The Database.class.inc file has been modified as an example of the changes Resolves #5342
Previous attempts to force type hints or strict typing en masse have failed because it's just too darn complicated to do it all at once. This introduces a new Strict Type coding standard that we can selectively apply to files by adding to an array in test/run-php-linter.sh. Hopefully this will provide an approach to using stricter typing that is easier to author and review. Using vendor/bin/phpcbf --standard=test/StrictTypesCS.xml $file will now allow PHPCBF to automatically provide return types param types strict_types =1 based on PHPDocs. It will also throw errors if Traversable types do not have specific type annotations. The Database.class.inc file has been modified as an example of the changes Resolves aces#5342
https://github.com/slevomat/coding-standard/#slevomatcodingstandardtypehintsdeclarestricttypes-
This depends on adding the Slevomat coding standard as a developer dependency. This has been proposed already in #4064
PHPCS >= 3.0 is required so this isn't possible until #5349 is merged
The text was updated successfully, but these errors were encountered: