Skip to content

Commit

Permalink
Remove object rule caching
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenvanassche committed Jun 25, 2024
1 parent 609bd9e commit d2780f2
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Attributes/Validation/Dimensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function getRule(ValidationPath $path): object|string
$rule->ratio($ratio);
}

return $this->rule = $rule;
return $rule;
}

public static function keyword(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Attributes/Validation/Enum.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function getRule(ValidationPath $path): object|string
return $this->rule;
}

return $this->rule = $this->enum instanceof EnumRule
return $this->enum instanceof EnumRule
? $this->enum
: new EnumRule((string) $this->enum);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Attributes/Validation/Exists.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function getRule(ValidationPath $path): object|string
$rule->where($this->where);
}

return $this->rule = $rule;
return $rule;
}

public static function keyword(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Attributes/Validation/In.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function getRule(ValidationPath $path): object|string
Arr::flatten($this->values)
);

return $this->rule = new BaseIn($this->values);
return new BaseIn($this->values);
}

public static function keyword(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Attributes/Validation/NotIn.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ public function getRule(ValidationPath $path): object|string
}

if (count($this->values) === 1 && $this->values[0] instanceof BaseNotIn) {
return $this->rule = $this->values[0];
return $this->values[0];
}

$this->values = array_map(
fn (string|RouteParameterReference $value) => $this->normalizePossibleRouteReferenceParameter($value),
Arr::flatten($this->values)
);

return $this->rule = new BaseNotIn($this->values);
return new BaseNotIn($this->values);
}

public static function keyword(): string
Expand Down
4 changes: 2 additions & 2 deletions src/Attributes/Validation/Password.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function getRule(ValidationPath $path): object|string
$default = $this->normalizePossibleRouteReferenceParameter($this->default);

if ($default && $this->rule === null) {
return $this->rule = BasePassword::default();
return BasePassword::default();
}

$rule = BasePassword::min($min);
Expand All @@ -66,7 +66,7 @@ public function getRule(ValidationPath $path): object|string
$rule->uncompromised($uncompromisedThreshold);
}

return $this->rule = $rule;
return $rule;
}

public static function keyword(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Attributes/Validation/Unique.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function getRule(ValidationPath $path): object|string
$rule->where($this->where);
}

return $this->rule = $rule;
return $rule;
}

public static function keyword(): string
Expand Down

0 comments on commit d2780f2

Please sign in to comment.