Fork me on GitHub
a Sensio Labs Product

7th Gear (v3.57.2) edition

Rule attribute_empty_parentheses

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



Whether attributes should be followed by parentheses or not.

Allowed types: bool

Default value: false


Example #1

Default configuration.

--- Original
+++ New

 class Sample1 {}

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

Example #2

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

--- Original
+++ New

 class Sample1 {}

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


The test class defines officially supported behaviour. Each test case is a part of our backward compatibility promise.