Releases: rotexsoft/versatile-collections
New Major Release
-
PHP 8.1 is now the minimum version
-
More type hinting around the code-base
-
CollectionInterface signature changes also impacts CollectionInterfaceImplementationTrait & all classes that implement it
- __get(string $key):mixed
- __set(string $key, mixed $val): void
- appendItem(mixed $item): CollectionInterface
- column(int|string $column_key, int|string|null $index_key=null): GenericCollection
- containsItem(mixed $item): bool
- containsItemWithKey(int|string $key, mixed $item): bool
- containsKey(int|string $key): bool
- each(callable $callback, mixed $termination_value=false, bool $bind_callback_to_this=true): CollectionInterface
- firstItem(): mixed
- getAndRemoveFirstItem (): mixed
- getAndRemoveLastItem(): mixed
- getAsNewType(string|CollectionInterface $new_collection_class=GenericCollection::class): CollectionInterface
- getIfExists(string|int $key, mixed $default_value=null): mixed
- lastItem(): mixed
- offsetExists(mixed $key): bool
- offsetGet(mixed $key): mixed
- offsetSet($key, mixed $val): void
- prependItem(mixed $item, string|int|null $key=null): CollectionInterface
- pull(int|string $key, mixed $default = null): mixed
- push(mixed $item): CollectionInterface
- put(int|string $key, mixed $value): CollectionInterface
- randomItem(): mixed
- randomKey(): int|string
- reduce(callable $reducer, mixed $initial_value=NULL)
- reduceWithKeyAccess(callable $reducer, mixed $initial_value=NULL)
- searchAllByVal( mixed $value, bool $strict = false ): array|false
- searchByVal(mixed $value, bool $strict = false ): mixed
- setValForEachItem(string $field_name, mixed $field_val, bool $add_field_if_not_present=false): CollectionInterface
- whenFalse($falsy_value, callable $callback, callable $default=null): mixed
- whenTrue($truthy_value, callable $callback, callable $default=null): mixed
-
CollectionInterfaceImplementationTrait signature changes
- __construct(mixed ...$items)
- performMultiSort(array $array_to_be_sorted, MultiSortParameters ...$param): array
-
FloatsCollection signature changes
- itemToString(float|int $item): string
-
IntsCollection signature changes
- itemToString(float|int $item): string
-
NumericsCollection signature changes
- itemFromString(string $str): float|int
- itemToString(float|int $item): string
-
StrictlyTypedCollectionInterface & every class that implements it
- checkType(mixed $item): bool
-
StrictlyTypedCollectionInterfaceImplementationTrait
- __construct(mixed ...$arr_objs)
- isRightTypeOrThrowInvalidTypeException(mixed $item, string $calling_functions_name): bool
-
Utils
- gettype(mixed $var): string
-
src/helper-functions.php
- get_object_property_value(object $obj, string|int $property, mixed $default_val=null, bool $access_private_or_protected=false): mixed
- object_has_property(object $obj, string|int $property): bool
- random_array_key(array $array): string|int|null
- dump_var(mixed $var): void
Full Changelog: 5.3.0...6.0.0
New Major Release
- Updated dev dependencies
- CollectionInterfaceImplementationTrait.php
- protected function performMultiSort(array $array_to_be_sorted, MultiSortParameters ...$param)
- changed to protected function performMultiSort(array $array_to_be_sorted, MultiSortParameters ...$param): array
- MultiSortParameters
- protected $field_name = '';
- changed to protected string $field_name = '';
Full Changelog: 5.2.0...5.3.0
Maintenance Release
Minor Enhancement
- Under the hood tweaks
Minor Enhancement
- Added \VersatileCollections\NonArrayIterablesCollection, a sub-class of ObjectsCollection, for storing instances of classes that are iterables.
- This new collection class does not store arrays because they are not objects, even though they are also iterables. Use ArraysCollection to store arrays or you can create a new custom collection class for storing all types of iterables including arrays.
Major Release
Changed
StrictlyTypedCollectionInterface::getType():string
to
StrictlyTypedCollectionInterface::getTypes():StringsCollection
This is a backwards incompatible change. All classes implementing StrictlyTypedCollectionInterface will have to be updated to work with this version.
Maintenance Release
- PHP 7.4 enhancements
Maintenance Release
- Changed minimum required PHP version to 7.4
Enhancements
-
Changed
- CollectionInterface::makeNew(array $items=[], bool $preserve_keys=true): CollectionInterface
- to
- CollectionInterface::makeNew(iterable $items=[], bool $preserve_keys=true): CollectionInterface
-
Changed
- SpecificObjectsCollection::makeNewForSpecifiedClassName(?string $class_name=null, array $items =[], bool $preserve_keys=true): StrictlyTypedCollectionInterface
- to
- SpecificObjectsCollection::makeNewForSpecifiedClassName(?string $class_name=null, iterable $items =[], bool $preserve_keys=true): StrictlyTypedCollectionInterface
Next Major Release
- Now using github actions for CI
- Minimum PHP 7.3
- More explicit typing (parameter and return types)