Skip to content

rememberPossiblyImpureFunctionValues: false + max() = false positive #8522

@LastDragon-ru

Description

@LastDragon-ru

Bug report

You need to set rememberPossiblyImpureFunctionValues: false and phpstan will report about error. Please not that max(0, $number) works fine, but max(0, HelloWorld::getNumber()) not.

Code snippet that reproduces the problem

https://phpstan.org/r/9a0bea76-ab41-4d2e-bea0-d3bad33c3b41

Actual output

 ------ ---------------------------------------------------------------------------------------------- 
  Line   bug.php                                                                                       
 ------ ----------------------------------------------------------------------------------------------
  21     Parameter #1 $number of static method HelloWorld::sayHello() expects int<0, max>, int given.
 ------ ----------------------------------------------------------------------------------------------

Expected output

no errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions