Closed marc-mabe closed 9 years ago
Current branch EnumSet_BitSet
I will take a look at the weekend.
As for the real EnumSet based on BitSet... go for it! Let's drop the EnumList implementation, or do you have a need for it?
Sorry for the late reply ;)
do You have any ETA for this feature?
@prgTW The feature is nearly ready. You can test it already https://github.com/marc-mabe/php-enum/blob/EnumSet_BitSet/src/MabeEnum/EnumSet.php. The only think missing is a check for 32 vs 64 bit platforms and throw an exception if the enum class has more enumerations defined.
I also tested it against GMP
to support an unlimited number of enumeration definitions but it doesn't work and it's currently much slower - https://github.com/marc-mabe/php-enum/blob/EnumSet_BitSet/src/MabeEnum/EnumSet2.php
@marc-mabe
if You want to use GMP
make ext-gmp
required in composer.json
.
32/64 bit check:
32bit: 4 === PHP_INT_SIZE
64bit: 8 === PHP_INT_SIZE
Current implementation of
EnumSet
is a list ofEnum
instances but a realEnumSet
should be based on aBitSet
.Because current implementation is a list and contains flags that only makes sense for a list fix this requires a bc break -> so mark it for
2.0.0
Question: Should the current list live as
EnumList
or should it be dropped completely because a list can simply be implemented by itself and makes sense only for explicit enumerations?@prolic ping