False positive for named parameter alignment in PHP

Regarding the formatting rule for PHP (php:S1808):
"Align all arguments in this list at column “xx”.

When you’re using named parameters in PHP this will complain about argument misalignment when the named parameter is actually aligned on the correct column. I hope this can be either configured or allowed in the future, because we use these everywhere.
As a side note, we’d love to see a rule to say that you should always be using named parameters when a function has more than X arguments.

// Triggers the code smell
    parameterA: $arg1,
    parameterB: $arg2,

// Does not trigger the code smell

// The "fix"


Welcome to the community and thanks for this report!

Are you analyzing with SonarCloud? If not, which version of SonarQube (or SonarLint?) are you using?


I’m using SonarCloud, also using SonarLint 7.1.1 in PHPStorm.
Also using the GitHub Action (SonarSource/sonarcloud-github-action@master) with no significant config apart from source and coverage report locations.

1 Like

Hi @faylite,

Thank you for your report. Indeed, this is a false positive, and we should not raise an issue. It seems that we are not correctly handling named arguments. I’ve created a ticket to fix this. Thanks for the contribution.