cakephp / phinx

PHP Database Migrations for Everyone
https://phinx.org
MIT License
4.45k stars 895 forks source link

Make Abstract{Migration,Seed}::getAdapter return non-null #2261

Closed MasterOdin closed 7 months ago

MasterOdin commented 7 months ago

Closes #2200

Modifies the getAdapter method for the AbstractMigration and AbstractSeed classes to always return an adapter, or error if there is not one available. This is a change of behavior for AbstractMigration as it was documented as nullable before, while AbstractSeed would throw a fatal error if the adapter was not set. Now both will return a \RuntimeException if this method is called before an adapter has been set, but it's not expected that this should happen in user code unless they modify the constructor method to call it, but at that point it'd always be null so not sure why anyone would. As such, not considering this a BC break.