-
-
Notifications
You must be signed in to change notification settings - Fork 521
WP/EnqueuedResourceParameters: fix handling of non-lowercased null
and fully qualified \null
and \false
#2630
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
base: develop
Are you sure you want to change the base?
Conversation
This commit fixes how the sniff handles non-lowercased `null` when passed as the value of the `$ver` parameter. Now the sniff consistently handles `null` regardless of the case and always returns a warning. Before, it would return a warning only for lower-cased `null` and an error for all other variations of `null`.
Why ? This feels to me like you are doubling the work for reviewers. Unless the changes are huge (which I don't expect them to be), it could/should just be a separate commit in this PR. |
null
null
and fully qualified \null
and \false
I opted to separate precisely because I thought it would make the work for reviewers easier. The changes are indeed not huge and are related, but slightly different. I thought they were different enough to justify a separate PR. Since you prefer to review them together, I added another commit to this PR with the fix for handling fully qualified My fix for handling fully qualified |
Totally and this change/fix is a good reason to justify the dependency bump. |
b43f8b9
to
a3cff7f
Compare
This is necessary to benefit from the new way to tokenize fully qualified `\false` and `\null` introduced in 3.13.3 (PHPCSStandards/PHP_CodeSniffer 1206). It will simplify a fix for how `WordPress.WP.EnqueuedResourceParameters` handles fully qualified `\false` and `\null` (see 2630). Bumping the version to 3.13.4 instead of 3.13.3 as 3.13.4 contains a fix to a bug that affected 3.13.3 that prevents WPCS sniffs tests from executing (PHPCSStandards/PHP_CodeSniffer 1213).
…null` correctly Before this change passing `\false` or `\null` as the `$ver` parameter would result in a false negative.
a3cff7f
to
0b1af1e
Compare
Ok, I added a new commit to this PR bumping the minimum required PHPCS version to 3.13.4. Let me know if you prefer that this change is introduced in a separate PR and I will do that. We need to bump to 3.13.4 instead of 3.13.3 due to the bug introduced in 3.13.3 and fixed in 3.13.4 that prevents the execution of sniff tests in external standards. |
Description
This PR fixes how the sniff handles non-lowercased
null
when passed as the value of the$ver
parameter. Now the sniff consistently handlesnull
regardless of the case and always returns a warning. Before, it would return a warning only for lower-casednull
and an error for all other variations ofnull
.It also fixes how the sniff handles fully qualified
\false
and\null
. Before this PR, passing\false
or\null
as the$ver
parameter would result in a false negative. Now it correctly results in a warning for\null
and an error for\false
. For this fix, it was necessary to raise the minimum supported PHPCS version to 3.13.4 to benefit from a related change in how PHPCS tokenizes\false
and\null
.Besides that, the PR includes a separate commit that fixes some mistakes in the code comments of this sniff.
Suggested changelog entry
Changed:
PHP_CodeSniffer
version to 3.13.4 (was 3.13.0).Fixed:
WordPress.WP.EnqueuedResourceParameters
: correctly handles non-lowercasenull
when passed as the$ver
parameter value.WordPress.WP.EnqueuedResourceParameters
: now correctly handles fully qualified\null
and\false
values in the$ver
parameter.