Skip to content

Wrong return type in ternary operator #2288

@EgorBurykin

Description

@EgorBurykin

Bug report

Stan seems can not derive correct type if ternary operator used like this:
$test->test() ? $test->test()->format('d') : null

Code snippet that reproduces the problem

https://phpstan.org/r/ff44c8c8-06ca-470a-a716-ebd334aee215

Expected output

Stan should not complain about type.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions