@@ -14,8 +14,9 @@ |
||
| 14 | 14 | * @throws Exception |
| 15 | 15 | */ |
| 16 | 16 | public function __construct($fqcn, $description = null) { |
| 17 | - if (!$this->isValidClassName($fqcn)) |
|
| 18 | - throw new Exception("No such class: {$fqcn}"); |
|
| 17 | + if (!$this->isValidClassName($fqcn)) { |
|
| 18 | + throw new Exception("No such class: {$fqcn}"); |
|
| 19 | + } |
|
| 19 | 20 | |
| 20 | 21 | $this->fqcn = $fqcn; |
| 21 | 22 | $this->description = $description ?? "Must be an instance of {$fqcn}"; |
@@ -11,13 +11,18 @@ |
||
| 11 | 11 | const DEFAULT_DESCRIPTION = 'Must be iterable'; |
| 12 | 12 | |
| 13 | 13 | public function __construct($description = null) { |
| 14 | - if (!is_null($description)) |
|
| 15 | - $this->description = $description; |
|
| 14 | + if (!is_null($description)) { |
|
| 15 | + $this->description = $description; |
|
| 16 | + } |
|
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | public function validate($value): bool { |
| 19 | - if (is_array($value)) return true; |
|
| 20 | - if (is_object($value) && $value instanceof \Traversable) return true; |
|
| 20 | + if (is_array($value)) { |
|
| 21 | + return true; |
|
| 22 | + } |
|
| 23 | + if (is_object($value) && $value instanceof \Traversable) { |
|
| 24 | + return true; |
|
| 25 | + } |
|
| 21 | 26 | return false; |
| 22 | 27 | } |
| 23 | 28 | |
@@ -14,8 +14,9 @@ |
||
| 14 | 14 | * @throws Exception |
| 15 | 15 | */ |
| 16 | 16 | public function __construct($pattern, $description = null) { |
| 17 | - if (!$this->isValidRegexPattern($pattern)) |
|
| 18 | - throw new Exception("Invalid Regex pattern: {$pattern}"); |
|
| 17 | + if (!$this->isValidRegexPattern($pattern)) { |
|
| 18 | + throw new Exception("Invalid Regex pattern: {$pattern}"); |
|
| 19 | + } |
|
| 19 | 20 | $this->pattern = $pattern; |
| 20 | 21 | $this->message = $description ?? "Must match pattern: {$pattern}"; |
| 21 | 22 | } |