File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -90,6 +90,14 @@ protected function generateColumnRules(stdClass $column): array
9090 $ columnRules [] = "integer " ;
9191 $ sign = ($ type ->contains ('unsigned ' )) ? 'unsigned ' : 'signed ' ;
9292 $ intType = $ type ->before (' unsigned ' )->__toString ();
93+
94+ // prevent int(xx) for mysql
95+ $ intType = preg_replace ("/\([^)]+\)/ " , "" , $ intType );
96+
97+ if (!array_key_exists ($ intType , self ::$ integerTypes )){
98+ $ intType = "int " ;
99+ }
100+
93101 $ columnRules [] = "min: " .self ::$ integerTypes [$ intType ][$ sign ][0 ];
94102 $ columnRules [] = "max: " .self ::$ integerTypes [$ intType ][$ sign ][1 ];
95103
@@ -109,7 +117,7 @@ protected function generateColumnRules(stdClass $column): array
109117 $ columnRules [] = 'in: ' .implode (', ' , $ matches [1 ]);
110118
111119 break ;
112- case $ type == 'year ' :
120+ case $ type-> contains ( 'year ' ) :
113121 $ columnRules [] = 'integer ' ;
114122 $ columnRules [] = 'min:1901 ' ;
115123 $ columnRules [] = 'max:2155 ' ;
You can’t perform that action at this time.
0 commit comments