Skip to content

Undefined Index notice on numeric strings #1843

@GameCharmer

Description

@GameCharmer

Current version of PHPStan: 0.11.1

I'm receiving the following notice multiple times during operation. It looks like the reflection is casting a numeric string to an integer then failing to test against string array keys.

PHP Notice:  Undefined index: 2819260324446 in /repo/vendor/phpstan/phpstan/src/Reflection/ClassConstantReflection.php on line 43

Code snippet that reproduces the problem

https://phpstan.org/r/53d70e4d-dce3-4d55-bad5-6a5d707f77b1

The analyzer is working as intended, but due to the notices being thrown is breaking CI. The use case is that a 3rd party API is switching from integers to strings for their IDs.

I believe this issue is related. If so, and this is unsolvable, is there any way to disable this type of check all together?

Expected output

Analysis is correct, PHP Notice for an Undefined index is being thrown though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions