Skip to content

Commit ccd1006

Browse files
committed
Adjusting LogicalRule to create a new collection when constructed
1 parent 350f7b7 commit ccd1006

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/Validation/Logic/LogicalRule.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,21 @@
88

99
abstract class LogicalRule implements RuleGroup, RuleEvaluator
1010
{
11-
/** @var ?Collection<array-key, RuleEvaluator> */
12-
protected ?Collection $_rules = null;
11+
/** @var Collection<array-key, RuleEvaluator> */
12+
protected Collection $_rules;
1313

1414
/** @var Collection<array-key, RuleEvaluator> */
1515
public Collection $rules {
1616
get {
17-
return $this->_rules ??= new Collection();
17+
return $this->_rules;
1818
}
1919
}
2020

21+
public function __construct()
22+
{
23+
$this->_rules = new Collection();
24+
}
25+
2126
public function addRule(RuleEvaluator $rule): static
2227
{
2328
$this->rules->push($rule);

0 commit comments

Comments
 (0)