Skip to content

v4.0.0-rc1

Pre-release
Pre-release
Compare
Choose a tag to compare
@marc-mabe marc-mabe released this 13 May 05:39
· 102 commits to master since this 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