Fork me on GitHub
a Sensio Labs Product

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

Rule cast_spacesΒΆ

A single space or none should be between cast and variable.

ConfigurationΒΆ

spaceΒΆ

Spacing to apply between cast and variable.

Allowed values: 'none' and 'single'

Default value: 'single'

ExamplesΒΆ

Example #1ΒΆ

Default configuration.

--- Original
+++ New
 <?php
-$bar = ( string )  $a;
-$foo = (int)$b;
+$bar = (string) $a;
+$foo = (int) $b;

Example #2ΒΆ

With configuration: ['space' => 'single'].

--- Original
+++ New
 <?php
-$bar = ( string )  $a;
-$foo = (int)$b;
+$bar = (string) $a;
+$foo = (int) $b;

Example #3ΒΆ

With configuration: ['space' => 'none'].

--- Original
+++ New
 <?php
-$bar = ( string )  $a;
-$foo = (int) $b;
+$bar = (string)$a;
+$foo = (int)$b;

Rule setsΒΆ

The rule is part of the following rule sets:

Source classΒΆ

PhpCsFixer\Fixer\CastNotation\CastSpacesFixer