From 5f8c04d9538cd9af2886d6426686546c7485d725 Mon Sep 17 00:00:00 2001 From: Dan Wallis Date: Thu, 8 Jun 2023 14:01:34 +0100 Subject: [PATCH] Remove reference to PSR-19 --- .../Sniffs/Commenting/FunctionCommentSniff.php | 7 +++---- .../Tests/Commenting/FunctionCommentUnitTest.inc | 3 +-- .../Commenting/FunctionCommentUnitTest.inc.fixed | 3 +-- .../Tests/Commenting/FunctionCommentUnitTest.php | 14 +++++++------- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php b/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php index 03fee61290..83ff655d6a 100644 --- a/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php +++ b/src/Standards/Squiz/Sniffs/Commenting/FunctionCommentSniff.php @@ -559,10 +559,9 @@ protected function processParams(File $phpcsFile, $stackPtr, $commentStart) $foundParams[(count($foundParams) - 1)] = substr($param['var'], 1); if ($realParams[$pos]['pass_by_reference'] === true) { - // When passed by reference, the variable name in $realParams does not - // have a leading '&'. There is no guidance in PSR-19 to say if the - // docblock SHOULD or SHOULD NOT also have a leading '&'. Therefore, - // this sniff remains agnostic in this case. + // Even when passed by reference, the variable name in + // $realParams does not have a leading '&'. This sniff + // will accept both '&$var' and '$var' in these cases. $paramVarName = substr($param['var'], 1); } } diff --git a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc index 8561daeb82..db0805edbd 100644 --- a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc +++ b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc @@ -1050,8 +1050,7 @@ function throwCommentOneLine() {} /** * Test for passing variables by reference * - * Note that PSR-19 makes no mention of variables passed by reference. This - * sniff treats the '&' as optional for parameters passed by reference, but + * This sniff treats the '&' as optional for parameters passed by reference, but * forbidden for parameters which are not passed by reference. * * Because mismatches may be in either direction, we cannot auto-fix these. diff --git a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed index e0e0f853b3..eb9c893bce 100644 --- a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed +++ b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.inc.fixed @@ -1050,8 +1050,7 @@ function throwCommentOneLine() {} /** * Test for passing variables by reference * - * Note that PSR-19 makes no mention of variables passed by reference. This - * sniff treats the '&' as optional for parameters passed by reference, but + * This sniff treats the '&' as optional for parameters passed by reference, but * forbidden for parameters which are not passed by reference. * * Because mismatches may be in either direction, we cannot auto-fix these. diff --git a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php index 4fbd47dd95..f69670c1fb 100644 --- a/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php +++ b/src/Standards/Squiz/Tests/Commenting/FunctionCommentUnitTest.php @@ -116,16 +116,16 @@ public function getErrorList() 1006 => 1, 1029 => 1, 1050 => 1, + 1061 => 1, 1062 => 1, - 1063 => 1, - 1072 => 4, + 1071 => 4, + 1078 => 1, 1079 => 1, 1080 => 1, 1081 => 1, - 1082 => 1, + 1101 => 1, 1102 => 1, 1103 => 1, - 1104 => 1, ]; // Scalar type hints only work from PHP 7 onwards. @@ -141,9 +141,9 @@ public function getErrorList() $errors[575] = 2; $errors[627] = 1; $errors[1002] = 1; - $errors[1067] = 5; - $errors[1086] = 8; - $errors[1108] = 3; + $errors[1066] = 5; + $errors[1085] = 8; + $errors[1107] = 3; } else { $errors[729] = 4; $errors[740] = 2;