From 1cedbb787359da1757fa242d9ea2f47a28b63355 Mon Sep 17 00:00:00 2001 From: mscherer Date: Wed, 21 Jan 2026 09:08:47 +0100 Subject: [PATCH] Add runtime deprecation warnings for AbstractMigration and AbstractSeed These classes have had @deprecated docblock annotations since 4.5.0, but no runtime warnings were emitted. This adds deprecationWarning() calls so users are notified during execution that they should migrate to BaseMigration and BaseSeed respectively. --- src/AbstractMigration.php | 16 ++++++++++++++++ src/AbstractSeed.php | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/AbstractMigration.php b/src/AbstractMigration.php index 61a85922b..3f3a39ed6 100644 --- a/src/AbstractMigration.php +++ b/src/AbstractMigration.php @@ -13,7 +13,10 @@ */ namespace Migrations; +use Phinx\Db\Adapter\AdapterInterface; use Phinx\Migration\AbstractMigration as BaseAbstractMigration; +use Phinx\Migration\MigrationInterface; +use function Cake\Core\deprecationWarning; /** * @deprecated 4.5.0 You should use Migrations\BaseMigration for new migrations. @@ -32,6 +35,19 @@ class AbstractMigration extends BaseAbstractMigration */ public bool $autoId = true; + /** + * @inheritDoc + */ + public function setAdapter(AdapterInterface $adapter): MigrationInterface + { + deprecationWarning( + '4.5.0', + 'Migrations\AbstractMigration is deprecated. Use Migrations\BaseMigration instead.', + ); + + return parent::setAdapter($adapter); + } + /** * Hook method to decide if this migration should use transactions * diff --git a/src/AbstractSeed.php b/src/AbstractSeed.php index 2e51b926c..86c6addfe 100644 --- a/src/AbstractSeed.php +++ b/src/AbstractSeed.php @@ -17,6 +17,7 @@ use Phinx\Seed\AbstractSeed as BaseAbstractSeed; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\InputInterface; +use function Cake\Core\deprecationWarning; use function Cake\Core\pluginSplit; /** @@ -35,6 +36,17 @@ abstract class AbstractSeed extends BaseAbstractSeed */ protected InputInterface $input; + /** + * Constructor + */ + public function __construct() + { + deprecationWarning( + '4.5.0', + 'Migrations\AbstractSeed is deprecated. Use Migrations\BaseSeed instead.', + ); + } + /** * Gives the ability to a seeder to call another seeder. * This is particularly useful if you need to run the seeders of your applications in a specific sequences,