File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,11 @@ public function appendRequestRules(array $controllersInfo)
130
130
try {
131
131
$ controllersInfo [$ index ]['rules ' ] = $ this ->flattenRules ($ requestClass ->rules ());
132
132
} catch (Exception $ e ) {
133
- $ controllersInfo [$ index ]['rules ' ] = $ this ->rulesByRegex ($ requestClassName );
133
+ // disabled. This only works when the rules are defined as 'required|integer' and that too in single line
134
+ // doesn't work well when the same rule is defined as array ['required', 'integer'] or in multiple lines such as
135
+ // If your rules are not populated using this library, then fix your rule to only throw validation errors and not throw exceptions
136
+ // such as 404, 500 inside the request class.
137
+ // $controllersInfo[$index]['rules'] = $this->rulesByRegex($requestClassName);
134
138
}
135
139
$ controllersInfo [$ index ]['docBlock ' ] = $ this ->lrdDocComment ($ reflectionMethod ->getDocComment ());
136
140
}
@@ -196,6 +200,7 @@ public function rulesByRegex($requestClassName)
196
200
$ data = new ReflectionMethod ($ requestClassName , 'rules ' );
197
201
$ lines = file ($ data ->getFileName ());
198
202
$ rules = [];
203
+
199
204
for ($ i = $ data ->getStartLine () - 1 ; $ i <= $ data ->getEndLine () - 1 ; $ i ++) {
200
205
preg_match_all ("/(?:'| \").*?(?:'| \")/ " , $ lines [$ i ], $ matches );
201
206
$ rules [] = $ matches ;
You can’t perform that action at this time.
0 commit comments