Skip to content

Commit f5c8428

Browse files
committed
Fix property type resolution to work with the new PHPParser API
1 parent c4abab4 commit f5c8428

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/collector/backend/parser/UnitCollectingVisitor.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,15 @@ private function processMethod(NodeType\ClassMethod $node) {
234234
$visibility = 'protected';
235235
}
236236
$method->setVisibility($visibility);
237+
237238
$docComment = $node->getDocComment();
238239
if ($docComment !== NULL) {
239240
$block = $this->docBlockParser->parse($docComment, $this->aliasMap);
240241
$method->setDocBlock($block);
241242
}
243+
242244
$this->processMethodParams($method, $node->params);
245+
243246
if ($node->stmts) {
244247
$this->processInlineComments($method, $node->stmts);
245248
}
@@ -270,7 +273,6 @@ private function processMethodParams(MethodObject $method, array $params) {
270273
$this->setVariableType($parameter, $param->type);
271274
$this->setVariableDefaultValue($parameter, $param->default);
272275
}
273-
//die();
274276
}
275277

276278
private function processClassConstant(NodeType\ClassConst $node) {
@@ -295,8 +297,9 @@ private function processClassConstant(NodeType\ClassConst $node) {
295297
private function processProperty(NodeType\Property $node) {
296298
$property = $node->props[0];
297299
$member = $this->unit->addMember($property->name);
298-
$this->setVariableType($member, $node->type);
299-
$this->setVariableDefaultValue($member, $property->default);
300+
if ($node->props[0]->default) {
301+
$this->setVariableDefaultValue($member, $node->props[0]->default);
302+
}
300303
$visibility = 'public';
301304
if ($node->isPrivate()) {
302305
$visibility = 'private';

0 commit comments

Comments
 (0)