@@ -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 | }) |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | public static function getLengthIsCheck(IntegerRuleInterface $rule): CheckInterface |
106 | 106 | { |
107 | 107 | return CheckBuilder::create(CheckName::LENGTH_IS) |
108 | - ->withPredicate(static function ($value) use ($rule) { |
|
108 | + ->withPredicate(static function($value) use ($rule) { |
|
109 | 109 | /** @var \Countable $value */ |
110 | 110 | $rule->validate(\count($value)); |
111 | 111 | return true; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | public static function getHasOptionalAttributeCheck(string $name, MixedRuleInterface $rule): CheckInterface |
126 | 126 | { |
127 | 127 | return CheckBuilder::create(CheckName::HAS_ATTRIBUTE) |
128 | - ->withPredicate(static function ($value, string $name) use ($rule) { |
|
128 | + ->withPredicate(static function($value, string $name) use ($rule) { |
|
129 | 129 | if (!ContainerAccessHelper::hasAccessibleAttribute($value, $name)) { |
130 | 130 | return true; |
131 | 131 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public static function getAttributeIsCheck(string $name, MixedRuleInterface $rule): CheckInterface |
140 | 140 | { |
141 | 141 | return CheckBuilder::create(CheckName::ATTRIBUTE_IS) |
142 | - ->withPredicate(static function ($value, string $name) use ($rule) { |
|
142 | + ->withPredicate(static function($value, string $name) use ($rule) { |
|
143 | 143 | $rule->validate(ContainerAccessHelper::getAttributeValue($value, $name)); |
144 | 144 | return true; |
145 | 145 | }) |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | public static function getValueByIndexCheck(int $index, MixedRuleInterface $rule): CheckInterface |
161 | 161 | { |
162 | 162 | return CheckBuilder::create(CheckName::VALUE_BY_INDEX) |
163 | - ->withPredicate(static function ($value, int $index) use ($rule) { |
|
163 | + ->withPredicate(static function($value, int $index) use ($rule) { |
|
164 | 164 | $rule->validate($value[$index]); |
165 | 165 | return true; |
166 | 166 | }) |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public static function getAllKeysAreCheck(MixedRuleInterface $rule): CheckInterface |
173 | 173 | { |
174 | 174 | return CheckBuilder::create(CheckName::ALL_KEYS_ARE) |
175 | - ->withPredicate(static function ($value) use ($rule) { |
|
175 | + ->withPredicate(static function($value) use ($rule) { |
|
176 | 176 | foreach ($value as $k => $v) { |
177 | 177 | $rule->validate($k); |
178 | 178 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | public static function getAllValuesAreCheck(MixedRuleInterface $rule): CheckInterface |
186 | 186 | { |
187 | 187 | return CheckBuilder::create(CheckName::ALL_VALUES_ARE) |
188 | - ->withPredicate(static function ($value) use ($rule) { |
|
188 | + ->withPredicate(static function($value) use ($rule) { |
|
189 | 189 | foreach ($value as $v) { |
190 | 190 | $rule->validate($v); |
191 | 191 | } |