@@ -136,11 +136,31 @@ private static function convertAnnotationValidationToValidatorString(string $val
136136 return "new StringValidator() " ;
137137 }
138138
139+ ///TODO: this ignores nullability
140+ if (str_ends_with ($ validation , "|null " )) {
141+ $ validation = substr ($ validation , 0 , -5 );
142+ }
143+
139144 switch ($ validation ) {
140145 case "email " :
146+ // there is one occurrence of this
147+ case "email:1.. " :
141148 return "new EmailValidator() " ;
149+ case "numericint " :
150+ return "new IntValidator() " ;
151+ case "bool " :
152+ case "boolean " :
153+ return "new BoolValidator() " ;
154+ case "array " :
155+ case "list " :
156+ return "new ArrayValidator() " ;
157+ case "timestamp " :
158+ return "new TimestampValidator() " ;
159+ case "numeric " :
160+ return "new FloatValidator() " ;
142161 default :
143162 ///TODO
163+ var_dump ("unsupported: $ validation " );
144164 return "\"UNSUPPORTED \"" ;
145165 }
146166 }
@@ -165,6 +185,11 @@ public static function convertFile(string $path)
165185 $ lines [] = "use App\Helpers\MetaFormats\Validators\StringValidator; " ;
166186 $ lines [] = "use App\Helpers\MetaFormats\Validators\EmailValidator; " ;
167187 $ lines [] = "use App\Helpers\MetaFormats\Validators\UuidValidator; " ;
188+ $ lines [] = "use App\Helpers\MetaFormats\Validators\BoolValidator; " ;
189+ $ lines [] = "use App\Helpers\MetaFormats\Validators\ArrayValidator; " ;
190+ $ lines [] = "use App\Helpers\MetaFormats\Validators\FloatValidator; " ;
191+ $ lines [] = "use App\Helpers\MetaFormats\Validators\IntValidator; " ;
192+ $ lines [] = "use App\Helpers\MetaFormats\Validators\TimestampValidator; " ;
168193 $ lines [] = $ line ;
169194 $ usingsAdded = true ;
170195 // store attribute lines in the buffer and do not write them
0 commit comments