From ef5b91dc0bb82538e994c87e12d2d9fa17f41ea7 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Wed, 19 Feb 2025 10:38:43 +0100 Subject: [PATCH 1/2] Generic/DisallowShortOpenTag: prevent fixer conflict The original fixer conflict which inspired this fix can be reproduced via: ```bash phpcbf -ps ./src/Standards/Squiz/Tests/PHP/EmbeddedPhpUnitTest.19.inc --report=full,source --suffix=.fixed --standard=Squiz ``` What it basically comes down to is that this sniff would replace the `findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true)]; - $error = 'Short PHP opening tag used with echo; expected "addFixableError($error, $stackPtr, 'EchoFound', $data); - if ($fix === true) { - if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) { - $phpcsFile->fixer->replaceToken($stackPtr, 'fixer->replaceToken($stackPtr, 'addFixableError($error, $stackPtr, 'EchoFound', $data); + if ($fix === true) { + if ($tokens[($stackPtr + 1)]['code'] !== T_WHITESPACE) { + $phpcsFile->fixer->replaceToken($stackPtr, 'fixer->replaceToken($stackPtr, ' From 005f934b6b697136861cc542e52a0faa1fffe058 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Mon, 24 Feb 2025 15:25:17 +0100 Subject: [PATCH 2/2] Generic/DisallowShortOpenTag: fix grammatical error in test --- .../Generic/Tests/PHP/DisallowShortOpenTagUnitTest.5.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.5.inc b/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.5.inc index d4b3edc018..57e645bb25 100644 --- a/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.5.inc +++ b/src/Standards/Generic/Tests/PHP/DisallowShortOpenTagUnitTest.5.inc @@ -1,4 +1,4 @@ // Intentional parse error. This should be the only test in this file. -// Making sure that the sniff does not act on this particular parse error (to not things worse). +// Making sure that the sniff does not act on this particular parse error (to not make things worse).