@@ -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 | }) |
@@ -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; |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | public static function getLengthIsCheck(IntegerRuleInterface $rule): CheckInterface |
| 109 | 109 | { |
| 110 | 110 | return CheckBuilder::create(CheckName::LENGTH_IS) |
| 111 | - ->withPredicate(static function ($value) use ($rule) { |
|
| 111 | + ->withPredicate(static function($value) use ($rule) { |
|
| 112 | 112 | /** @var \Countable $value */ |
| 113 | 113 | $rule->validate(\count($value)); |
| 114 | 114 | return true; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | public static function getHasOptionalAttributeCheck(string $name, MixedRuleInterface $rule): CheckInterface |
| 129 | 129 | { |
| 130 | 130 | return CheckBuilder::create(CheckName::ATTRIBUTE_IS) |
| 131 | - ->withPredicate(static function ($value, string $name) use ($rule) { |
|
| 131 | + ->withPredicate(static function($value, string $name) use ($rule) { |
|
| 132 | 132 | if (!ContainerAccessHelper::hasAccessibleAttribute($value, $name)) { |
| 133 | 133 | return true; |
| 134 | 134 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | public static function getAttributeIsCheck(string $name, MixedRuleInterface $rule): CheckInterface |
| 143 | 143 | { |
| 144 | 144 | return CheckBuilder::create(CheckName::ATTRIBUTE_IS) |
| 145 | - ->withPredicate(static function ($value, string $name) use ($rule) { |
|
| 145 | + ->withPredicate(static function($value, string $name) use ($rule) { |
|
| 146 | 146 | $rule->validate(ContainerAccessHelper::getAttributeValue($value, $name)); |
| 147 | 147 | return true; |
| 148 | 148 | }) |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | public static function getValueByIndexIsCheck(int $index, MixedRuleInterface $rule): CheckInterface |
| 164 | 164 | { |
| 165 | 165 | return CheckBuilder::create(CheckName::VALUE_BY_INDEX_IS) |
| 166 | - ->withPredicate(static function ($value, int $index) use ($rule) { |
|
| 166 | + ->withPredicate(static function($value, int $index) use ($rule) { |
|
| 167 | 167 | $rule->validate($value[$index]); |
| 168 | 168 | return true; |
| 169 | 169 | }) |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | public static function getAllKeysAreCheck(MixedRuleInterface $rule): CheckInterface |
| 176 | 176 | { |
| 177 | 177 | return CheckBuilder::create(CheckName::ALL_KEYS_ARE) |
| 178 | - ->withPredicate(static function ($value) use ($rule) { |
|
| 178 | + ->withPredicate(static function($value) use ($rule) { |
|
| 179 | 179 | foreach ($value as $k => $v) { |
| 180 | 180 | $rule->validate($k); |
| 181 | 181 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | public static function getSomeKeyIsCheck(MixedRuleInterface $rule): CheckInterface |
| 189 | 189 | { |
| 190 | 190 | return CheckBuilder::create(CheckName::SOME_KEY_IS) |
| 191 | - ->withPredicate(static function ($value) use ($rule) { |
|
| 191 | + ->withPredicate(static function($value) use ($rule) { |
|
| 192 | 192 | $errorMap = []; |
| 193 | 193 | foreach ($value as $k => $v) { |
| 194 | 194 | try { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | public static function getAllValuesAreCheck(MixedRuleInterface $rule): CheckInterface |
| 215 | 215 | { |
| 216 | 216 | return CheckBuilder::create(CheckName::ALL_VALUES_ARE) |
| 217 | - ->withPredicate(static function ($value) use ($rule) { |
|
| 217 | + ->withPredicate(static function($value) use ($rule) { |
|
| 218 | 218 | foreach ($value as $v) { |
| 219 | 219 | $rule->validate($v); |
| 220 | 220 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | public static function getSomeValueIsCheck(MixedRuleInterface $rule): CheckInterface |
| 228 | 228 | { |
| 229 | 229 | return CheckBuilder::create(CheckName::SOME_VALUE_IS) |
| 230 | - ->withPredicate(static function ($value) use ($rule) { |
|
| 230 | + ->withPredicate(static function($value) use ($rule) { |
|
| 231 | 231 | $errorMap = []; |
| 232 | 232 | foreach ($value as $v) { |
| 233 | 233 | try { |