Skip to content

Commit

Permalink
Lower priority of NativeReflector when reflecting constants
Browse files Browse the repository at this point in the history
  • Loading branch information
vudaltsov committed Aug 6, 2024
1 parent 8c23044 commit 4fdce3e
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions TyphoonReflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,14 +300,6 @@ private function reflectConstantData(ConstantId $id): TypedMap
return $cachedData;
}

$data = $this->nativeReflector->reflectConstant($id);

if ($data !== null) {
$this->cache->set($id, $data);

return $data;
}

$resource = $this->locators->locate($id);

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

$nativeData = $this->nativeReflector->reflectConstant($id);

if ($nativeData !== null) {
$this->cache->set($id, $nativeData);

return $nativeData;
}

throw new DeclarationNotFound($id);
}

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

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

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

return $data;
return $nativeData;
}

throw new DeclarationNotFound($id);
Expand Down Expand Up @@ -375,12 +375,12 @@ private function reflectClassData(NamedClassId|AnonymousClassId $id): TypedMap
}

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

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

return $data;
return $nativeData;
}
}

Expand Down

0 comments on commit 4fdce3e

Please sign in to comment.