Skip to content

Releases: marc-mabe/php-enum

v4.1.0

04 Jul 04:18
Compare
Choose a tag to compare

First Minor Release of 4.x

Changes

  • #126 Added EnumSet::isEmpty() and EnumMap::isEmpty()

v4.0.0

21 May 20:28
Compare
Choose a tag to compare

First stable release 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

  • Added Immutable EnumSet and EnumMap API

    • Added with* methods which will not modify the current object but instead generate a new object
    • Now the iterable interface is using IteratorAggregate with Generator to move the iteration state into an own object and provides much better performance
    • The mutable API will stay untouched. This means that you have the choice to use either the mutable or immutable API depending on your use case.
    • #109 #110 #118
  • Added methods to bulk modify an EnumSet and EnumMap and to instantiate state

    • The constructor supports an iterable second argument to instantiate the state
    • Added methods addIterable, removeIterable, withIterable, withoutIterable
  • Consistent Method Namings

    • We have renamed the following methods to be consistent over all classes.
    • The old method names are marked as deprecated and will trigger a deprecation notice in the last 4.x release and get removed in 5.x
    • EnumSet::attach -> EnumSet::add
    • EnumSet::detach -> EnumSet::remove
    • EnumSet::contains -> EnumSet::has
    • EnumMap::contains -> EnumMap::has
    • #120 #121
  • Added Type-Hints

    • All public methods have argument and return type-hints where possible.
  • PHP-7.1

    • We have raised the required PHP version from 5.6 to 7.1 and removed HHVM support.
    • This has been done to reduce internal complexity, to improve performance and to be able to define type-hints

BC-Breaks

  • As of moving from Iterator to IteratorAggregate

    • removed methods - please use foreach directly or migrate to getIterator instead
      • EnumSet::current
      • EnumSet::key
      • EnumSet::next
      • EnumSet::rewind
      • EnumSet::valid
      • EnumMap::current
      • EnumMap::key
      • EnumMap::next
      • EnumMap::rewind
      • EnumMap::valid
      • EnumMap::seek
  • As of moving to Genreator

    • On iterating an EnumSet or EnumMap the iterator position can move forward only
    • Enum[Set|Map]->getIterator()->rewind() throws an exception
  • Soft Deprecations

    • EnumSet::attach please use EnumSet::add instead
    • EnumSet::detach please use EnumSet::remove instead
    • EnumSet::contains please use EnumSet::has instead
    • EnumMap::contains please use EnumMap::has instead

https://github.com/marc-mabe/php-enum/issues?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A4.0.0

v4.0.0-rc1

13 May 05:39
Compare
Choose a tag to compare
v4.0.0-rc1 Pre-release
Pre-release

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

  • Added Immutable EnumSet and EnumMap API

    • Added with* methods which will not modify the current object but instead generate a new object
    • Now the iterable interface is using IteratorAggregate with Generator to move the iteration state into an own object and provides much better performance
    • The mutable API will stay untouched. This means that you have the choice to use either the mutable or immutable API depending on your use case.
    • #109 #110 #118
  • Added methods to bulk modify an EnumSet and EnumMap and to instantiate state

    • The constructor supports an iterable second argument to instantiate the state
    • Added methods addIterable, removeIterable, withIterable, withoutIterable
  • Consistent Method Namings

    • We have renamed the following methods to be consistent over all classes.
    • The old method names are marked as deprecated and will trigger a deprecation notice in the last 4.x release and get removed in 5.x
    • EnumSet::attach -> EnumSet::add
    • EnumSet::detach -> EnumSet::remove
    • EnumSet::contains -> EnumSet::has
    • EnumMap::contains -> EnumMap::has
    • #120 #121
  • Added Type-Hints

  • All public methods have argument and return type-hints where possible.

  • PHP-7.1

    • We have raised the require PHP version from 5.6 to 7.1 and removed HHVM support.
    • This has been done to reduce internal complexity, to improve performance and to be able to define type-hints

