Skip to content

Commit 6c0be0c

Browse files
author
Dan Cryer
committed
Fixing \Exception vs Exception detection.
1 parent 4e5c7ef commit 6c0be0c

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

PhpDocblockChecker/FileProcessor.php

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,25 @@ protected function processStatements(array $statements, $prefix = '')
9393

9494
$fullMethodName = $fullClassName . '::' . (string)$method->name;
9595

96+
$type = $method->returnType;
97+
98+
if (!is_null($type)) {
99+
$type = (string)$type;
100+
}
101+
102+
if (isset($uses[$type])) {
103+
$type = $uses[$type];
104+
}
105+
106+
$type = substr($type, 0, 1) == '/' ? substr($type, 1) : $type;
107+
108+
96109
$thisMethod = [
97110
'file' => $this->file,
98111
'class' => $fullClassName,
99112
'name' => $fullMethodName,
100113
'line' => $method->getAttribute('startLine'),
101-
'return' => is_null($method->returnType) ? null : (string)$method->returnType,
114+
'return' => $type,
102115
'params' => [],
103116
'docblock' => $this->getDocblock($method, $uses),
104117
];
@@ -114,6 +127,8 @@ protected function processStatements(array $statements, $prefix = '')
114127
$type = $uses[$type];
115128
}
116129

130+
$type = substr($type, 0, 1) == '/' ? substr($type, 1) : $type;
131+
117132
$thisMethod['params']['$'.$param->name] = $type;
118133
}
119134

@@ -168,6 +183,8 @@ protected function processDocblock($text, array $uses = [])
168183
$type = $uses[$type];
169184
}
170185

186+
$type = substr($type, 0, 1) == '/' ? substr($type, 1) : $type;
187+
171188
$rtn['params'][$param['var']] = $type;
172189
}
173190
}
@@ -185,6 +202,8 @@ protected function processDocblock($text, array $uses = [])
185202
$type = $uses[$type];
186203
}
187204

205+
$type = substr($type, 0, 1) == '/' ? substr($type, 1) : $type;
206+
188207
$rtn['return'] = $type;
189208
}
190209

0 commit comments

Comments
 (0)