PedroTroller / PhpCSFixer-Custom-Fixers

A set of new fixers for PHP-CS-Fixer
77 stars 7 forks source link

LineBreakBetweenMethodArgumentsFixer and attributes #169

Closed juliangut closed 1 year ago

juliangut commented 1 year ago

I'm facing false positive on LineBreakBetweenMethodArgumentsFixer when using attributes

max-args: false
automatic-argument-merge: false
public function __construct(
-        #[ORM\Id]
-        #[ORM\Column(type: 'uuid')]
-        private readonly UuidInterface $id,
-        #[ORM\ManyToOne]
-        #[ORM\JoinColumn(nullable: false)]
-        private readonly AuthUser $authUser,
-        #[ORM\Column(length: 40, nullable: false)]
-        private readonly string $accessToken,
-        #[ORM\Column(length: 256, nullable: false)]
-        private readonly string $refreshToken,
-        #[ORM\Column(length: 255, nullable: false)]
-        private readonly string $deviceUserAgent,
-        #[ORM\Column(length: 100)]
-        private readonly string $deviceType,
-        #[ORM\Column(length: 100)]
-        private readonly string $deviceOs,
-        #[ORM\Column(length: 100)]
-        private readonly string $deviceBrowser,
+        #[ORM\Id] #[ORM\Column(type: 'uuid')] private readonly UuidInterface $id,
+        #[ORM\ManyToOne] #[ORM\JoinColumn(nullable: false)] private readonly AuthUser $authUser,
+        #[ORM\Column(length: 40, nullable: false)] private readonly string $accessToken,
+        #[ORM\Column(length: 256, nullable: false)] private readonly string $refreshToken,
+        #[ORM\Column(length: 255, nullable: false)] private readonly string $deviceUserAgent,
+        #[ORM\Column(length: 100)] private readonly string $deviceType,
+        #[ORM\Column(length: 100)] private readonly string $deviceOs,
+        #[ORM\Column(length: 100)] private readonly string $deviceBrowser,
     ) {
     }

Attributes are inlined with parameters which I do not think is the correct behavior as with promoted constructor properties it makes sense to have each one on a single line

Anyone else experiencing this? How are you handling it?

I think there should be an option to prevent inlining attributes or blindly ignore them

PedroTroller commented 1 year ago

@juliangut available with v2.30 :wink: https://github.com/PedroTroller/PhpCSFixer-Custom-Fixers#pedrotrollerline_break_between_method_arguments