Skip to content

Using uopz Functions Causes Type Errors #12499

@maxnz

Description

@maxnz

Bug report

  • When using uopz_get_property and uopz_set_property, PHPStan expects the first argument to be a string and throws an error when an object is used
  • When using uopz_get_property, PHPStan throws an error saying that the result of that function is void and therefore should not be used

There may be other issues with uopz, these are the only ones I have come across so far

Code snippet that reproduces the problem

https://phpstan.org/r/f4c6578c-47ac-4f86-b1b8-326a99b787ed

Expected output

  • uopz_get_property and uopz_set_property allow both a string when setting a static class property and an object when setting an instance property
  • uopz_get_property should return mixed

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

As someone who first learned programming with strongly typed languages, I appreciate how PHPStan can force PHP to become a pseudo-strongishly typed language when you turn the level high enough

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions