@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return CompositeRuleInterface |
102 | 102 | */ |
103 | - public static function anyOf(array $rules, string $name = RuleName::OR): CompositeRuleInterface |
|
103 | + public static function anyOf(array $rules, string $name = RuleName:: OR ): CompositeRuleInterface |
|
104 | 104 | { |
105 | 105 | return new AnyOfRule($rules, $name); |
106 | 106 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * |
112 | 112 | * @return CompositeRuleInterface |
113 | 113 | */ |
114 | - public static function allOf(array $rules, string $name = RuleName::AND): CompositeRuleInterface |
|
114 | + public static function allOf(array $rules, string $name = RuleName:: AND ): CompositeRuleInterface |
|
115 | 115 | { |
116 | 116 | return new AllOfRule($rules, $name); |
117 | 117 | } |
@@ -163,14 +163,14 @@ discard block |
||
163 | 163 | public static function getFractionalCheck(): CheckInterface |
164 | 164 | { |
165 | 165 | return CheckBuilder::create(CheckName::FRACTIONAL) |
166 | - ->withPredicate(fn($value) => \abs($value - \round(\floatval($value))) >= \PHP_FLOAT_EPSILON) |
|
166 | + ->withPredicate(fn($value) => \abs($value-\round(\floatval($value))) >= \PHP_FLOAT_EPSILON) |
|
167 | 167 | ->build(); |
168 | 168 | } |
169 | 169 | |
170 | 170 | public static function getNonFractionalCheck(): CheckInterface |
171 | 171 | { |
172 | 172 | return CheckBuilder::create(CheckName::NON_FRACTIONAL) |
173 | - ->withPredicate(fn($value) => \abs($value - \round(\floatval($value))) < \PHP_FLOAT_EPSILON) |
|
173 | + ->withPredicate(fn($value) => \abs($value-\round(\floatval($value))) < \PHP_FLOAT_EPSILON) |
|
174 | 174 | ->build(); |
175 | 175 | } |
176 | 176 | |
@@ -191,14 +191,14 @@ discard block |
||
191 | 191 | public static function getEvenCheck(): CheckInterface |
192 | 192 | { |
193 | 193 | return CheckBuilder::create(CheckName::EVEN) |
194 | - ->withPredicate(fn($value) => $value % 2 === 0) |
|
194 | + ->withPredicate(fn($value) => $value%2 === 0) |
|
195 | 195 | ->build(); |
196 | 196 | } |
197 | 197 | |
198 | 198 | public static function getOddCheck(): CheckInterface |
199 | 199 | { |
200 | 200 | return CheckBuilder::create(CheckName::ODD) |
201 | - ->withPredicate(fn($value) => $value % 2 !== 0) |
|
201 | + ->withPredicate(fn($value) => $value%2 !== 0) |
|
202 | 202 | ->build(); |
203 | 203 | } |
204 | 204 |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | public static function getEndsWithCheck(string $substr): CheckInterface |
65 | 65 | { |
66 | 66 | return CheckBuilder::create(CheckName::ENDS_WITH) |
67 | - ->withPredicate(static function ($value, string $substr) { |
|
68 | - return \substr($value, \mb_strlen($value) - \mb_strlen($substr)) === $substr; |
|
67 | + ->withPredicate(static function($value, string $substr) { |
|
68 | + return \substr($value, \mb_strlen($value)-\mb_strlen($substr)) === $substr; |
|
69 | 69 | }) |
70 | 70 | ->withParams(['substring' => $substr]) |
71 | 71 | ->build(); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public static function getLengthIsCheck(IntegerRuleInterface $rule): CheckInterface |
75 | 75 | { |
76 | 76 | return CheckBuilder::create(CheckName::LENGTH_IS) |
77 | - ->withPredicate(static function ($value) use ($rule) { |
|
77 | + ->withPredicate(static function($value) use ($rule) { |
|
78 | 78 | $rule->validate(\mb_strlen($value)); |
79 | 79 | return true; |
80 | 80 | }) |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | public static function getLengthIsCheck(IntegerRuleInterface $rule): CheckInterface |
108 | 108 | { |
109 | 109 | return CheckBuilder::create(CheckName::LENGTH_IS) |
110 | - ->withPredicate(static function ($value) use ($rule) { |
|
110 | + ->withPredicate(static function($value) use ($rule) { |
|
111 | 111 | /** @var \Countable $value */ |
112 | 112 | $rule->validate(\count($value)); |
113 | 113 | return true; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | public static function getHasOptionalAttributeCheck(string $name, MixedRuleInterface $rule): CheckInterface |
128 | 128 | { |
129 | 129 | return CheckBuilder::create(CheckName::ATTRIBUTE_IS) |
130 | - ->withPredicate(static function ($value, string $name) use ($rule) { |
|
130 | + ->withPredicate(static function($value, string $name) use ($rule) { |
|
131 | 131 | if (!ContainerAccessHelper::hasAccessibleAttribute($value, $name)) { |
132 | 132 | return true; |
133 | 133 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | public static function getAttributeIsCheck(string $name, MixedRuleInterface $rule): CheckInterface |
142 | 142 | { |
143 | 143 | return CheckBuilder::create(CheckName::ATTRIBUTE_IS) |
144 | - ->withPredicate(static function ($value, string $name) use ($rule) { |
|
144 | + ->withPredicate(static function($value, string $name) use ($rule) { |
|
145 | 145 | $rule->validate(ContainerAccessHelper::getAttributeValue($value, $name)); |
146 | 146 | return true; |
147 | 147 | }) |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public static function getValueByIndexCheck(int $index, MixedRuleInterface $rule): CheckInterface |
163 | 163 | { |
164 | 164 | return CheckBuilder::create(CheckName::VALUE_BY_INDEX_IS) |
165 | - ->withPredicate(static function ($value, int $index) use ($rule) { |
|
165 | + ->withPredicate(static function($value, int $index) use ($rule) { |
|
166 | 166 | $rule->validate($value[$index]); |
167 | 167 | return true; |
168 | 168 | }) |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | public static function getAllKeysAreCheck(MixedRuleInterface $rule): CheckInterface |
175 | 175 | { |
176 | 176 | return CheckBuilder::create(CheckName::ALL_KEYS_ARE) |
177 | - ->withPredicate(static function ($value) use ($rule) { |
|
177 | + ->withPredicate(static function($value) use ($rule) { |
|
178 | 178 | foreach ($value as $k => $v) { |
179 | 179 | $rule->validate($k); |
180 | 180 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | public static function getAllValuesAreCheck(MixedRuleInterface $rule): CheckInterface |
188 | 188 | { |
189 | 189 | return CheckBuilder::create(CheckName::ALL_VALUES_ARE) |
190 | - ->withPredicate(static function ($value) use ($rule) { |
|
190 | + ->withPredicate(static function($value) use ($rule) { |
|
191 | 191 | foreach ($value as $v) { |
192 | 192 | $rule->validate($v); |
193 | 193 | } |
@@ -120,7 +120,7 @@ |
||
120 | 120 | public function dontStopOnViolation(): self |
121 | 121 | { |
122 | 122 | if (\count($this->checks) > 0) { |
123 | - $this->checks[\count($this->checks) - 1]->setInterrupting(false); |
|
123 | + $this->checks[\count($this->checks)-1]->setInterrupting(false); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $this; |