coding-standard
coding-standard copied to clipboard
Incorrect NoSpaceBeforeNullabilitySymbol for typed properties preceded by static return type
The following class generates SlevomatCodingStandard.Classes.PropertyDeclaration.NoSpaceBeforeNullabilitySymbol for array.
abstract class Test
{
abstract public function begin(): static;
protected array $field = [];
}
The issue does not appear when the return type is self.
I'm running v8.15.0.
Just found that this case also generates SlevomatCodingStandard.Classes.PropertyDeclaration.MultipleSpacesBeforeTypeHint for the static return type.
class Test
{
public static function begin(): static
{
return new static();
}
/** @var array<string,mixed> */
protected array $field = [];
final private function __construct()
{
}
}
Thank you for your report.
Fixed in https://github.com/slevomat/coding-standard/commit/372cbf249282e70ac7a52e46bc914fe0991325b5