Skip to content

Side effects of assertType #8361

@rajyan

Description

@rajyan

Bug report

The assertType has a side effect and resets the type of $from ?? $to.
The first $from ?? $to resets the type of second $from ?? $to.

Code snippet that reproduces the problem

https://phpstan.org/r/0f02aeb3-9e32-40a1-b520-63cf0ee47764

Expected output

There are two thing I want solve

  • Don't want assertType to have any side effects
  • The first call should not invalidate the type of second call

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

I love PHPStan and believe in the power it gives when writing codes in PHP.

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