Skip to content

Commit 1bd0de3

Browse files
authored
Support wrapping a RecordingReflector in LazyQueryReflector (#607)
1 parent 9058bc9 commit 1bd0de3

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/QueryReflection/LazyQueryReflector.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use PHPStan\Type\Type;
88
use staabm\PHPStanDba\Error;
99

10-
final class LazyQueryReflector implements QueryReflector
10+
final class LazyQueryReflector implements QueryReflector, RecordingReflector
1111
{
1212
/**
1313
* @var callable():QueryReflector
@@ -51,6 +51,17 @@ public function setupDbaApi(?DbaApi $dbaApi): void
5151
$this->dbaApi = $dbaApi;
5252
}
5353

54+
public function getDatasource()
55+
{
56+
$this->reflector = $this->createReflector();
57+
58+
if ($this->reflector instanceof RecordingReflector) {
59+
return $this->reflector->getDatasource();
60+
}
61+
62+
return null;
63+
}
64+
5465
private function createReflector(): QueryReflector
5566
{
5667
if (null === $this->reflector) {

0 commit comments

Comments
 (0)