Two new inference sources for Eloquent-backed code, one new opt-in queue-safety rule, and three false-positive fixes across migrations, model attribute helpers, and pipelines.
Features
- Add opt-in
SerializedQueuedModelrule forShouldQueueclasses that hold an Eloquent model without reachingIlluminate\Queue\SerializesModels, where the whole model is written into the queue payload instead of aModelIdentifier(#1385). Enable with<findSerializedQueuedModels value="true" />. Detection resolves the flattened__serialize()/__sleep()rather than matching the trait name, so framework bases that already pull the trait in (Illuminate\Foundation\Queue\Queueable,Illuminate\Notifications\Notification) and classes that hand-write their own serialization stay silent.
final class ReconcileLedger implements ShouldQueue
{
public function __construct(private Customer $customer) {}
- // silent: the entire Customer row is written into the queue payload
+ // SerializedQueuedModel: $customer will be serialized whole into the queue payload
}- Infer
Arr::pluck()value and key types from the element model's@propertyannotations, matching whatCollection::pluck()andBuilder::pluck()already do (#1383).
/** @param list<Customer> $rows */ // Customer has @property string $id
-Arr::pluck($rows, 'id'); // array<array-key, mixed>
+Arr::pluck($rows, 'id'); // list<string>Fixes
- Support
$schema = Schema::connection(...)in migrations, so columns declared through a variable-held builder (#1382). - Narrow
Model::getAppends()andModel::getMutatedAttributes()tolist<string>, so callers no longer have to re-assert the element type (#1381). - Type
Pipeline::then()from its destination closure instead of leaving itmixed(#1376).
Full Changelog: v4.15.5...v4.15.6