summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsko Nomm <asko@bien.ee>2022-02-27 21:07:52 +0100
committerAsko Nomm <asko@bien.ee>2022-02-27 21:07:52 +0100
commitdbacaf305b8f4a5792e3d327d3ba98ecf06b04e0 (patch)
treecdebe595e145a74653236150d7425ba640bc4a8f
parent96bef73aa85e49e821328d162e963f80e675fa35 (diff)
Validate in fails(), not in constructor
Because otherwise we won't have the ability to register new validators.
-rw-r--r--src/Hird.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/Hird.php b/src/Hird.php
index 1671619..305356c 100644
--- a/src/Hird.php
+++ b/src/Hird.php
@@ -52,7 +52,6 @@ class Hird
private array $rules,
) {
$this->registerDefaultValidators();
- $this->validate();
}
/**
@@ -126,6 +125,8 @@ class Hird
*/
public function fails(): bool
{
+ $this->validate();
+
return count($this->errors) !== 0;
}