tighten / collect

A Collections-only split from Laravel's Illuminate Support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`value` helper incorrect

jakewhiteley opened this issue · comments

Your current value function is implemented as follows:

function value($value)
{
    return $value instanceof Closure ? $value() : $value;
}

But it should be:

function value($value, ...$args)
{
    return $value instanceof Closure ? $value(...$args) : $value;
}

As per https://github.com/laravel/framework/blob/8.x/src/Illuminate/Collections/helpers.php#L175

Hello @jakewhiteley! As mentioned in the readme, this package exactly mirrors the releases from laravel/framework and extracts collect from it, and tags the release with the exact tag present in laravel/framework.

If you are seeing code in this package that seems old, check the tagged version of the laravel/framework code you expect to see and compare it with what's available here.. We're currently working on updating the extraction script so it works for both 9.0 and 8.0 releases, and in the meantime our 8.0 updates are stalled, as splitting them out is is finicky. If you need certain code right now, you can always pull in collect manually or fork the repo and apply those changes manually. If you'd like to contribute, read through the readme on how we upgrade and feel free to pitch in on the effort of keeping this up-to-date!

@jakewhiteley Update: I've gotten the upgrade script working for 8.0 releases, and I'm seeing the discrepancy you mentioned and am looking into what to do with the out-of-sync helpers.php file, as there are a couple of new methods in that file, but it also drops a couple of methods as well. That file was always manually updated in support of getting tests to pass, so since tests have been passing, we haven't updated that file.

Because of the nature of mirroring release versions, the update won't come out until the next release of 8.x.

Hi @jamisonvalenta , I figured it was a manual update as the file itself is quite different to the laravel/framework counterpart.

What is the normal release schedule for this package?

I am happy to make the PR for version 8.82.0 if that helps.

It's also worth mentioning that I also wouldn't have noticed, but recently I've been doing a similar thing with blade templating and getting that to run outside of a laravel application. As collect helper file is loaded by composer before mine, I can't redeclare value to be the up to date version.

So it's a pretty niche use case, but I have been relying on the "extra" files in collect for ages such as the Arr class - I imagine others are as well.

@jakewhiteley Good News! I ended up not publishing the 8.83.0 release, so I've corrected the value() method in the #279 and tagged it with 8.82.0. 8.83.0 will be out shortly. Let me know if you run into any issues, else feel free to close this issue!