class UniqueJobDeclaresUniqueIdRule implements Rule

A parameterized job implementing ShouldBeUnique must declare uniqueId, either as a method (public function uniqueId(): string) or a property (public $uniqueId).

Hypervel builds the uniqueness lock key as laravel_unique_job:<class>:<uniqueId> and falls back to an empty uniqueId when neither is declared (see Hypervel\Bus\UniqueLock::getKey()). For a job that carries no distinguishing state that empty key is correct: the class is a singleton, only one may run at a time. But for a job whose constructor takes arguments (per company, per product, ...) the empty key collapses every dispatch into one unique job regardless of those arguments, so legitimately distinct jobs are silently dropped at dispatch with no error.

The rule therefore fires only when the job has a constructor with at least one parameter. A genuinely class wide unique job satisfies it by declaring uniqueId() returning a constant, which makes that intent explicit.

Traits

Methods

string
getNodeType()

Get the node type the rule inspects.

array
processNode(Node $node, Scope $scope)

Report a parameterized unique job that does not declare its identity.

Details

at line 49
string getNodeType()

Get the node type the rule inspects.

Return Value

string

at line 60
array processNode(Node $node, Scope $scope)

Report a parameterized unique job that does not declare its identity.

Parameters

Node $node
Scope $scope

Return Value

array