Fork me on GitHub
a Sensio Labs Product

I ate three cookies πŸͺ (v3.40.2) edition

Rule attribute_empty_parenthesesΒΆ

PHP attributes declared without arguments must (not) be followed by empty parentheses.

ConfigurationΒΆ

use_parenthesesΒΆ

Whether attributes should be followed by parentheses or not.

Allowed types: bool

Default value: false

ExamplesΒΆ

Example #1ΒΆ

Default configuration.

--- Original
+++ New
 <?php

-#[Foo()]
+#[Foo]
 class Sample1 {}

-#[Bar(), Baz()]
+#[Bar, Baz]
 class Sample2 {}

Example #2ΒΆ

With configuration: ['use_parentheses' => true].

--- Original
+++ New
 <?php

-#[Foo]
+#[Foo()]
 class Sample1 {}

-#[Bar, Baz]
+#[Bar(), Baz()]
 class Sample2 {}

Source classΒΆ

PhpCsFixer\Fixer\AttributeNotation\AttributeEmptyParenthesesFixer