
return_type_declaration
¶Adjust spacing around colon in return type declarations and backed enum types.
Rule is applied only in a PHP 7+ environment.
Default configuration.
--- Original
+++ New
<?php
-function foo(int $a):string {};
+function foo(int $a): string {};
With configuration: ['space_before' => 'none']
.
--- Original
+++ New
<?php
-function foo(int $a):string {};
+function foo(int $a): string {};
With configuration: ['space_before' => 'one']
.
--- Original
+++ New
<?php
-function foo(int $a):string {};
+function foo(int $a) : string {};
The rule is part of the following rule sets:
Using the @PER rule set will enable the return_type_declaration
rule with the default config.
Using the @PSR12 rule set will enable the return_type_declaration
rule with the default config.
Using the @PhpCsFixer rule set will enable the return_type_declaration
rule with the default config.
Using the @Symfony rule set will enable the return_type_declaration
rule with the default config.