From d8924e387cac8a543520c8e9dc858aa310615feb Mon Sep 17 00:00:00 2001 From: jrfnl Date: Fri, 10 Jan 2025 11:03:53 +0100 Subject: [PATCH] Squiz/FunctionDeclarationArgumentSpacing: minor simplification No need to recreate the type hint when it's already available in the return value of the `getMethodParameters()` method. --- .../Functions/FunctionDeclarationArgumentSpacingSniff.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php b/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php index 6758cf9395..2621a43615 100644 --- a/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php +++ b/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php @@ -396,10 +396,7 @@ public function processBracket($phpcsFile, $openBracket) } }//end if } else { - $hint = $phpcsFile->getTokensAsString($param['type_hint_token'], (($param['type_hint_end_token'] - $param['type_hint_token']) + 1)); - if ($param['nullable_type'] === true) { - $hint = '?'.$hint; - } + $hint = $param['type_hint']; if ($tokens[($commaToken + 1)]['code'] !== T_WHITESPACE) { $error = 'Expected 1 space between comma and type hint "%s"; 0 found';