Skip to content

Commit 9a747d2

Browse files
authored
Merge pull request #6051 from greg0ire/clear-up-confusion
Reference the right argument
2 parents 4d27b98 + b94a87f commit 9a747d2

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

UPGRADE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,9 @@ if (! $diff->isEmpty()) {
260260
}
261261
```
262262

263-
## Deprecated not passing `$fromColumn` to the `TableDiff` constructor.
263+
## Deprecated not passing `$fromTable` to the `TableDiff` constructor.
264264

265-
Not passing `$fromColumn` to the `TableDiff` constructor has been deprecated.
265+
Not passing `$fromTable` to the `TableDiff` constructor has been deprecated.
266266

267267
The `TableDiff::$name` property and the `TableDiff::getName()` method have been deprecated as well. In order to obtain
268268
the name of the table that the diff describes, use `TableDiff::getOldTable()`.
@@ -1002,7 +1002,7 @@ deprecated in order to provide a more consistent API.
10021002

10031003
## Deprecated `Comparator::compare($fromSchema, $toSchema)`
10041004

1005-
The usage of `Comparator::compare($fromSchema, $toSchema)` is deprecated and
1005+
The usage of `Comparator::compare($fromSchema, $toSchema)` is deprecated and
10061006
replaced by `Comparator::compareSchemas($fromSchema, $toSchema)` in order to
10071007
clarify the purpose of the method.
10081008

src/Schema/TableDiff.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,11 @@ public function __construct(
180180
$this->changedForeignKeys = $changedForeignKeys;
181181
$this->removedForeignKeys = $removedForeignKeys;
182182

183-
if ($fromTable !== null) {
183+
if ($fromTable === null) {
184184
Deprecation::trigger(
185185
'doctrine/dbal',
186186
'https://github.com/doctrine/dbal/pull/5678',
187-
'Not passing the $fromColumn to %s is deprecated.',
187+
'Not passing the $fromTable to %s is deprecated.',
188188
__METHOD__,
189189
);
190190
}

tests/Schema/TableDiffTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66
use Doctrine\DBAL\Schema\Identifier;
77
use Doctrine\DBAL\Schema\Table;
88
use Doctrine\DBAL\Schema\TableDiff;
9+
use Doctrine\Deprecations\PHPUnit\VerifyDeprecations;
910
use PHPUnit\Framework\MockObject\MockObject;
1011
use PHPUnit\Framework\TestCase;
1112

1213
class TableDiffTest extends TestCase
1314
{
15+
use VerifyDeprecations;
16+
1417
/** @var AbstractPlatform&MockObject */
1518
private AbstractPlatform $platform;
1619

@@ -53,4 +56,25 @@ public function testReturnsNewName(): void
5356

5457
self::assertEquals(new Identifier('bar'), $tableDiff->getNewName());
5558
}
59+
60+
public function testOmittingFromTableInConstructorIsDeprecated(): void
61+
{
62+
$this->expectDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/5678');
63+
$tableDiff = new TableDiff('foo');
64+
}
65+
66+
public function testPassingFromTableToConstructorIsDeprecated(): void
67+
{
68+
$this->expectNoDeprecationWithIdentifier('https://github.com/doctrine/dbal/pull/5678');
69+
$tableDiff = new TableDiff(
70+
'foo',
71+
[],
72+
[],
73+
[],
74+
[],
75+
[],
76+
[],
77+
new Table('foo'),
78+
);
79+
}
5680
}

0 commit comments

Comments
 (0)