phinx: No More migration possible : error creating AbstractMigration because of type int for the second parameter
Hello,
Since upgrade to 0.13.0, we can’t anymore run migration scripte cause of the following error :
TypeError: Argument 2 passed to Phinx\Migration\AbstractMigration::__construct() must be of the type int, string given,
Error throwed by line 824 into Phinx\Migration\Manager.php
// instantiate it $migration = new $class($environment, $version, $this->getInput(), $this->getOutput());
$version is initialised at line 779 by the method Util::getVersionFromFileName which return a string value
src/Phinx/Migration/AbstractMigration.php

About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (11 by maintainers)
Do you need me to retest and put the errors here?
This should have been fixed in
0.13.3from #2150. There were no changes in0.13.4related to this codepath, so I’d expect the same error on0.x-devas0.13.3.The two paths would be:
$versioncan be a string everywhere$versionis an integer everywhere (what we’re currently doing)For case (2), it would just be modifying
Util::getVersionFromFileNameso that it casts its regex match to an integer and update the type appropriately.The root cause of the bug is that while we added typing everywhere, we didn’t add
declare(strict_types=1);everywhere as well so there’s some amount of implicit conversion happening that need to track down and eliminate (such as here, as well as in casting$versionin the CLI commands appropriately).