Skip to content

Commit d939ee5

Browse files
committed
Fix for Issue #1487 - Remove resolveTableName when applying schemaAssetsFilter
1 parent 44deb92 commit d939ee5

File tree

3 files changed

+5
-17
lines changed

3 files changed

+5
-17
lines changed

phpstan.neon.dist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ parameters:
5656
-
5757
message: '#^Call to function method_exists\(\) with Doctrine\\DBAL\\Schema\\Table and ''getObjectName'' will always evaluate to true\.$#'
5858
path: src/SchemaDumper.php
59+
-
60+
message: '~^Parameter #1 \$array \(list<string>\) of array_values is already a list, call has no effect\.$~'
61+
path: src/Generator/DiffGeneratorTest.php
5962

6063
symfony:
6164
consoleApplicationLoader: tests/doctrine-migrations-phpstan-app.php

src/Generator/DiffGenerator.php

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
use function class_exists;
1717
use function method_exists;
1818
use function preg_match;
19-
use function strpos;
20-
use function substr;
2119

2220
/**
2321
* The DiffGenerator class is responsible for comparing two Doctrine\DBAL\Schema\Schema instances and generating a
@@ -136,7 +134,7 @@ private function createToSchema(): Schema
136134
foreach ($toSchema->getTables() as $table) {
137135
$tableName = $table->getName();
138136

139-
if ($schemaAssetsFilter($this->resolveTableName($tableName))) {
137+
if ($schemaAssetsFilter($tableName)) {
140138
continue;
141139
}
142140

@@ -146,17 +144,4 @@ private function createToSchema(): Schema
146144

147145
return $toSchema;
148146
}
149-
150-
/**
151-
* Resolve a table name from its fully qualified name. The `$name` argument
152-
* comes from Doctrine\DBAL\Schema\Table#getName which can sometimes return
153-
* a namespaced name with the form `{namespace}.{tableName}`. This extracts
154-
* the table name from that.
155-
*/
156-
private function resolveTableName(string $name): string
157-
{
158-
$pos = strpos($name, '.');
159-
160-
return $pos === false ? $name : substr($name, $pos + 1);
161-
}
162147
}

tests/Generator/DiffGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testGenerate(): void
4747
$this->dbalConfiguration->expects(self::once())
4848
->method('getSchemaAssetsFilter')
4949
->willReturn(
50-
static fn ($name): bool => $name === 'table_name1',
50+
static fn ($name): bool => $name === 'schema.table_name1',
5151
);
5252

5353
$table1 = $this->createMock(Table::class);

0 commit comments

Comments
 (0)