Skip to content

Commit 5815d5e

Browse files
committed
Fix types
1 parent 1a8c8fb commit 5815d5e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/QueryReflection/ReflectionCache.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ private function readCachedRecords(bool $useReadLock): ?array
157157

158158
// the schemaHash is only available in replay-and-record mode.
159159
if (null === $this->schemaHash) {
160+
if (! is_string($cache['schemaHash'])) {
161+
throw new ShouldNotHappenException();
162+
}
160163
$this->schemaHash = $cache['schemaHash'];
161164
} elseif ($this->schemaHash !== $cache['schemaHash']) {
162165
return null;

src/SqlAst/ParserInference.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public function narrowResultType(string $queryString, ConstantArrayType $resultT
7474
$fromTable = $this->schemaReflection->getTable($fromName);
7575
} elseif ($from instanceof Join) {
7676
while (1) {
77+
if (!$from instanceof Join || !method_exists($from, 'getCondition')) {
78+
return $resultType;
79+
}
80+
7781
if ($from->getCondition() === null) {
7882
if (QueryReflection::getRuntimeConfiguration()->isDebugEnabled()) {
7983
throw new UnresolvableAstInQueryException('Cannot narrow down types null join conditions: ' . $queryString);

0 commit comments

Comments
 (0)