Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect NoSpaceBeforeNullabilitySymbol for typed properties preceded by static return type #1703

Open
stefanfisk opened this issue Oct 16, 2024 · 1 comment

Comments

@stefanfisk
Copy link

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.

@stefanfisk
Copy link
Author

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()
    {
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant