77/**
88 * CakePHP validation error convert.
99 */
10- final class CakeValidationConverter
10+ final class CakeValidationValidationConverter implements ValidationConverterInterface
1111{
1212 /**
1313 * Create validation result from array with errors.
1414 *
15- * @param array<mixed> $errors The validation errors
15+ * @param array $errors The validation errors
1616 *
1717 * @return ValidationResult The result
1818 */
19- public static function createValidationResult (array $ errors ): ValidationResult
19+ public function createValidationResult ($ errors ): ValidationResult
2020 {
2121 $ result = new ValidationResult ();
2222
23- static :: addErrors ($ result , $ errors );
23+ $ this -> addErrors ($ result , ( array ) $ errors );
2424
2525 return $ result ;
2626 }
@@ -29,15 +29,17 @@ public static function createValidationResult(array $errors): ValidationResult
2929 * Add errors.
3030 *
3131 * @param ValidationResult $result The result
32- * @param array<mixed> $errors The errors
32+ * @param array $errors The errors
3333 * @param string $path The path
34+ *
35+ * @return void
3436 */
35- private static function addErrors (ValidationResult $ result , array $ errors , string $ path = '' ): void
37+ private function addErrors (ValidationResult $ result , array $ errors , string $ path = '' ): void
3638 {
3739 foreach ($ errors as $ field => $ error ) {
3840 $ oldPath = $ path ;
3941 $ path .= ($ path === '' ? '' : '. ' ) . $ field ;
40- static :: addSubErrors ($ result , $ error , $ path );
42+ $ this -> addSubErrors ($ result , $ error , $ path );
4143 $ path = $ oldPath ;
4244 }
4345 }
@@ -46,14 +48,16 @@ private static function addErrors(ValidationResult $result, array $errors, strin
4648 * Add sub errors.
4749 *
4850 * @param ValidationResult $result The result
49- * @param array<mixed> $error The error
51+ * @param array $error The error
5052 * @param string $path The path
53+ *
54+ * @return void
5155 */
52- private static function addSubErrors (ValidationResult $ result , array $ error , string $ path = '' ): void
56+ private function addSubErrors (ValidationResult $ result , array $ error , string $ path = '' ): void
5357 {
5458 foreach ($ error as $ field2 => $ errorMessage ) {
5559 if (is_array ($ errorMessage )) {
56- static :: addErrors ($ result , [$ field2 => $ errorMessage ], $ path );
60+ $ this -> addErrors ($ result , [$ field2 => $ errorMessage ], $ path );
5761 } else {
5862 $ result ->addError ($ path , $ errorMessage );
5963 }
0 commit comments