Skip to content

Commit de7c215

Browse files
Don't call deprecated getSQLResultCasing when we know the platform
1 parent 2afe2dc commit de7c215

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

lib/Doctrine/ORM/Internal/SQLResultCasing.php

+9
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66

77
use Doctrine\DBAL\Platforms\AbstractPlatform;
88
use Doctrine\DBAL\Platforms\DB2Platform;
9+
use Doctrine\DBAL\Platforms\MySQLPlatform;
10+
use Doctrine\DBAL\Platforms\MySqlPlatform as LegacyMySqlPlatform;
911
use Doctrine\DBAL\Platforms\OraclePlatform;
1012
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
13+
use Doctrine\DBAL\Platforms\SqlitePlatform;
14+
use Doctrine\DBAL\Platforms\SQLServerPlatform;
1115

1216
use function method_exists;
1317
use function strtolower;
@@ -26,6 +30,11 @@ private function getSQLResultCasing(AbstractPlatform $platform, string $column):
2630
return strtolower($column);
2731
}
2832

33+
/** @psalm-suppress UndefinedClass, InvalidClass */
34+
if ($platform instanceof LegacyMySqlPlatform || $platform instanceof MySQLPlatform || $platform instanceof SQLServerPlatform || $platform instanceof SqlitePlatform) {
35+
return $column;
36+
}
37+
2938
if (method_exists(AbstractPlatform::class, 'getSQLResultCasing')) {
3039
return $platform->getSQLResultCasing($column);
3140
}

phpstan-dbal2.neon

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ parameters:
1010
- '/Call to an undefined method Doctrine\\DBAL\\Connection::createSchemaManager\(\)\./'
1111
# Class name will change in DBAL 3.
1212
- '/^Class Doctrine\\DBAL\\Platforms\\PostgreSQLPlatform not found\.$/'
13+
-
14+
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
15+
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php
1316

1417
# Forward compatibility for DBAL 3.5
1518
- '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getAlterSchemaSQL\(\).$/'

phpstan-persistence2.neon

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ parameters:
1414

1515
- '/^Class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform not found\.$/'
1616
- '/^Call to method \w+\(\) on an unknown class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform\.$/'
17+
-
18+
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
19+
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php
1720

1821
-
1922
message: '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSQLResultCasing\(\)\.$/'

phpstan.neon

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ parameters:
1414

1515
- '/^Class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform not found\.$/'
1616
- '/^Call to method \w+\(\) on an unknown class Doctrine\\DBAL\\Platforms\\SQLAnywherePlatform\.$/'
17+
-
18+
message: '/Doctrine\\DBAL\\Platforms\\MyS(ql|QL)Platform/'
19+
path: lib/Doctrine/ORM/Internal/SQLResultCasing.php
1720

1821
-
1922
message: '/^Call to an undefined method Doctrine\\DBAL\\Platforms\\AbstractPlatform::getSQLResultCasing\(\)\.$/'

0 commit comments

Comments
 (0)