Drop Laravel 11 / PHP 8.2–8.3 support, fix async serialization bug#3
Merged
Drop Laravel 11 / PHP 8.2–8.3 support, fix async serialization bug#3
Conversation
…Laravel 12+ BREAKING CHANGE: Minimum PHP version is now 8.4, minimum Laravel version is 12.0. Removed support for Pest 2.x, testbench 9.x, and related Laravel 11 dependencies.
Closures stored in AsyncAttemptJob were not serializable, causing failures on non-sync queue drivers. Also restores missing delayCallback, catchHandlers, and finallyCallbacks when rebuilding the AttemptBuilder from configuration.
…uilder AsyncAttemptBuilder is a builder, not a queued job. The ShouldQueue interface was misleading and belonged only on AsyncAttemptJob.
The defer() helper is always available in Laravel 12+, so the fallback branch was dead code.
dispatch() returns void, not a pending result. Documented dispatch() with then/catch callbacks and await() as separate usage patterns.
There was a problem hiding this comment.
Pull request overview
Updates the package for a Laravel 12 / PHP 8.4 baseline and improves async attempt execution by making queued job configuration more serialization-friendly, alongside some documentation/config/test cleanups.
Changes:
- Bump runtime/dev dependencies (PHP ^8.4, Illuminate ^12) and update CI matrix accordingly.
- Update async attempt queuing implementation to serialize closures in job payload and restore more builder configuration when executing the job.
- Clean up class references/imports in tests, config, and documentation.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/AttemptContextTest.php | Switches Carbon reference to imported class. |
| tests/ArchTest.php | Uses imports for arch expectations instead of fully-qualified names. |
| src/Facades/Attempt.php | Updates @see reference to use imported AttemptManager. |
| src/Builders/AsyncAttemptJob.php | Wraps closures for queue serialization; rehydrates builder config when handling job. |
| src/Builders/AsyncAttemptBuilder.php | Removes ShouldQueue implementation from builder; keeps dispatch/await API. |
| src/AttemptContext.php | Switches to Illuminate\Support\Carbon. |
| src/AttemptBuilder.php | Simplifies deferred-callback scheduling to always call defer(). |
| README.md | Updates async usage docs with then/catch and adds await() example. |
| phpunit.xml.dist | Renames the test suite. |
| phpstan.neon.dist | Removes database from PHPStan scan paths. |
| config/attempt.php | Uses imports for strategy class references. |
| composer.json | Raises PHP/Laravel component requirements; updates dev tooling versions. |
| .github/workflows/run-tests.yml | Narrows Laravel test matrix to 12.*. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+24
to
+38
| protected array $configuration; | ||
|
|
||
| protected ?SerializableClosure $thenCallback; | ||
|
|
||
| protected ?SerializableClosure $catchCallback; | ||
|
|
||
| public function __construct( | ||
| protected array $configuration, | ||
| protected ?Closure $thenCallback = null, | ||
| protected ?Closure $catchCallback = null | ||
| ) {} | ||
| array $configuration, | ||
| ?Closure $thenCallback = null, | ||
| ?Closure $catchCallback = null | ||
| ) { | ||
| $this->configuration = $this->wrapClosures($configuration); | ||
| $this->thenCallback = $thenCallback ? new SerializableClosure($thenCallback) : null; | ||
| $this->catchCallback = $catchCallback ? new SerializableClosure($catchCallback) : null; | ||
| } |
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.
Summary
This is a major version release that drops support for Laravel 11 and PHP 8.2/8.3, targeting PHP 8.4+ and Laravel
12+ only. It also fixes a critical serialization bug in the async queue system and cleans up several minor issues
across config and documentation.
Breaking Changes
^8.2to^8.4^11.0|^12.0to^12.0^2.34|^3.8.6to^3.8.6^9.0|^10.0to^10.0Bug Fixes
AsyncAttemptJob: Closures ($thenCallback,$catchCallback, and all closures within the configuration array)were not serializable, causing fatal errors when dispatching to non-sync queue drivers (Redis, SQS, database). All
closures are now wrapped in
Laravel\SerializableClosure\SerializableClosure(a3c4c35)AsyncAttemptJob:delayCallback,catchHandlers, andfinallyCallbacksfrom the builder configuration weresilently dropped when reconstructing the
AttemptBuilderinside the queued job (a3c4c35)AsyncAttemptBuilder: Removed incorrectimplements ShouldQueue— this class is a builder, not a queued job (a996fc1)phpstan.neon.dist: Removed reference to non-existentdatabase/directory (55ec40f)phpunit.xml.dist: Renamed placeholder"VendorName Test Suite"to"Attempt Test Suite"(fb91ee8)Refactors
AttemptBuilder: Removed deadfunction_exists('defer')fallback —defer()is always available in Laravel12+ (
59045a1)AttemptContext: Switched fromCarbon\CarbontoIlluminate\Support\Carbonto respect app-level Carboncustomizations (
d53ad29)CI
614a048)Docs
dispatch()returnsvoid, not a chainable result. Documenteddispatch()withthen/catchcallbacks andawait()as separate usage patterns (dc3139a)Migration Guide
Update your
composer.json:Requirements:
No API changes — all public methods remain the same. Only the runtime requirements have changed.
Test Plan