Releases: marc-mabe/php-enum
v3.0.0
New Major Version
We have worked a lot to make this library even more useful and also optimized the performance a lot!
To be able to do so we introduced a couple of BC breaks (please read the changes carefully) but we tried to keep them as small as possible.
Changes
- #94 optimized
Enum::detectConstants()
using assertion to check for ambiguous enumerator values- this method is called once on initialize an enumeration
- #68 removed deprecated methods
- #69 bumped up PHP version to >=5.6
- new language features helps us to better maintain this library and provides better optimized code
- we decided to bump up the supported PHP version as PHP-5.3 is outdated for a long time now
- we decided to still keep PHP-5.6 (even if outdated as well) as this library is still compatible with HHVM. This way HHVM users can use this new version and have more time to migrate
- #87 added phpbench suite
- #73 EnumSet::setBinaryBitset*(): now throws an exception on out-of-range bits set
- #86 refactored EnumSet to be auto based on integer or binary bitset dependent on enumeration size
- Methods changed:
union()
,intersect()
,diff()
andsymDiff()
support one argument of$others
only
- Methods added:
public function getBit(int $ordinal) : bool
public function setBit(int $ordinal, bool $bit) : void
- Methods changed:
- #70 removed iterator flags for EnumMap
- the key will be the enumerator object and the value the assigned data
- #90 #91 #92 Refactor EnumMap
- if data are serializable the
EnumMap
is serializable, too - no longer based on
SplObjectStorage
- no longer implement
Serializable
- still implements
ArrayAccess
,Countable
andIterator
- new implements
SeekableIterator
- Methods removed:
public function attach($enumerator) : void
- please use
public function offsetSet($enumerator) : void
- or direct array access
$map[$enum] = $value
- please use
public function detach($enumerator): void
- please use
public function offsetUnset($enumerator) : void
- or direct array access
unset($map[$enum])
- please use
public addAll(SplObjectStorage $storage) : void
public getHash(object $object) : string
public removeAll(SplObjectStorage $storage) : void
public removeAllExcept(SplObjectStorage $storage) : void
public serialize(void) : string
public setInfo(mixed $data) : void
public unserialize(string $serialized) : void
- Methods changed:
public contains($enumerator) : bool
- same as
public offsetExists($enumerator) : bool
but returns true onNULL
values
- same as
- Methods added:
public function seek(int $pos) : void
public function getKeys() : Enum[]
public function getValues() : mixed[]
public function search($enumerator, bool $strict) : Enum|null
- if data are serializable the
https://github.com/marc-mabe/php-enum/issues?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A3.0.0
v3.0.0-rc3
Third Release Candidate of new major version
Changes
- #94 optimized
Enum::detectConstants()
using assertion to check for ambiguous enumerator values- this method is called once on initialize an enumeration
BC-breaks:
v3.0.0-rc2
Second Release Candidate of new major version
Changes
- optimized
EnumSet::count()
up to 40%
BC-breaks:
- none
v3.0.0-rc1
First Release Candidate of new major version
We have worked a lot to make this library even more useful and also optimized the performance a lot!
To be able to do so we introduced a couple of BC breaks (please read the changes carefully) but we tried to keep them as small as possible.
Changes
- #68 remove deprecated methods
- #69 bumped up PHP version to >=5.6
- new language features helps us to better maintain this library and provides better optimized code
- we decided to bump up the supported PHP version as PHP-5.3 is outdated for a long time now
- we decided to still keep PHP-5.6 (even if outdated as well) as this library is still compatible with HHVM. This way HHVM users can use this new version and have more time to migrate
- #87 added phpbench suite
- #73 EnumSet::setBinaryBitset*(): now throws an exception on out-of-range bits set
- #86 refactored EnumSet to be auto based on integer or binary bitset dependent on enumeration size
- Methods changed:
union()
,intersect()
,diff()
andsymDiff()
support one argument of$others
only
- Methods added:
public function getBit(int $ordinal) : bool
public function setBit(int $ordinal, bool $bit) : void
- Methods changed:
- #70 removed iterator flags for EnumMap
- the key will be the enumerator object and the value the assigned data
- #90 #91 #92 Refactor EnumMap
- if data are serializable the
EnumMap
is serializable, too - no longer based on
SplObjectStorage
- no longer implement
Serializable
- still implements
ArrayAccess
,Countable
andIterator
- new implements
SeekableIterator
- Methods removed:
public function attach($enumerator) : void
- please use
public function offsetSet($enumerator) : void
- or direct array access
$map[$enum] = $value
- please use
public function detach($enumerator): void
- please use
public function offsetUnset($enumerator) : void
- or direct array access
unset($map[$enum])
- please use
public addAll(SplObjectStorage $storage) : void
public getHash(object $object) : string
public removeAll(SplObjectStorage $storage) : void
public removeAllExcept(SplObjectStorage $storage) : void
public serialize(void) : string
public setInfo(mixed $data) : void
public unserialize(string $serialized) : void
- Methods changed:
public contains($enumerator) : bool
- same as
public offsetExists($enumerator) : bool
but returns true onNULL
values
- same as
- Methods added:
public function seek(int $pos) : void
public function getKeys() : Enum[]
public function getValues() : mixed[]
public function search($enumerator, bool $strict) : Enum|null
- if data are serializable the
https://github.com/marc-mabe/php-enum/issues?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A3.0.0
v2.3.1
Bugfix release
Changes:
#82 EnumSet::setBinaryBitset*(): fixed logic of 'truncate out-of-range bits of last byte'
BC-breaks:
none
https://github.com/marc-mabe/php-enum/pulls?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A2.3.1
v2.3.0
Feature release of the 2.x branch.
(No changes since 2.3.0-rc1)
New:
- #63: EnumSet: support for Little- and Big-Endian binary bitsets
- Added EnumSet::getBinaryBitsetLe() : string
- Added EnumSet::setBinaryBitsetLe(string $bitset)
- Added EnumSet::getBinaryBitsetBe() : string
- Added EnumSet::setBinaryBitsetBe(string $bitset)
- #64: EnumSet: added isEqual(), isSubset() and isSuperset()
- Added EnumSet::isEqual(EnumSet $other) : bool
- Added EnumSet::isSubset(EnumSet $other) : bool
- Added EnumSet::isSuperset(EnumSet $other) : bool
- #66: EnumSet: added methods union(), intersect(), diff() and symDiff()
- Added EnumSet::union(EnumSet ...$others) : EnumSet
- Added EnumSet::intersect(EnumSet ...$others) : EnumSet
- Added EnumSet::diff(EnumSet ...$others) : EnumSet
- Added EnumSet::symDiff(EnumSet ...$others) : EnumSet
- #65: EnumSet: added getEnumerators(), getNames() and getValues()
- Added EnumSet::getEnumerators() : Enum[]
- Added EnumSet::getValues() : mixed[]
- Added EnumSet::getNames() : string[]
- #78: Added static Enum::getValues(), Enum::getNames() and Enum::getOrdinals()
- Added Enum::getValues() : mixed[]
- Added Enum::getNames() : string[]
- Added Enum::getOrdinals() : int[]
- #80: refactored Enum::getBy* to Enum::by*
- Renamed Enum::getByName() -> Enum::byName()
- Renamed Enum::getByOrdinal() -> Enum::byOrdinal()
- Added Enum::byValue()
- #59: handle class constant visibility added in PHP-7.1
- #67: optimized EnumSet::count() by 30% to 240%
- #75: optimized EnumSet by using EnumSet properties directly instead of getter methods
##Fixed:
- #71: EnumSet::setBinaryBitset*(): out-of-range bits of last byte not truncated
- #77: Missing additional check on Enum::is() to return TRUE in some circumstances
Deprecations:
- #63 :
EnumSet::getBitset() : string - #63:
EnumSet::setBitset(string $bitset) - #79:
Enum::clear() - #80:
Enum::getByName() - #80:
Enum::getByOrdinal()
BC-breaks:
- none
v2.3.0-rc1
First Release Candidate of 2.3.0.
New:
- #63: EnumSet: support for Little- and Big-Endian binary bitsets
- Added EnumSet::getBinaryBitsetLe() : string
- Added EnumSet::setBinaryBitsetLe(string $bitset)
- Added EnumSet::getBinaryBitsetBe() : string
- Added EnumSet::setBinaryBitsetBe(string $bitset)
- #64: EnumSet: added isEqual(), isSubset() and isSuperset()
- Added EnumSet::isEqual(EnumSet $other) : bool
- Added EnumSet::isSubset(EnumSet $other) : bool
- Added EnumSet::isSuperset(EnumSet $other) : bool
- #66: EnumSet: added methods union(), intersect(), diff() and symDiff()
- Added EnumSet::union(EnumSet ...$others) : EnumSet
- Added EnumSet::intersect(EnumSet ...$others) : EnumSet
- Added EnumSet::diff(EnumSet ...$others) : EnumSet
- Added EnumSet::symDiff(EnumSet ...$others) : EnumSet
- #65: EnumSet: added getEnumerators(), getNames() and getValues()
- Added EnumSet::getEnumerators() : Enum[]
- Added EnumSet::getValues() : mixed[]
- Added EnumSet::getNames() : string[]
- #78: Added static Enum::getValues(), Enum::getNames() and Enum::getOrdinals()
- Added Enum::getValues() : mixed[]
- Added Enum::getNames() : string[]
- Added Enum::getOrdinals() : int[]
- #80: refactored Enum::getBy* to Enum::by*
- Renamed Enum::getByName() -> Enum::byName()
- Renamed Enum::getByOrdinal() -> Enum::byName()
- Added Enum::byValue()
- #59: handle class constant visibility added in PHP-7.1
- #67: optimized EnumSet::count() by 30% to 240%
- #75: optimized EnumSet by using EnumSet properties directly instead of getter methods
##Fixed:
- #71: EnumSet::setBinaryBitset*(): out-of-range bits of last byte not truncated
- #77: Missing additional check on Enum::is() to return TRUE in some circumstances
Deprecations:
- #63 :
EnumSet::getBitset() : string - #63:
EnumSet::setBitset(string $bitset) - #79:
Enum::clear() - #80:
Enum::getByName() - #80:
Enum::getByOrdinal()
BC-breaks:
- none
v2.2.1
Bugfix release
Changes:
#60 Infinitive loop on counting an empty set based on an empty enumeration
BC-breaks:
none
https://github.com/marc-mabe/php-enum/pulls?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A2.2.1