aaemnnosttv / silk

A modern API for WordPress.

Home Page:https://aaemnnost.tv/silk/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update Collection library

aaemnnosttv opened this issue · comments

tightenco/collect which provides the Illuminate\Support\Collection class is currently locked to 5.2.* for compatibility.

The library has a breaking change as of 5.3 which affects a few methods.

From the docs:


Key / Value Order Change

The first, last, and contains collection methods all pass the "value" as the first parameter to their given callback Closure. For example:

$collection->first(function ($value, $key) {
    return ! is_null($value);
});

In previous versions of Laravel, the $key was passed first. Since most use cases are only interested in the $value it is now passed first. You should do a "global find" in your application for these methods to verify that you are expecting the $value to be passed as the first argument to your Closure.


Upgrading the library will provide access to newer methods as well as provide better compatibility with other illuminate packages, should you so desire.

In the future, this Collections in Silk may change to use a namespaced version rather than relying on a 3rd party dependency.