Thanks to visit codestin.com
Credit goes to github.com

Skip to content

False positive: "If condition is always true" with if condition that depends on a dynamic constant #8526

@guillerodriguez

Description

@guillerodriguez

Bug report

PHPStan is reporting If condition is always true on a condition that depends on a constant, which is itself declared as a "dynamic constant" in the PHPStan config file.

Code snippet that reproduces the problem

Code snippet

phpstan config:

parameters:
  level: 5
  dynamicConstantNames:
    - ENABLE_CORS

Expected output

PHPStan should not report this warning.

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

PHPStan is great :-)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions