-
Notifications
You must be signed in to change notification settings - Fork 2k
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
ETK: make PHP linting PHP 8 compatible #71062
Conversation
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
Prevent errors caused by WordPress Coding Standards not supporting PHP 8.0+. | ||
See https://github.com/WordPress/WordPress-Coding-Standards/issues/2035 | ||
--> | ||
<ini name="error_reporting" value="E_ALL & ~E_DEPRECATED" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noting this will disable all deprecated syntax and not just the syntax that was deprecated in PHP 8. Is that intentional? If yes, then we might want to be explicit about it in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Open to ideas how to limit this just to specific errors or even just when running in PHP, but keep runtime errors for other versions, or even just for CI runs.
I'll update the comment tho!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there's a better way to do it TBH. I'm fine with this temporary approach, as long as we're explicit about it in the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check the new one out, 3980d3a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you 🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go once comment is updated 🚀
It was taken from Automattic/wp-calypso#71062
Proposed Changes
phpcs.xml
suppressing PHP run-time notices (E_DEPRECATED
) which allows running the linter with PHP8.The issue is fixed in
WordPress-Coding-Standards
develop branch but hasn't been released yet. Their latest release 2.3.0 is from May 2020. The slution was suggested in a comment WordPress/WordPress-Coding-Standards#2035 (comment)Testing Instructions
apps/editing-toolkit
yarn lint:php
Before the change, you see errors like:
After the change you see only regular linting errors/warnings.
Pre-merge Checklist
Related to #