Skip to content

Commit 5394e4f

Browse files
authored
Merge pull request #1006 from cakephp/add-runtime-deprecation-warnings
Add runtime deprecation warnings for AbstractMigration and AbstractSeed
2 parents 2c1f782 + 1cedbb7 commit 5394e4f

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/AbstractMigration.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
*/
1414
namespace Migrations;
1515

16+
use Phinx\Db\Adapter\AdapterInterface;
1617
use Phinx\Migration\AbstractMigration as BaseAbstractMigration;
18+
use Phinx\Migration\MigrationInterface;
19+
use function Cake\Core\deprecationWarning;
1720

1821
/**
1922
* @deprecated 4.5.0 You should use Migrations\BaseMigration for new migrations.
@@ -32,6 +35,19 @@ class AbstractMigration extends BaseAbstractMigration
3235
*/
3336
public bool $autoId = true;
3437

38+
/**
39+
* @inheritDoc
40+
*/
41+
public function setAdapter(AdapterInterface $adapter): MigrationInterface
42+
{
43+
deprecationWarning(
44+
'4.5.0',
45+
'Migrations\AbstractMigration is deprecated. Use Migrations\BaseMigration instead.',
46+
);
47+
48+
return parent::setAdapter($adapter);
49+
}
50+
3551
/**
3652
* Hook method to decide if this migration should use transactions
3753
*

src/AbstractSeed.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Phinx\Seed\AbstractSeed as BaseAbstractSeed;
1818
use Symfony\Component\Console\Input\ArgvInput;
1919
use Symfony\Component\Console\Input\InputInterface;
20+
use function Cake\Core\deprecationWarning;
2021
use function Cake\Core\pluginSplit;
2122

2223
/**
@@ -35,6 +36,17 @@ abstract class AbstractSeed extends BaseAbstractSeed
3536
*/
3637
protected InputInterface $input;
3738

39+
/**
40+
* Constructor
41+
*/
42+
public function __construct()
43+
{
44+
deprecationWarning(
45+
'4.5.0',
46+
'Migrations\AbstractSeed is deprecated. Use Migrations\BaseSeed instead.',
47+
);
48+
}
49+
3850
/**
3951
* Gives the ability to a seeder to call another seeder.
4052
* This is particularly useful if you need to run the seeders of your applications in a specific sequences,

0 commit comments

Comments
 (0)