Skip to content

Call to function is_resource() not detected to always evaluate to false after property assignment #10394

@knork-fork

Description

@knork-fork

Bug report

Phpstan is incorrectly silent in case assignment happens before is_resource() check.

Code snippet provided is simplified, I ran into this issue when trying to migrate a project from PHP 5.x to PHP 8.x because pg functions (e.g. pg_connect) now return proper objects instead of resources.

Code snippet that reproduces the problem

https://phpstan.org/r/bfb2d1b2-c94a-4cf5-b339-9331f3ba11be

Expected output

A will always evaluate to false error regardless of previous assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions