doctrine / common

Doctrine Common
https://www.doctrine-project.org/projects/common.html
MIT License
5.78k stars 294 forks source link

fix: do not cast BackedEnum identifiers to int #1000

Open Gwemox opened 1 year ago

Gwemox commented 1 year ago

Another way to solve https://github.com/doctrine/common/pull/997 Thank's to @malarzm for the test (https://github.com/doctrine/common/pull/998)

The applied solution: only cast to int if return value is not a instance of BackedEnum. Another solution would be to check the return value is numeric (is_numeric) but if it is null it will change the behavior (null instead of 0)