mirror of
https://github.com/barryvdh/ReflectionDocBlock.git
synced 2026-08-18 18:13:13 +00:00
Merge pull request #72 from fabiang/fix-missing-parenthesis
Fix method name is empty when parenthesis is missing in @method
This commit is contained in:
@@ -101,7 +101,9 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
# Method name
|
||||
([\w\|_\\\\]+)
|
||||
# Arguments
|
||||
\(([^\)]*)\)
|
||||
(?:
|
||||
\(([^\)]*)\)
|
||||
)?
|
||||
\s*
|
||||
# Description
|
||||
(.*)
|
||||
@@ -118,21 +120,25 @@ final class Method extends BaseTag implements Factory\StaticMethod
|
||||
$returnType = $typeResolver->resolve($returnType, $context);
|
||||
$description = $descriptionFactory->create($description, $context);
|
||||
|
||||
$arguments = explode(',', $arguments);
|
||||
foreach($arguments as &$argument) {
|
||||
$argument = explode(' ', trim($argument));
|
||||
if ($argument[0][0] === '$') {
|
||||
$argumentName = substr($argument[0], 1);
|
||||
$argumentType = new Void();
|
||||
} else {
|
||||
$argumentType = $typeResolver->resolve($argument[0], $context);
|
||||
$argumentName = '';
|
||||
if (isset($argument[1])) {
|
||||
$argumentName = substr($argument[1], 1);
|
||||
if ('' !== $arguments) {
|
||||
$arguments = explode(',', $arguments);
|
||||
foreach($arguments as &$argument) {
|
||||
$argument = explode(' ', trim($argument));
|
||||
if ($argument[0][0] === '$') {
|
||||
$argumentName = substr($argument[0], 1);
|
||||
$argumentType = new Void();
|
||||
} else {
|
||||
$argumentType = $typeResolver->resolve($argument[0], $context);
|
||||
$argumentName = '';
|
||||
if (isset($argument[1])) {
|
||||
$argumentName = substr($argument[1], 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$argument = [ 'name' => $argumentName, 'type' => $argumentType];
|
||||
$argument = [ 'name' => $argumentName, 'type' => $argumentType];
|
||||
}
|
||||
} else {
|
||||
$arguments = [];
|
||||
}
|
||||
|
||||
return new static($methodName, $arguments, $returnType, $static, $description);
|
||||
|
||||
Reference in New Issue
Block a user