From a80fde9e54b49e50c0fa0e31e9a827d39819db4b Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 2 Apr 2025 14:46:51 -0300 Subject: [PATCH 1/3] Generic/FunctionCallArgumentSpacing: update XML doc to remove info about spacing around equal sign The FunctionCallArgumentSpacing sniff used to check for spacing around the equal sign in the arguments of a function declaration. But this was removed in https://github.com/squizlabs/PHP_CodeSniffer/pull/2399 (commit feeda473f045825c1caa213c3b7ab6dc6a99b746). This commit updates the sniff XML doc to reflect this change. --- .../FunctionCallArgumentSpacingStandard.xml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml b/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml index 9809844d8d..9a9905d927 100644 --- a/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml +++ b/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml @@ -1,7 +1,7 @@ @@ -16,22 +16,6 @@ function foo($bar, $baz) $baz) { -} - ]]> - - - - - = true) -{ -} - ]]> - - - =true) -{ } ]]> From 7a47e829340be0ead13593b76adb5a4041cbf147 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 2 Apr 2025 14:59:17 -0300 Subject: [PATCH 2/3] Generic/FunctionCallArgumentSpacing: fix code examples in the XML doc The code examples in the XML documentation of this sniff were incorrect as the sniff does not check spacing in function argument definitions. It only checks spacing in function and method calls. As far as I could check this has always been the case, or at least it has been the case for a long time. Since tests were added for this sniff when it was part of the PEAR standard and called MethodCallArgumentSpacing, it ignored function definitions and checked only function calls: https://github.com/squizlabs/PHP_CodeSniffer/commit/7b84951474ff24d394eb71e42ad79db99cf776bb#diff-56e2f69852c3071fbf86d20fbb49f38dae17cff8731154d8b1b7495c4ad8eeb0R24-R27 Here is the sniff code where it ignores function definitions: https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/57a9ed734e2ab06c062fe0e463745eab483cf722/src/Standards/Generic/Sniffs/Functions/FunctionCallArgumentSpacingSniff.php#L55-L66 --- .../Functions/FunctionCallArgumentSpacingStandard.xml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml b/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml index 9a9905d927..4edd3be59c 100644 --- a/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml +++ b/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml @@ -7,16 +7,12 @@ $baz) -{ -} +foo($bar, $baz); ]]> $baz) -{ -} +foo($bar,$baz); ]]> From 02ff468980c5db6d91dc9b9974d19485403ed983 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 2 Apr 2025 15:09:13 -0300 Subject: [PATCH 3/3] Generic/FunctionCallArgumentSpacing: improve XML documentation - `` title now matches the sniff name - Mention in the description that the sniff is about function and method calls. - `` and `` descriptions now mention that the sniff also checks for spaces before the comma. --- .../Functions/FunctionCallArgumentSpacingStandard.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml b/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml index 4edd3be59c..a133451993 100644 --- a/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml +++ b/src/Standards/Generic/Docs/Functions/FunctionCallArgumentSpacingStandard.xml @@ -1,18 +1,18 @@ - + - + $baz); ]]> - + $baz); +foo($bar ,$baz); ]]>