feat: add Arr::after() to retrieve the value after the given value#60081
Closed
gulfaraz-arshad wants to merge 506 commits into
Closed
feat: add Arr::after() to retrieve the value after the given value#60081gulfaraz-arshad wants to merge 506 commits into
gulfaraz-arshad wants to merge 506 commits into
Conversation
…duplicat…" (laravel#59542) This reverts commit f920a23.
…en values contain null (laravel#59561) Same issue as In and NotIn (laravel#59560) — str_replace() receives null from enum_value(null), generating a deprecation warning that will become a TypeError in PHP 9.0.
…put (laravel#59554) * [13.x] Fix Str::markdown() and Str::inlineMarkdown() crash on null input Both methods pass the input directly to the CommonMark converter which requires a string. Passing null throws a TypeError. Cast to string to handle null gracefully. * Also fix Str::transliterate() crash on null input Same issue — passes null directly to third-party ASCII library which requires a string.
* add queue methods to inspect jobs queue methods to inspect jobs squash it to save viewing pain doc Update InspectedJob.php csx2 cs wip tests and clean up * drop queue we pass it in.. so no need to see it * adjust order of params --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
* strict mode for validation * delete validation.php file * formated * formatting * formatting * more tests --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
…laravel#59571) Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 7.3.1 to 7.3.2. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/v7.3.2/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/v7.3.2/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-version: 7.3.2 dependency-type: direct:development ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…ain null (laravel#59576) Same fix as laravel#59561 (Contains/DoesntContain) — str_replace() receives null from enum_value(null), generating a deprecation warning. The In and NotIn rules have the identical pattern that was missed.
…een tests (laravel#59574) * [13.x] Add flushState to FormRequest to reset global strict mode between tests FormRequest::failOnUnknownFields() sets a static flag that persists across tests. Without a flushState() method and a call in the test lifecycle teardown, enabling strict mode in one test leaks into all subsequent tests. * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
…by child classes (laravel#59568) * Lookup WithoutRelations attribute recursively * Add test
The #[Delay] attribute is supported for queued jobs, event listeners, and notifications, but queued mailables only check the $delay property and ignore the attribute entirely. This adds the ReadsClassAttributes support trait to Mailable and uses getAttributeValue() in the queue() method, consistent with how Bus\Dispatcher, Events\Dispatcher, and NotificationSender handle the #[Delay] attribute.
laravel#59597) * Added inheritance support for Controller Middleware attributes * Update Route.php * Update Route.php * add test --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
…ons (laravel#59569) * fix: phpredis config normalization * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
…fo methods (laravel#59602) Co-authored-by: sebastian cabarcas <sebastian@grupoav.cl>
this docblock was removed in laravel#59675 when trying to refactor some of the generics. we will add the docblock back, and define the `TModel` generic at the class level, so it can be passed to the interface, and also used in the `apply()` method.
…l#59734) * Set up SQS disk extended addition Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com> * Add tests for the job changes Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com> * Add tests for SqsJob raw body handling and cleanup behavior Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com> * Remove unused import Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com> * formatting * formatting --------- Signed-off-by: Kevin Ullyott <ullyott.kevin@gmail.com> Co-authored-by: Taylor Otwell <taylor@laravel.com>
* Cloud queue metrics * Reset static state before running tests * Add binding test * formatting --------- Co-authored-by: Taylor Otwell <taylor@laravel.com>
* allow aliases in signature attribute * just null it tbh * Add test
* Prepare `master` branch for Laravel 14 - Remove PHP 8.3 (Symfony 8 requires PHP 8.4 as minimum) - Set illuminate deps to `^14.0` - Update branch aliases Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * update workflows Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * update minimum php Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> * wip Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com> --------- Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
Signed-off-by: Mior Muhammad Zaki <crynobone@gmail.com>
* Add 'authorize' method to the contract * Add implementation to the trait
17e588d to
68a2310
Compare
Contributor
|
Your target branch doesn't seem to be the same as the branch you created your feature branch from |
Contributor
Honestly, it makes sense for carousels, but not so much for the general use. I'd introduce a flag, which would affect it like this: // without flag
Arr::after(['a', 'b', 'c'], 'c'); // null (`RangeException` would work but would probably be annoying)
Arr::after(['a', 'b', 'c'], 'z'); // not found → throws
Arr::after(['x' => 'a', 'y' => 'b'], 'x'); // 'b' → returns value
// with flag
Arr::after(['a', 'b', 'c'], 'c', wrap: true); // wraps → 'a'
Arr::after(['a', 'b', 'c'], 'z', wrap: true); // not found → 'a'
Arr::after(['x' => 'a', 'y' => 'b'], 'x'); // 'b'What do you think? |
Member
|
Thanks for your pull request to Laravel! Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include. If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds a new static
Arr::after()method that retrieves the valueafter the given value in an array. Wraps around to the first
element if the given value is the last one.
Usage
Why
This is a common pattern when building carousels, step wizards,
rotating queues, or any sequential navigation logic. The name
after()is consistent with how Laravel uses it in migrations(
->after()). Having it inArrkeeps it consistent withhelpers like
Arr::first()andArr::last().