Skip to content

feat: add Arr::after() to retrieve the value after the given value#60081

Closed
gulfaraz-arshad wants to merge 506 commits into
laravel:masterfrom
gulfaraz-arshad:feature/arr-after-method
Closed

feat: add Arr::after() to retrieve the value after the given value#60081
gulfaraz-arshad wants to merge 506 commits into
laravel:masterfrom
gulfaraz-arshad:feature/arr-after-method

Conversation

@gulfaraz-arshad
Copy link
Copy Markdown

What this PR does

Adds a new static Arr::after() method that retrieves the value
after the given value in an array. Wraps around to the first
element if the given value is the last one.

Usage

Arr::after(['a', 'b', 'c'], 'a'); // 'b'
Arr::after(['a', 'b', 'c'], 'c'); // wraps → 'a'
Arr::after(['a', 'b', 'c'], 'z'); // not found → null
Arr::after(['x' => 'a', 'y' => 'b'], 'a'); // 'b'

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 in Arr keeps it consistent with
helpers like Arr::first() and Arr::last().

taylorotwell and others added 30 commits April 5, 2026 09:16
…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>
mosabbirrakib and others added 11 commits May 8, 2026 17:28
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>
jackbayliss and others added 13 commits May 12, 2026 17:17
* 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
@gulfaraz-arshad gulfaraz-arshad force-pushed the feature/arr-after-method branch from 17e588d to 68a2310 Compare May 12, 2026 12:20
@shaedrich
Copy link
Copy Markdown
Contributor

Your target branch doesn't seem to be the same as the branch you created your feature branch from

@shaedrich
Copy link
Copy Markdown
Contributor

shaedrich commented May 12, 2026

Arr::after(['a', 'b', 'c'], 'c'); // wraps → 'a'
Arr::after(['a', 'b', 'c'], 'z'); // not found → null
Arr::after(['x' => 'a', 'y' => 'b'], 'a'); // 'b'

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?

@taylorotwell
Copy link
Copy Markdown
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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.