1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Standardised laravel validation to be array based

Converted from string-only-based validation.
Array based validation works nicer once you have validation classess or
advanced validation options.
This commit is contained in:
Dan Brown
2021-11-05 00:26:55 +00:00
parent 0ba8541370
commit 06b5009842
26 changed files with 106 additions and 109 deletions

View File

@ -95,17 +95,13 @@ class ApiDocsGenerator
}
$rules = $class->getValdationRules()[$methodName] ?? [];
foreach ($rules as $param => $ruleString) {
$rules[$param] = explode('|', $ruleString);
}
return count($rules) > 0 ? $rules : null;
return empty($rules) ? null : $rules;
}
/**
* Parse out the description text from a class method comment.
*/
protected function parseDescriptionFromMethodComment(string $comment)
protected function parseDescriptionFromMethodComment(string $comment): string
{
$matches = [];
preg_match_all('/^\s*?\*\s((?![@\s]).*?)$/m', $comment, $matches);