Skip to content

line_break_between_method_arguments should count from beginning of line, including whitespaces #207

@ostrolucky

Description

@ostrolucky

I thought this fixer is great fit in combination with PSR-2's recommended 120 line length limit.

However, it looks like line_break_between_method_arguments is trimming the line from whitespaces and only then starts to calculate if content is longer than max-length.

This makes behavior quite non-compatible and non-predictable, because max-length is depending on indentation of current line. If I set it to 120 lines with intention to stick with PSR-2 limit, this will not work for intended code like so

     public function __construct(
         #[Assert\NotBlank(message: 'not_blank')]
         private string|UuidInterface $userFileImportId,
-        #[Assert\Choice(
-            callback: ['Eqsgroup\Entity\UserImport', 'getDuplicateResolutionStrategies'],
-            message: 'invalid_strategy',
-        )]
+        #[Assert\Choice(callback: ['Eqsgroup\Entity\UserImport', 'getDuplicateResolutionStrategies'], message: 'invalid_strategy', )]
         private string $strategy,
     ) {}

^ fixer changes above because even though code after fixing is longer than 120 lines, without whitespaces it's not

Attributes can be nested infinite times, which will push the limit towards PSR's 120 line length limit, but max-length option does not care about that

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions