-
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
PEAR/FunctionCallSignature: minor tweaks + extra test #3667
PEAR/FunctionCallSignature: minor tweaks + extra test #3667
Conversation
Note: the test failure on PHP 8.2 is unrelated to this PR and also happening on Also note that this PR will conflict (on the tests) with PR #3636. I will rebase and fix the conflict depending on which PR gets merged first. |
This is related to the PHP 8.2 disjunctive normal types feature which changed the tokenization - see: php/php-src#9512 This needs to be fixed when support for DNF is added to the PHPCS tokenizer. |
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.
Tested the fix for the original WPCS report, and all seems well. ✅
Found myself here while looking into the failure. This looks to caused by tokenization of function calls changing when the name is $var = readonly() So where the string |
The change in PHP was intentional to support disjunctive normal types for readonly properties, see the issue I linked above. class Dnf {
private readonly (B&C)|A $d;
} |
(and yeah, DNT is not going to be fun to sort out in the tokenizer.... I have a feeling we'll probably need to add |
Minor defensive coding and documentation improvements + an additional unit test.
b5aaa31
to
a63f040
Compare
Closing as replaced by PHPCSStandards/PHP_CodeSniffer#134 |
Originally reported in WordPress/WordPress-Coding-Standards#2083
The fixer for the
OpeningIndent
error for multi-line function calls could inadvertently remove a PHP close tag (or other inline HTML content) on the previous line if the first non-whitespace token on a line wasT_INLINE_HTML
. In the case of a PHP close tag, this would cause a parse error in the file.This parse error would then result in the file being incorrectly tokenized for the second fixer loop, with the
<?php
after the inline HTML being tokenized as below, which causes problems with other sniffs:Fixed now.
Includes unit test.
Includes minor defensive coding fix (
$first !== false
) on line 345 and adding of an inline comment to clarify the code within the fixer.