mirror of
https://github.com/Respect/Validation.git
synced 2024-06-03 06:12:17 +02:00
Apply "Squiz.WhiteSpace.OperatorSpacing"
Signed-off-by: Henrique Moody <henriquemoody@gmail.com>
This commit is contained in:
parent
8e59ec5d4a
commit
0e0581a9da
|
@ -54,8 +54,7 @@ final class Cnh extends AbstractRule
|
|||
return false;
|
||||
}
|
||||
|
||||
if ($input[10] != (((($dv2 = ($s2 % 11) - (($dv1 > 9) ? 2 : 0)) < 0)
|
||||
? $dv2 + 11 : $dv2) > 9) ? 0 : $dv2) {
|
||||
if ($input[10] != (((($dv2 = ($s2 % 11) - (($dv1 > 9) ? 2 : 0)) < 0) ? $dv2 + 11 : $dv2) > 9) ? 0 : $dv2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ final class Cnpj extends AbstractRule
|
|||
|
||||
$n = 0;
|
||||
for ($i = 0; $i < 12; ++$i) {
|
||||
$n += $digits[$i] * $bases[$i+1];
|
||||
$n += $digits[$i] * $bases[$i + 1];
|
||||
}
|
||||
|
||||
if ($digits[12] != ((($n %= 11) < 2) ? 0 : 11 - $n)) {
|
||||
|
|
|
@ -68,8 +68,10 @@ final class EndsWith extends AbstractRule
|
|||
return end($input) == $this->endValue;
|
||||
}
|
||||
|
||||
return mb_strripos($input, $this->endValue, -1, $enc = mb_detect_encoding($input))
|
||||
=== mb_strlen($input, $enc) - mb_strlen($this->endValue, $enc);
|
||||
$encoding = mb_detect_encoding($input);
|
||||
$endPosition = mb_strlen($input, $encoding) - mb_strlen($this->endValue, $encoding);
|
||||
|
||||
return mb_strripos($input, $this->endValue, -1, $encoding) === $endPosition;
|
||||
}
|
||||
|
||||
private function validateIdentical($input): bool
|
||||
|
@ -78,7 +80,9 @@ final class EndsWith extends AbstractRule
|
|||
return end($input) === $this->endValue;
|
||||
}
|
||||
|
||||
return mb_strrpos($input, $this->endValue, 0, $enc = mb_detect_encoding($input))
|
||||
=== mb_strlen($input, $enc) - mb_strlen($this->endValue, $enc);
|
||||
$encoding = mb_detect_encoding($input);
|
||||
$endPosition = mb_strlen($input, $encoding) - mb_strlen($this->endValue, $encoding);
|
||||
|
||||
return mb_strrpos($input, $this->endValue, 0, $encoding) === $endPosition;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -75,4 +75,5 @@
|
|||
<property name="spacingBeforeFirst" value="0" />
|
||||
</properties>
|
||||
</rule>
|
||||
<rule ref="Squiz.WhiteSpace.OperatorSpacing" />
|
||||
</ruleset>
|
||||
|
|
|
@ -63,7 +63,7 @@ final class FactorTest extends RuleTestCase
|
|||
'6 is factor \'2\'' => [new Factor(6), '2'],
|
||||
'4 is factor 2.00' => [new Factor(4), 2.0],
|
||||
'-0 is factor -5.000000' => [new Factor(-0), -5.000000],
|
||||
'-0 is factor (float) -mt_rand()' => [new Factor(-0), (float) -mt_rand()],
|
||||
'-0 is factor (float) - mt_rand()' => [new Factor(-0), (float) - mt_rand()],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue