Skip to content

$message from core Exception cannot have type assigned #11761

@kevinpapst

Description

@kevinpapst

Bug report

class ApiLimitExceededException extends \Exception
{
    protected $message = 'You have exceeded the 300 API calls per minute.';
}

leads to

Property ApiLimitExceededException::$message has no type specified.

Adding a PHPDoc /** @var string */ leads to

PHPDoc type string of property ApiLimitExceededException::$message is not the same as PHPDoc type mixed of overridden property Exception::$message.

Code snippet that reproduces the problem

https://phpstan.org/r/43e108f0-2a99-41e0-b95e-366132e294f2

Expected output

Currently this can only be silenced with ignoreErrors ('#^Property App\\HttpClient\\Exception\\(.*)\:\:\$message has no type specified.$#')

I'd expect that PHPStan knows that $message from Exception cannot have a type assigned

Did PHPStan help you today? Did it make you happy in any way?

❤️

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions