Skip to content

v1.1.0

Choose a tag to compare

@GwendolenLynch GwendolenLynch released this 10 Aug 19:32
· 20 commits to master since this release
v1.1.0
2a5c899

I'm really excited about this release. It brings Bag functionality to up par with builtin array methods and adds several more useful methods and shortcuts.

We also have API documentation generated now.

Major Changes:

  • The mutable bag has been renamed from Bag to MutableBag
  • The immutable bag has been renamed from ImmutableBag to Bag
  • ImmutableBag is now a deprecated class alias to Bag
  • Mutable methods on Bag are deprecated

Minor BC breaks:

  • Bag::first() & Bag::last() now return null instead of false for empty bags
  • Bag::indexOf() now returns null instead of false if the item is not found
  • Methods accepting collections now throw an InvalidArgumentException if the value given is a non-iterable instead of silently converting it to an array with one item
    • Affected methods: from, combine, replace, replaceRecursive, defaults, defaultsRecursive, merge

New Features:

Arr

  • Added from() method
  • Added fromRecursive() method
  • Added mapRecursive() method
  • Added remove() method

Bag

  • Added call() method
  • Added countValues() method
  • Added diffBy() method
  • Added diffKeysBy() method
  • Added diffKeys() method
  • Added diff() method
  • Added findKey() method
  • Added findLastKey() method
  • Added findLast() method
  • Added find() method
  • Added flatten() method
  • Updated indexOf() - added optional parameter $fromIndex
  • Added intersectBy() method
  • Added intersectKeysBy() method
  • Added intersectKeys() method
  • Added intersect() method
  • Added lastIndexOf() method
  • Added of() static method
  • Added omit() method
  • Added pad() method
  • Added pick() method
  • Added randomKey() method
  • Added randomKeys() method
  • Added randomValue() method
  • Added randomValues() method
  • Added reject() method
  • Added sortBy() method
  • Added sortKeysBy() method
  • Added sortKeys() method
  • Added sortKeysWith() method
  • Added sort() method
  • Added sortWith() method

MutableBag

  • Added removePath() method

Other changes:

  • Deprecated: Arr:: assertAccessible
  • Change: Replace Traversable|array in PHPDoc with iterable
  • Added: bolt/common library
  • Added: Code styling & test integration
  • Change: Update Bag to use Arr::from
  • Updated: Usages of Assert to use bolt/common
  • Change: (Optimization) Added Collection classes by default to canReturnArrayByReference list

See all commits since v1.0.0