Skip to content

Releases: rotexsoft/versatile-collections

Enhancement

12 Jun 03:10
718c770
Compare
Choose a tag to compare
  • Updated performMultiSort to return immediately if supplied array is empty

Enhancement

12 Jun 03:00
1833e32
Compare
Choose a tag to compare
  • Updated performMultiSort to return immediately if supplied array is empty

Maintenance Release

08 May 03:41
Compare
Choose a tag to compare
  • Updated performMultiSort to leverage array_multisort's string key association maintenance. This is an under the hood change.

Maintenance Release

08 May 03:42
Compare
Choose a tag to compare
  • Updated performMultiSort to leverage array_multisort's string key association maintenance. This is an under the hood change.

Maintenance Release

02 Feb 06:56
Compare
Choose a tag to compare
  • Disabled the class_exists logic in SpecificObjectsCollection::makeNewForSpecifiedClassName that generates the SpecifiedClassNotFoundException. This is due to the autoload mechanism that causes class_exists to return false in situations where the class is available and will be autoloaded by composer
  • Code formatting
  • Documentation updates
  • PHP 7.2 compliant tweaks

New Features and some BC changes

22 Nov 23:58
Compare
Choose a tag to compare
  • Added SpecificObjectsCollection (a final class that is a subclass of ObjectsCollection and cannot be extended by design).

    • This type of collection,

      • stores instances of a specified class (if the class name is provided as the first parameter to SpecificObjectsCollection::makeNewForSpecifiedClassName) or any of its sub-classes

      • or stores any kind of object (i.e. works exactly like ObjectsCollection if no class name or null is provided as the first parameter to SpecificObjectsCollection::makeNewForSpecifiedClassName)

    • Its has a protected constructor by design so that its instances cannot be created via the use of the new keyword, instead its instances can only be created by calling SpecificObjectsCollection::makeNewForSpecifiedClassName(?string $class_name=null, array $items =[], bool $preserve_keys=true)

  • Utils::getExceptionAsStr(\Exception $e): string has been changed to Utils::getThrowableAsStr(\Throwable $e): string

  • Added new method: Utils::gettype($var): string

First PHP 7.2+ Release

10 Nov 07:18
Compare
Choose a tag to compare
  • A PHP 7.2+ focused release. Takes full advantage of parameter and return type type-hints where possible

  • Gotten rid of obsolete dependencies

  • Goal is to make the code-base lean & efficient while taking advantage of all the new features in PHP 7.2 and getting rid of a lot of PHP 5.6 - 7.1 compatibility code.

  • checkType($item) changed to checkType($item): bool

    • You must specify the return type in order to continue to adhere to the contract in StrictlyTypedCollectionInterface
  • __call in CollectionInterfaceImplementationTrait now throws \VersatileCollections\Exceptions\BadMethodCallException instead of \BadMethodCallException

  • getCollectionsOfSizeN(int $max_size_of_each_collection=1) now returns one collection containing all items in the original collection if $max_size_of_each_collection is greater than the number of items in the original collection. It also internally sets $max_size_of_each_collection to 1 if the value specified by the caller is less than or equal to zero.

  • yieldCollectionsOfSizeN(int $max_size_of_each_collection=1) now yields only one collection containing all items in the original collection if $max_size_of_each_collection is greater than the number of items in the original collection. It also internally sets $max_size_of_each_collection to 1 if the value specified by the caller is less than or equal to zero.

  • Added these two static methods to the Utils class:

    • array_key_first(array $array)
    • array_key_last(array $array)
  • Removed array_key_first(array $array) and array_key_last(array $array) from helper-functions.php.

    • You now need to be running PHP 7.3 which provides these functions natively or use your own polyfill or Utils::array_key_first(array $array) and Utils::array_key_last(array $array) for the same functionality.

Enhancement

26 Jul 21:31
Compare
Choose a tag to compare
  • Improved code for binding $this to callbacks in some methods

Enhancement

18 Jun 22:43
Compare
Choose a tag to compare
  • Added array_key_first and array_key_last polyfills for PHP 5.6, 7.0, 7.1 & 7.2
    • firstItem() & lastItem() now make use of these functions under the hood

Dependency resolution fix

21 Feb 06:12
Compare
Choose a tag to compare
  • Updated requirement for sebastian/exporter to ^1.0 || ^2.0 || ^3.0 because users already requiring ^1.0 in their projects were experiencing conflicts because it is not compatible with ^2.0 || ^3.0