batyrmastyr/yii-db-rector-rules

Maintainers

Package info

github.com/batyrmastyr/yii-db-rector-rules

pkg:composer/batyrmastyr/yii-db-rector-rules

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.0.5 2026-01-11 17:15 UTC

This package is auto-updated.

Last update: 2026-04-11 17:46:42 UTC


README

Several Rector rules to upgrade yiisoft/db package from 1.3 to 2.0, mostly for tests.

Install

composer require --dev batyrmastyr/yii-db-rector-rules

How to use

Add rule set to rector.php like below

return RectorConfig::configure()
    ->withSets([YiisoftDbUpgradeSet::Yii3DbV2])
;

What's inside

  • Replace (new Dsn(arguments))->asString() with new Dsn(...)
  • Remove InvalidArgumentException
  • Replace ->getSchema->getRawTableName() with ->getQuoter()->getRawTableName()
  • Replace SchemaInterface::TYPE_* constants with ColumnType::*
  • Replace Yiisoft\Db\Constraint\IndexConstraint with Yiisoft\Db\Constraint\Index and change method calls to property access, e.g. $index->getColumnNames()[0] -> $index->columnNames[0]