Skip to content

Generic.Functions.FunctionCallArgumentSpacing fails to fix foo('bar',); when PSR2.Methods.FunctionCallSignature is used #3707

@mabar

Description

@mabar

Describe the bug

Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma should not report in case comma is followed by right parenthesis because it collides with PSR2.Methods.FunctionCallSignature.SpaceBeforeCloseBracket and fails to fix the file

Code sample

foo('bar',);

Custom ruleset

<?xml version="1.0"?>
<ruleset>
  <rule ref="Generic.Functions.FunctionCallArgumentSpacing"/>
  <rule ref="PSR2.Methods.FunctionCallSignature"/>
</ruleset>

To reproduce
Steps to reproduce the behavior:

  1. Create a file called test.php with the code sample above...
  2. Run phpcs test.php ...
  3. See error message displayed
No space found after comma in argument list (Generic.Functions.FunctionCallArgumentSpacing.NoSpaceAfterComma)

Expected behavior
No error.

Versions:

  • OS: Windows 10
  • PHP: 8.1.9
  • PHPCS: 3.7.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions