Skip to content

Commit 4fdce3e

Browse files
committed
Lower priority of NativeReflector when reflecting constants
1 parent 8c23044 commit 4fdce3e

1 file changed

Lines changed: 16 additions & 16 deletions

File tree

TyphoonReflector.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,6 @@ private function reflectConstantData(ConstantId $id): TypedMap
300300
return $cachedData;
301301
}
302302

303-
$data = $this->nativeReflector->reflectConstant($id);
304-
305-
if ($data !== null) {
306-
$this->cache->set($id, $data);
307-
308-
return $data;
309-
}
310-
311303
$resource = $this->locators->locate($id);
312304

313305
if ($resource !== null) {
@@ -316,6 +308,14 @@ private function reflectConstantData(ConstantId $id): TypedMap
316308
return ($this->buffer[$id] ?? throw new DeclarationNotFound($id))($this);
317309
}
318310

311+
$nativeData = $this->nativeReflector->reflectConstant($id);
312+
313+
if ($nativeData !== null) {
314+
$this->cache->set($id, $nativeData);
315+
316+
return $nativeData;
317+
}
318+
319319
throw new DeclarationNotFound($id);
320320
}
321321

@@ -341,12 +341,12 @@ private function reflectFunctionData(NamedFunctionId $id): TypedMap
341341
return ($this->buffer[$id] ?? throw new DeclarationNotFound($id))($this);
342342
}
343343

344-
$data = $this->nativeReflector->reflectNamedFunction($id);
344+
$nativeData = $this->nativeReflector->reflectNamedFunction($id);
345345

346-
if ($data !== null) {
347-
$this->cache->set($id, $data);
346+
if ($nativeData !== null) {
347+
$this->cache->set($id, $nativeData);
348348

349-
return $data;
349+
return $nativeData;
350350
}
351351

352352
throw new DeclarationNotFound($id);
@@ -375,12 +375,12 @@ private function reflectClassData(NamedClassId|AnonymousClassId $id): TypedMap
375375
}
376376

377377
if ($id instanceof NamedClassId) {
378-
$data = $this->nativeReflector->reflectNamedClass($id);
378+
$nativeData = $this->nativeReflector->reflectNamedClass($id);
379379

380-
if ($data !== null) {
381-
$this->cache->set($id, $data);
380+
if ($nativeData !== null) {
381+
$this->cache->set($id, $nativeData);
382382

383-
return $data;
383+
return $nativeData;
384384
}
385385
}
386386

0 commit comments

Comments
 (0)