Skip to content

Commit

Permalink
Fix #268: Don't use Yii DB deprecated methods in Migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Jul 12, 2024
1 parent b971343 commit 192577d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 7 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- 'psalm.xml'

push:
branches:
- master
paths-ignore:
- 'docs/**'
- 'README.md'
Expand Down Expand Up @@ -38,7 +40,7 @@ jobs:
- ubuntu-latest

php:
- 8.0
- 8.3

services:
postgres:
Expand Down Expand Up @@ -72,6 +74,6 @@ jobs:

- name: Run infection.
run: |
vendor/bin/roave-infection-static-analysis-plugin -j2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Pgsql"
vendor/bin/roave-infection-static-analysis-plugin --threads=2 --ignore-msi-with-no-mutations --only-covered --test-framework-options="--testsuite=Pgsql"
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
8 changes: 7 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- ubuntu-latest

php:
- '8.0'
- '8.1'
- '8.2'
- '8.3'
Expand Down Expand Up @@ -66,5 +67,10 @@ jobs:
- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Static analysis
- name: Static analysis PHP 8.0
if: matrix.php == '8.0'
run: vendor/bin/psalm --shepherd --config=psalm-8.0.xml --stats --output-format=checkstyle --php-version=${{ matrix.php }} | cs2pr --graceful-warnings --colorize

- name: Static analysis PHP not 8.0
if: matrix.php != '8.0'
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle --php-version=${{ matrix.php }} | cs2pr --graceful-warnings --colorize
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.1.1 under development

- no changes in this release.
- Enh #268: Don't use Yii DB deprecated methods in `Migrator` (@BaBL86, @vjik)

## 1.1.0 December 24, 2023

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"php": "^8.0",
"ext-filter": "*",
"symfony/console": "^6.0|^7.0",
"yiisoft/db": "^1.1",
"yiisoft/db": "^1.3",
"yiisoft/injector": "^1.2"
},
"require-dev": {
Expand All @@ -43,7 +43,7 @@
"rector/rector": "^1.0",
"roave/infection-static-analysis-plugin": "^1.25|^1.32",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.12",
"vimeo/psalm": "^4.30|^5.25",
"yiisoft/db-sqlite": "^1.1",
"yiisoft/di": "^1.2",
"yiisoft/files": "^1.0|^2.0",
Expand Down
22 changes: 22 additions & 0 deletions psalm-8.0.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
findUnusedBaselineEntry="true"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<directory name="bin" />
<file name="bin/yii-db-migration" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<UnresolvableInclude errorLevel="suppress" />
</issueHandlers>
</psalm>
1 change: 1 addition & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
</projectFiles>
<issueHandlers>
<MixedAssignment errorLevel="suppress" />
<RiskyTruthyFalsyComparison errorLevel="suppress" />
</issueHandlers>
</psalm>
8 changes: 7 additions & 1 deletion src/Migrator.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ private function checkMigrationHistoryTable(): void

private function createMigrationHistoryTable(): void
{
$tableName = $this->db->getSchema()->getRawTableName($this->historyTable);
/**
* Remove these annotations after raise Yii DB version to 2.0
*
* @psalm-suppress UndefinedInterfaceMethod
* @var string $tableName
*/
$tableName = $this->db->getQuoter()->getRawTableName($this->historyTable);
$this->informer->beginCreateHistoryTable('Creating migration history table "' . $tableName . '"...');

$b = $this->createBuilder(new NullMigrationInformer());
Expand Down

0 comments on commit 192577d

Please sign in to comment.