
type_declaration_spaces
¶Ensure single space between a variable and its type declaration in function arguments and properties.
elements
¶Structural elements where the spacing after the type declaration should be fixed.
Allowed values: a subset of ['function', 'property']
Default value: ['function', 'property']
Default configuration.
--- Original
+++ New
<?php
class Bar
{
- private string $a;
- private bool $b;
+ private string $a;
+ private bool $b;
- public function __invoke(array $c) {}
+ public function __invoke(array $c) {}
}
With configuration: ['elements' => ['function']]
.
--- Original
+++ New
<?php
class Foo
{
public int $bar;
- public function baz(string $a)
+ public function baz(string $a)
{
- return fn(bool $c): string => (string) $c;
+ return fn(bool $c): string => (string) $c;
}
}
With configuration: ['elements' => ['property']]
.
--- Original
+++ New
<?php
class Foo
{
- public int $bar;
+ public int $bar;
public function baz(string $a) {}
}