Skip to content

Commit 31eb11a

Browse files
committed
Simplify AbstractPlatform: remove unused $prefix param, caching, and dot-splitting from quoteIdentifier
1 parent 364eadd commit 31eb11a

File tree

2 files changed

+8
-40
lines changed

2 files changed

+8
-40
lines changed

src/Adapter/Platform/AbstractPlatform.php

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111

1212
use function addcslashes;
1313
use function array_map;
14-
use function explode;
1514
use function implode;
16-
use function str_contains;
1715
use function str_replace;
1816

1917
/**
@@ -26,50 +24,21 @@ abstract class AbstractPlatform implements PlatformInterface
2624

2725
protected string $quoteIdentifierTo = '\'';
2826

29-
protected string $identifierSeparator = '.';
30-
3127
protected bool $quoteIdentifiers = true;
3228

33-
/** @var array<string, string> */
34-
private array $identifierCache = [];
35-
3629
/**
3730
* {@inheritDoc}
3831
*/
3932
#[Override]
40-
public function quoteIdentifier(string $name, ?string $prefix = null): string
33+
public function quoteIdentifier(string $identifier): string
4134
{
42-
$cacheKey = $prefix !== null ? $prefix . '.' . $name : $name;
43-
44-
if (isset($this->identifierCache[$cacheKey])) {
45-
return $this->identifierCache[$cacheKey];
46-
}
47-
48-
if ($prefix === null && str_contains($name, '.')) {
49-
[$prefix, $name] = explode('.', $name, 2);
50-
}
51-
5235
if (! $this->quoteIdentifiers) {
53-
return $prefix !== null
54-
? $prefix . $this->identifierSeparator . $name
55-
: $name;
56-
}
57-
58-
if ($prefix !== null) {
59-
return $this->identifierCache[$cacheKey]
60-
= $this->quoteIdentifier[0]
61-
. str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $prefix)
62-
. $this->quoteIdentifier[1]
63-
. $this->identifierSeparator
64-
. $this->quoteIdentifier[0]
65-
. str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $name)
66-
. $this->quoteIdentifier[1];
36+
return $identifier;
6737
}
6838

69-
return $this->identifierCache[$cacheKey]
70-
= $this->quoteIdentifier[0]
71-
. str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $name)
72-
. $this->quoteIdentifier[1];
39+
return $this->quoteIdentifier[0]
40+
. str_replace($this->quoteIdentifier[0], $this->quoteIdentifierTo, $identifier)
41+
. $this->quoteIdentifier[1];
7342
}
7443

7544
/**
@@ -138,6 +107,6 @@ public function quoteValueList(array|string $valueList): string
138107
#[Override]
139108
public function getIdentifierSeparator(): string
140109
{
141-
return $this->identifierSeparator;
110+
return '.';
142111
}
143112
}

src/Adapter/Platform/PlatformInterface.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ public function getSqlPlatformDecorator(): AbstractSqlRenderer;
2424
public function getQuoteIdentifierSymbol(): string;
2525

2626
/**
27-
* Quote identifier — dotted names (e.g. "table.column") are auto-split.
28-
* Pass $prefix explicitly for schema-qualified tables.
27+
* Quote identifier
2928
*/
30-
public function quoteIdentifier(string $name, ?string $prefix = null): string;
29+
public function quoteIdentifier(string $identifier): string;
3130

3231
/**
3332
* Quote identifier chain

0 commit comments

Comments
 (0)