@@ -19,8 +19,7 @@ class Cuit implements Rule
1919 34 ,
2020 ];
2121
22- /* @var $attribute String */
23- protected $ attribute ;
22+ protected string $ attribute ;
2423
2524 /**
2625 * @inheritDoc
@@ -35,18 +34,18 @@ public function passes($attribute, $value): bool
3534 /**
3635 * @inheritDoc
3736 */
38- public function message ()
37+ public function message (): string
3938 {
4039 return static ::replacerMessage ($ this ->attribute );
4140 }
4241
43- public static function validate ($ value ): bool
42+ public static function validate (mixed $ value ): bool
4443 {
45- if (strlen ($ value ) != 11 ) {
44+ if (! is_string ( $ value ) || strlen ($ value ) != = 11 ) {
4645 return false ;
4746 }
4847
49- if (! Str::startsWith ($ value , static ::TYPES )) {
48+ if (!Str::startsWith ($ value , static ::TYPES )) {
5049 return false ;
5150 }
5251
@@ -59,24 +58,24 @@ public static function validate($value): bool
5958 $ multiplier = 2 ;
6059 $ accumulator = 0 ;
6160 foreach ($ digits as $ digit ) {
62- $ accumulator += $ digit * $ multiplier ;
61+ $ accumulator += ( int ) $ digit * $ multiplier ;
6362
6463 $ multiplier = ($ multiplier + 1 ) % 8 ;
6564 $ multiplier = $ multiplier === 0 ? 2 : $ multiplier ;
6665 }
6766
6867 $ calculatedVerifier = 11 - ($ accumulator % 11 );
6968
70- if ($ calculatedVerifier == 11 ) {
69+ if ($ calculatedVerifier === 11 ) {
7170 $ calculatedVerifier = 0 ;
72- } elseif ($ calculatedVerifier == 10 ) {
71+ } elseif ($ calculatedVerifier === 10 ) {
7372 $ calculatedVerifier = 1 ;
7473 }
7574
76- return $ verifier == $ calculatedVerifier ;
75+ return ( int ) $ verifier = == $ calculatedVerifier ;
7776 }
7877
79- public static function replacerMessage ($ attribute )
78+ public static function replacerMessage (string $ attribute ): string
8079 {
8180 return __ ('iutrace::validation.cuit ' , [
8281 'attribute ' => $ attribute ,
0 commit comments