blob: c985d4bfda6f5541e2dae5194e3f3bd753101c96 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Portability;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use Doctrine\DBAL\Platforms\DB2Platform;
use Doctrine\DBAL\Platforms\OraclePlatform;
use Doctrine\DBAL\Platforms\PostgreSQLPlatform;
use Doctrine\DBAL\Platforms\SQLitePlatform;
use Doctrine\DBAL\Platforms\SQLServerPlatform;
final class OptimizeFlags
{
/**
* Platform-specific portability flags that need to be excluded from the user-provided mode
* since the platform already operates in this mode to avoid unnecessary conversion overhead.
*
* @var array<class-string, int>
*/
private static array $platforms = [
DB2Platform::class => 0,
OraclePlatform::class => Connection::PORTABILITY_EMPTY_TO_NULL,
PostgreSQLPlatform::class => 0,
SQLitePlatform::class => 0,
SQLServerPlatform::class => 0,
];
public function __invoke(AbstractPlatform $platform, int $flags): int
{
foreach (self::$platforms as $class => $mask) {
if ($platform instanceof $class) {
$flags &= ~$mask;
break;
}
}
return $flags;
}
}
|