Skip to content

PHPDoc-based type narrowing (@phpstan-assert) is not considered via Impossible* checks #8169

@herndlm

Description

@herndlm

Feature request

A couple of days ago I was looking into removing many of the webmozart/assert expressions in favor of PHPStan interpreting the original @psalm-assert annotations. Support for that was added in phpstan/phpstan-src#1317. This was working quite well in general, but I noticed one thing: always evaluating to true/false things were not reported.

A quick and simple snippet that shows this: https://phpstan.org/r/23012ee0-8ea1-4b05-a6dc-d133b07ec781

I guessed this was just missing, or is this on purpose?
Update: on the other hand: these annotations are different, right? Asserting that something is a string does not necessarily mean that the method ia doing only is_string I guess :/

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions