BatchedJobIsBatchableRule
class BatchedJobIsBatchableRule implements Rule
Every job added to a batch must use the Batchable trait.
The batch wires each job back to its parent batch so the job can read progress
and short circuit ($this->batch()->cancelled()), and so the batch can
reconcile its job count and fire its then/catch/finally callbacks. All of that
lives in Batchable, so PendingBatch throws when the batch is created with
a job that does not use it, and Batch::add() fails calling its missing
withBatchId().
Nested arrays represent chains within a batch, and chained jobs need the trait too.
Traits
Constants
| private FACADE_METHODS |
The batch methods of each facade, keyed by its alias. |
| private RECEIVER_METHODS |
The batch methods each receiver type provides. Unlike upstream, which checks only Bus::batch(), adding jobs to a batch needs the trait too. |
Methods
Get the node type the rule inspects.
Report batched jobs that do not use Batchable.
Details
at line 70
string
getNodeType()
Get the node type the rule inspects.
at line 81
array
processNode(Node $node, Scope $scope)
Report batched jobs that do not use Batchable.