Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
371 changes: 361 additions & 10 deletions .phpstan-dba-mysqli.cache

Large diffs are not rendered by default.

366 changes: 355 additions & 11 deletions .phpstan-dba-pdo.cache

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/QueryReflection/QueryReflection.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,26 @@ public function resolveQueryStrings(Expr $queryExpr, Scope $scope): iterable

if ($type instanceof UnionType) {
foreach (TypeUtils::getConstantStrings($type) as $constantString) {
yield $constantString->getValue();
yield $this->normalizeQueryString($constantString->getValue());
}

return;
}

$queryString = $this->resolveQueryExpr($queryExpr, $scope);
if (null !== $queryString) {
yield $queryString;
yield $this->normalizeQueryString($queryString);
}
}

/**
* Make sure query string work consistently across operating systems.
*/
private function normalizeQueryString(string $queryString): string
{
return str_replace("\r\n", "\n", $queryString);
}

/**
* @deprecated use resolveQueryStrings() instead
*
Expand Down
2 changes: 1 addition & 1 deletion src/QueryReflection/ReflectionCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

final class ReflectionCache
{
public const SCHEMA_VERSION = 'v6-schema-hash';
public const SCHEMA_VERSION = 'v7-normalized-eol';

/**
* @var string
Expand Down
1 change: 1 addition & 0 deletions tests/default/DbaInferenceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function dataFileAsserts(): iterable

yield from $this->gatherAssertTypes(__DIR__.'/data/pdo-union-result.php');
yield from $this->gatherAssertTypes(__DIR__.'/data/mysqli-union-result.php');
yield from $this->gatherAssertTypes(__DIR__.'/data/bug372.php');
}

/**
Expand Down
Loading