Skip to content

Commit

Permalink
Fix missing scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Dec 15, 2023
1 parent 3b4b2be commit a7af4ea
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,9 @@ public static function removeAttributeFromRule(array $rule, string $attributeToR
$attributes = Collection::wrap($rule[0])
->reject(fn($attribute) => $attribute === $attributeToRemove);

if ($attributes->isEmpty()) {
return null;
}

// We may end up with a rule with an empty array of attributes.
// We still need to keep that rule around so any potential
// scenarios get defined from the 'on' key.
$rule[0] = $attributes->all();

return $rule;
Expand All @@ -56,7 +55,6 @@ public static function removeAttributeFromRules(array $rules, string $attributeT
{
return Collection::make($rules)
->map(fn($rule) => Helper::removeAttributeFromRule($rule, $attributeToRemove))
->filter()
->all();
}

Expand Down
Loading

0 comments on commit a7af4ea

Please sign in to comment.