8000 [DoctrineBridge]rm BC layer configureSchema check database · symfony/symfony@cb8eb72 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit cb8eb72

Browse files
committed
[DoctrineBridge]rm BC layer configureSchema check database
1 parent d63071c commit cb8eb72

File tree

6 files changed

+7
-24
lines changed

6 files changed

+7
-24
lines changed

src/Symfony/Bridge/Doctrine/Security/RememberMe/DoctrineTokenProvider.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -179,17 +179,13 @@ public function updateExistingToken(PersistentTokenInterface $token, #[\Sensitiv
179179

180180
/**
181181
* Adds the Table to the Schema if "remember me" uses this Connection.
182-
*
183-
* @param \Closure $isSameDatabase
184182
*/
185-
public function configureSchema(Schema $schema, Connection $forConnection/* , \Closure $isSameDatabase */): void
183+
public function configureSchema(Schema $schema, Connection $forConnection, \Closure $isSameDatabase): void
186184
{
187185
if ($schema->hasTable('rememberme_token')) {
188186
return;
189187
}
190188

191-
$isSameDatabase = 2 < \func_num_args() ? func_get_arg(2) : static fn () => false;
192-
193189
if ($forConnection !== $this->conn && !$isSameDatabase($this->conn->executeStatement(...))) {
194190
return;
195191
}

src/Symfony/Bridge/Doctrine/Tests/SchemaListener/DoctrineDbalCacheAdapterSchemaListenerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function testPostGenerateSchema()
3535
$dbalAdapter = $this->createMock(DoctrineDbalAdapter::class);
3636
$dbalAdapter->expects($this->once())
3737
->method('configureSchema')
38-
->with($schema, $dbalConnection);
38+
->with($schema, $dbalConnection, fn () => true);
3939

4040
$subscriber = new DoctrineDbalCacheAdapterSchemaListener([$dbalAdapter]);
4141
$subscriber->postGenerateSchema($event);

src/Symfony/Bridge/Doctrine/Tests/SchemaListener/MessengerTransportDoctrineSchemaListenerTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testPostGenerateSchema()
3838
$doctrineTransport = $this->createMock(DoctrineTransport::class);
3939
$doctrineTransport->expects($this->once())
4040
->method('configureSchema')
41-
->with($schema, $dbalConnection);
41+
->with($schema, $dbalConnection, fn () => true);
4242
$otherTransport = $this->createMock(TransportInterface::class);
4343
$otherTransport->expects($this->never())
4444
->method($this->anything());

src/Symfony/Component/Cache/Adapter/DoctrineDbalAdapter.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,12 @@ public function createTable(): void
118118
}
119119
}
120120

121-
/**
122-
* @param \Closure $isSameDatabase
123-
*/
124-
public function configureSchema(Schema $schema, Connection $forConnection/* , \Closure $isSameDatabase */): void
121+
public function configureSchema(Schema $schema, Connection $forConnection, \Closure $isSameDatabase): void
125122
{
126123
if ($schema->hasTable($this->table)) {
127124
return;
128125
}
129126

130-
$isSameDatabase = 2 < \func_num_args() ? func_get_arg(2) : static fn () => false;
131-
132127
if ($forConnection !== $this->conn && !$isSameDatabase($this->conn->executeStatement(...))) {
133128
return;
134129
}

src/Symfony/Component/Lock/Store/DoctrineDbalStore.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function exists(Key $key): bool
200200
public function createTable(): void
201201
{
202202
$schema = new Schema();
203-
$this->configureSchema($schema);
203+
$this->configureSchema($schema, static fn () => true);
204204

205205
foreach ($schema->toSql($this->conn->getDatabasePlatform()) as $sql) {
206206
$this->conn->executeStatement($sql);
@@ -209,17 +209,13 @@ public function createTable(): void
209209

210210
/**
211211
* Adds the Table to the Schema if it doesn't exist.
212-
*
213-
* @param \Closure $isSameDatabase
214212
*/
215-
public function configureSchema(Schema $schema/* , \Closure $isSameDatabase */): void
213+
public function configureSchema(Schema $schema, \Closure $isSameDatabase): void
216214
{
217215
if ($schema->hasTable($this->table)) {
218216
return;
219217
}
220218

221-
$isSameDatabase = 1 < \func_num_args() ? func_get_arg(1) : static fn () => true;
222-
223219
if (!$isSameDatabase($this->conn->executeStatement(...))) {
224220
return;
225221
}

src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/DoctrineTransport.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,9 @@ public function setup(): void
7979

8080
/**
8181
* Adds the Table to the Schema if this transport uses this connection.
82-
*
83-
* @param \Closure $isSameDatabase
8482
*/
85-
public function configureSchema(Schema $schema, DbalConnection $forConnection/* , \Closure $isSameDatabase */): void
83+
public function configureSchema(Schema $schema, DbalConnection $forConnection, \Closure $isSameDatabase): void
8684
{
87-
$isSameDatabase = 2 < \func_num_args() ? func_get_arg(2) : static fn () => false;
88-
8985
$this->connection->configureSchema($schema, $forConnection, $isSameDatabase);
9086
}
9187

0 commit comments

Comments
 (0)
0