From 56388c57ecf097e23494442776b88277d5fa7718 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 5 Sep 2020 20:39:26 +0200 Subject: [PATCH] PHPCS 4.x | FunctionDeclarations::getParameters(): document T_USE handling `T_USE` tokens used for closure use statements are parentheses owners as of PHPCS 4.x. The `FunctionDeclarations::getParameters()` method already handles this correctly cross-version. This just adds documentation to confirm this has been looked at and no changes are needed for cross-version compatibility. Refs: * squizlabs/PHP_CodeSniffer 2593 * https://github.com/squizlabs/PHP_CodeSniffer/commit/08824f327ce5e20d7528c5e838dd7fade3dcd11c# * squizlabs/PHP_CodeSniffer 3104 --- PHPCSUtils/Utils/FunctionDeclarations.php | 1 + 1 file changed, 1 insertion(+) diff --git a/PHPCSUtils/Utils/FunctionDeclarations.php b/PHPCSUtils/Utils/FunctionDeclarations.php index 69257aec..1b123c31 100644 --- a/PHPCSUtils/Utils/FunctionDeclarations.php +++ b/PHPCSUtils/Utils/FunctionDeclarations.php @@ -436,6 +436,7 @@ public static function getParameters(File $phpcsFile, $stackPtr) } if ($tokens[$stackPtr]['code'] === \T_USE) { + // This will work PHPCS 3.x/4.x cross-version without much overhead. $opener = $phpcsFile->findNext(Tokens::$emptyTokens, ($stackPtr + 1), null, true); if ($opener === false || $tokens[$opener]['code'] !== \T_OPEN_PARENTHESIS