Skip to content

Latest commit

 

History

History
63 lines (43 loc) · 1 KB

attribute_empty_parentheses.rst

File metadata and controls

63 lines (43 loc) · 1 KB

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