Skip to content

Commit 3e62a47

Browse files
committed
capture promoted constructor properties
1 parent fb2dcf9 commit 3e62a47

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/Parsers/ParameterParser.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ public function parse(NodeParameter $node)
1919
{
2020
$this->context->name = $node->getName();
2121

22+
$constructorProperty = $node->visibilityToken !== null;
23+
2224
if (!$node->typeDeclarationList) {
25+
if ($constructorProperty) {
26+
$this->context->addPropertyToNearestClassDefinition($this->context->name);
27+
}
28+
2329
return $this->context->value;
2430
}
2531

@@ -31,6 +37,10 @@ public function parse(NodeParameter $node)
3137
}
3238
}
3339

40+
if ($constructorProperty) {
41+
$this->context->addPropertyToNearestClassDefinition($this->context->name, $this->context->types);
42+
}
43+
3444
return $this->context->value;
3545
}
3646

0 commit comments

Comments
 (0)