- Fix PHP 8.4 deprecations
- Add support for a "typed" collection that contains only values of type
- Set default collection types to SimpleCollection / MutableCollection to allow for typed collections
- Bump minimum PHP to 8.1
- Remove all unnecessary docblock comments
- Add
when()
for testing and mutating the collection by callbacks - Add
doesNotHave()
alias ofhasNoneOf()
for testing keys - Add Symfony phpunit/bridge to aid deprecations
- Minor return type hint updates for deprecation notices
- Fix
FrozenCollection
should haveremoveEmpty
andremoveNulls
as they return new collections
- Add
firstOrFail
andlastOrFail
- Add
hasAllOf
as alias ofhas()
for checking if all keys exist in collection - Add
matchingRule
to filter values for keys matching a regex expression - Fix invalid variable usage in
ClassUtils::setProperty()
- Fix
get()
to execute callables as defaults - Update closures to use short arrow syntax where possible
- Fix type hint on
remove()
should be mixed in interface
- Add union return types and better type hints
- Update docs
- Update for PHP8
- Update docs
- Remove deprecated v4.X methods
- Fix bug in
pipeline
using the wrong key for items
- Re-namespace to
Somnambulist\Components
- Release 4.0.0 as stable
- Raise minimum PHP version to 7.4
- Remove all deprecated methods
- Refactor sorting methods and deprecate previous methods
- Move major version changes into separate files
- Fix explode() requires a string and will fail if given an int (in KeyWalker)
-
Fix first/last do not wrap arrays when nested arrays are in the collection
-
Fix pop/shift do not wrap arrays when used with nested arrays
Note: this could be considered an API BC break, however the expected behaviour is for any operation returning data from the collection to honour the "wrapArrays" setting.
-
API BC break static vs non-static
-
Fix bug with
AbstractCollection::$collectionClass
causing ambiguous behaviour.The previous behaviour used a static property that was set on the first operation that required a new collection instance. If an extended collection is in use, then this type would be set and all collection instances would now be that type. Instead: this should have been an instance property based on the currently instantiated class. The result of the previous behaviour would be type errors if inheriting the default collections and adding custom methods that used return type hints.
While this fix is an API break, this was deemed necessary to prevent the current behaviour.
-
Fix bug with
Freeze::$freezableClass
causing ambiguous behaviour.For the same reasons as the previous fix, this makes the freezeableClass non-static and an instance property instead of being global.
- Fix doubly loaded trait on MutableSet (
capitalize
)
- Fix bug in
KeyWalker
where methods with no properties could not be accessed
- Fix bug in extract if objects used as keys
- Fix missing constructor on
SimpleCollection
- Added
random
for getting the first element from ashuffle
'd collection
- Minor BC break on
first
andlast
; now returnnull
if the key is not found - Added additional
find
tests andfind
/findLast
return false if not found
- Allow map() to accept single argument functions again
- bug fix - trait was duplicated in Group\Filterable \ Queryable
- bug fix - trait was duplicated in Group\Mutable
- added magic ->map->{method}() calling to run a method on the objects in the collection
- added support for magic property detection via __isset() checks
- V3 is a major BC break with the V2 series
- full refactoring of the entire library
- sub-divided functionality into traits
- added interfaces to describe grouped behaviour
- added default trait groups
- added pseudo Set (string keys) that limits to unique values
- added SimpleCollection with limited functionality
- added static
create
and separatenew
method - added customising the collection class created when methods create new classes
- added customising the frozen class type when using
Freezable
- added extra methods to
exportToArray
- key walking now available in many more functions
- many deprecations
- many changes to behaviour and handling
- changed
ExportableInterface
->Arrayable
- changed
Collection
->MutableCollection
- changed
Immutable
->FrozenCollection
- changed rules for converting to arrays on collection creation
- changed
__call
behaviour to use a proxy via the magicrun
property accessor - deprecated
removeElement
useremove
; remove now removes values; useunset
to remove keys - deprecated
transform
it is replaced bymap
- removed all deprecated v2 methods
- removed
implodeKeys
usekeys()->implode()
- removed
invoke
it is nowrun
- removed
walk
similar functionality can be achieved usingmap
- added
ExportableInterface
(thanks to @Garethp) - possible bug: in Collection factory, Collection used toArray now uses all() to get contents
- added
pipe()
allowing a Collection of items to be transformed by a Collection of operators
- added
toQueryString()
- added
removeEmpty()
- added support for accessing dot key names directly in get() via
@
prefix - removed composer.lock and added .gitattributes for cleaner exporting
- added dot access via
get()
allowing Collections to be traversed usingkey.*.value
syntax - added support class for some common functions
- refactored
extract()
andflatten()
- replacing Collection contents via an array on
set()
is now deprecated - docs update
- added extract()
- refactored unit tests to reduce the size off the main test file
- added shuffle() (thanks to @paulmaclean)
- changed each() to mirror other Collection each implementations - BC break!
- changed methods that accept arrays to use convertToArray()
- changed call() to transform() - call() is now deprecated
- removed all previously deprecated methods
- removed static factory methods to a factory class (except collect())
- removed modified flag
- added assert()
- added only()
- added partition()
- added value()
- extracted some method groups into traits
- added lower, upper, intersect, trim, diff, diffKeys, fill, fillKeysWith, explode, collectionFromString, toJson
- re-ordered methods to group PHP interface methods together
- moved other methods into (mostly) alphabetical order
- moved deprecated methods together
- added min, max and sum; loosely based on Laravels Collection methods of the same name
- added additional unit tests
- cleaned up offsetSet and fixed bug where null offset was not correctly handled
- fixed serialization bug with Immutable collections
- fixed bug in filter not passing the flag through
- added except for excluding keys
- added call as an alternative to walk / each that uses a more standard callable
- added documentation for callables
- removed unneeded docblocks
- cleaned up some argument names and internal naming
- marked findByRegex, isValueInSet and addIfNotInSet as deprecated
- addition of pop, shift, slice and each
- fixed Immutable
Initial commit, forked from domain input mapper.