BC-Breaks

  • As of moving from Iterator to IteratorAggregate

    • removed methods - please use foreach directly or migrate to getIterator instead
      • EnumSet::current
      • EnumSet::key
      • EnumSet::next
      • EnumSet::rewind
      • EnumSet::valid
      • EnumMap::current
      • EnumMap::key
      • EnumMap::next
      • EnumMap::rewind
      • EnumMap::valid
      • EnumMap::seek
  • As of moving to Genreator

    • On iterating an EnumSet or EnumMap the iterator position can move forward only
    • Enum[Set|Map]->getIterator()->rewind() throws an exception
  • Soft Deprecations

    • EnumSet::attach please use EnumSet::add instead
    • EnumSet::detach please use EnumSet::remove instead
    • EnumSet::contains please use EnumSet::has instead
    • EnumMap::contains please use EnumMap::has instead

https://github.com/marc-mabe/php-enum/issues?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A4.0.0

v2.3.2

16 Mar 18:26
Compare
Choose a tag to compare

Bugfix release

Changes:

#98 Backported HHVM >3.18.4 & >3.20.2 reports as PHP-7.1 but does not support constant visibility

BC-breaks:

none

v3.1.1

02 Feb 18:52
7a5d094
Compare
Choose a tag to compare

First Patch Release of 3.1.x

Changes

  • #107 fixed array to string conversion in EnumMap::offsetGet()
  • copyright 2019
  • \count() instead of count()
  • static::class instead of get_class($this)
  • more strict argument type for Enum::get()

v3.1.0

02 Feb 09:43
Compare
Choose a tag to compare

First Minor Release of 3.x

Changes

  • #96 #106 Support arrays as enum values in phpDoc enhancement
  • #105 added Enum::hasValue() and Enum::hasName()
  • added missing phpdoc @throws
  • fixed return type in phpdoc of EnumSet::getValues()
  • fixed argument type in phpdoc of EnumMap::search()
  • fixed first argument name in phpdoc of Enum:has()

v3.1.0-rc1

21 Jan 23:25
9ad4dda
Compare
Choose a tag to compare

First Release Candidate of new minor version

Changes

  • #96 #106 Support arrays as enum values in phpDoc enhancement
  • #105 added Enum::hasValue() and Enum::hasName()

v3.0.2

14 Sep 14:18
a75560c
Compare
Choose a tag to compare

Patch release of 3.0.x

Changes

  • #99 : Minor phpdoc syntax fix

BC-breaks

none

v3.0.1

22 May 10:51
aa94dd1
Compare
Choose a tag to compare

Patch release of 3.0.x

Changes

  • #95 : Add description to assert()
  • #98 : HHVM >3.18.4 & >3.20.2 reports as PHP-7.1 but does not support constant visibility
  • Micro-Optimized Enum::by*methods

BC-breaks

none

v3.0.0

05 Nov 14:52
Compare
Choose a tag to compare

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() and symDiff() support one argument of $others only
    • Methods added:
      • public function getBit(int $ordinal) : bool
      • public function setBit(int $ordinal, bool $bit) : void
  • #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 and Iterator
    • new implements SeekableIterator
    • Methods removed:
      • public function attach($enumerator) : void
        • please use public function offsetSet($enumerator) : void
        • or direct array access $map[$enum] = $value
      • public function detach($enumerator): void
        • please use public function offsetUnset($enumerator) : void
        • or direct array access unset($map[$enum])
      • 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 on NULL values
    • Methods added:
      • public function seek(int $pos) : void
      • public function getKeys() : Enum[]
      • public function getValues() : mixed[]
      • public function search($enumerator, bool $strict) : Enum|null

https://github.com/marc-mabe/php-enum/issues?utf8=%E2%9C%93&q=is%3Aclosed+milestone%3A3.0.0