Fork me on GitHub
a Sensio Labs Product

Remote Void (v2.18.1) edition

Rule no_unneeded_curly_braces

Removes unneeded curly braces that are superfluous and aren’t part of a control structure’s body.

Configuration

namespaces

Remove unneeded curly braces from bracketed namespaces.

Allowed types: bool

Default value: false

Examples

Example #1

Default configuration.

--- Original
+++ New
@@ -1,9 +1,9 @@
-<?php {
+<?php
     echo 1;
-}

+
 switch ($b) {
-    case 1: {
+    case 1:
         break;
-    }
+
 }

Example #2

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

--- Original
+++ New
@@ -1,4 +1,4 @@
 <?php
-namespace Foo {
+namespace Foo;
     function Bar(){}
-}
+

Rule sets

The rule is part of the following rule sets:

@PhpCsFixer

Using the @PhpCsFixer rule set will enable the no_unneeded_curly_braces rule with the config below:

['namespaces' => true]

@Symfony

Using the @Symfony rule set will enable the no_unneeded_curly_braces rule with the config below:

['namespaces' => true]

The logo is © 2010-2014 Sensio Labs