Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Nov 15, 2024
1 parent 1a8c8fb commit 5815d5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/QueryReflection/ReflectionCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ private function readCachedRecords(bool $useReadLock): ?array

// the schemaHash is only available in replay-and-record mode.
if (null === $this->schemaHash) {
if (! is_string($cache['schemaHash'])) {
throw new ShouldNotHappenException();
}
$this->schemaHash = $cache['schemaHash'];
} elseif ($this->schemaHash !== $cache['schemaHash']) {
return null;
Expand Down
4 changes: 4 additions & 0 deletions src/SqlAst/ParserInference.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ public function narrowResultType(string $queryString, ConstantArrayType $resultT
$fromTable = $this->schemaReflection->getTable($fromName);
} elseif ($from instanceof Join) {
while (1) {
if (!$from instanceof Join || !method_exists($from, 'getCondition')) {
return $resultType;
}

if ($from->getCondition() === null) {
if (QueryReflection::getRuntimeConfiguration()->isDebugEnabled()) {
throw new UnresolvableAstInQueryException('Cannot narrow down types null join conditions: ' . $queryString);
Expand Down

0 comments on commit 5815d5e

Please sign in to comment.