Skip to content

Commit d2fff71

Browse files
committed
add prop to nearest class def
1 parent 3e62a47 commit d2fff71

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

app/Contexts/AbstractContext.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ public function searchForVar(string $name): AssignmentValue|string|null
117117
return $this->parent?->searchForVar($name) ?? null;
118118
}
119119

120+
public function addPropertyToNearestClassDefinition(string $name, $types = [])
121+
{
122+
if ($this instanceof ClassDefinition) {
123+
$this->properties[] = [
124+
'name' => $name,
125+
'types' => $types,
126+
];
127+
} else {
128+
$this->parent?->addPropertyToNearestClassDefinition($name, $types);
129+
}
130+
}
131+
120132
public function searchForProperty(string $name)
121133
{
122134
if ($this instanceof ClassDefinition) {

0 commit comments

Comments
 (0)