Skip to content

Commit 3411cd8

Browse files
committed
Rename treeOf() -> tree()
1 parent cc2345c commit 3411cd8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/php/lang/meta/FromSyntaxTree.class.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ private function anonymous($tree, $start, $end) {
3737
}
3838

3939
/** Returns the syntax tree for a given type using a cache */
40-
private function treeOf($class, $file) {
40+
private function tree($class, $file) {
4141
if (null === ($tree= $this->cache[$file] ?? null)) {
4242
$this->cache[$file]= $tree= self::$lang->parse(new Tokens(file_get_contents($file), $file))->tree();
4343
if (sizeof($this->cache) > self::CACHE_SIZE) unset($this->cache[key($this->cache)]);
@@ -147,7 +147,7 @@ private function parse($code, $resolver) {
147147
}
148148

149149
public function evaluate($arg, $code) {
150-
$tree= $arg instanceof SyntaxTree ? $arg : $this->treeOf($arg, $arg->getFileName());
150+
$tree= $arg instanceof SyntaxTree ? $arg : $this->tree($arg, $arg->getFileName());
151151
$parsed= self::parse($code, $tree->resolver())->tree()->children();
152152
if (1 === sizeof($parsed)) {
153153
return $parsed[0]->visit($tree);
@@ -190,7 +190,7 @@ private function annotations($tree, $annotated) {
190190
}
191191

192192
public function imports($reflect) {
193-
$resolver= $this->treeOf($reflect, $reflect->getFileName())->resolver();
193+
$resolver= $this->tree($reflect, $reflect->getFileName())->resolver();
194194
$imports= [];
195195
foreach ($resolver->imports as $alias => $type) {
196196
$imports[$alias]= ltrim($type, '\\');
@@ -200,34 +200,34 @@ public function imports($reflect) {
200200

201201
/** @return iterable */
202202
public function ofType($reflect) {
203-
$tree= $this->treeOf($reflect, $reflect->getFileName());
203+
$tree= $this->tree($reflect, $reflect->getFileName());
204204
return $this->annotations($tree, $tree->type());
205205
}
206206

207207
/** @return iterable */
208208
public function ofConstant($reflect) {
209209
$class= $reflect->getDeclaringClass();
210-
$tree= $this->treeOf($class, $class->getFileName());
210+
$tree= $this->tree($class, $class->getFileName());
211211
return $this->annotations($tree, $tree->type()->constant($reflect->name));
212212
}
213213

214214
/** @return iterable */
215215
public function ofProperty($reflect) {
216216
$class= $reflect->getDeclaringClass();
217-
$tree= $this->treeOf($class, $class->getFileName());
217+
$tree= $this->tree($class, $class->getFileName());
218218
return $this->annotations($tree, $tree->type()->property($reflect->name));
219219
}
220220

221221
/** @return iterable */
222222
public function ofMethod($reflect) {
223-
$tree= $this->treeOf($reflect->getDeclaringClass(), $reflect->getFileName());
223+
$tree= $this->tree($reflect->getDeclaringClass(), $reflect->getFileName());
224224
return $this->annotations($tree, $tree->type()->method($reflect->name));
225225
}
226226

227227
/** @return iterable */
228228
public function ofParameter($method, $reflect) {
229229
$class= $reflect->getDeclaringClass();
230-
$tree= $this->treeOf($class, $class->getMethod($method->name)->getFileName());
230+
$tree= $this->tree($class, $class->getMethod($method->name)->getFileName());
231231
return $this->annotations($tree, $tree->type()
232232
->method($method->name)
233233
->signature

0 commit comments

Comments
 (0)