diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 0b170765..bba89642 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -39,6 +39,7 @@ jobs: - '8.0' - '8.1' - '8.2' + - '8.3' steps: - name: Checkout. @@ -66,8 +67,10 @@ jobs: FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }} WORK_PACKAGE_URL: ${{ env.WORK_PACKAGE_URL }} - - name: Install dependencies with composer. - run: composer update --no-interaction --no-progress --optimize-autoloader --ansi - - name: Static analysis. + if: ${{ matrix.php != '8.0' }} run: vendor/bin/psalm --config=${{ inputs.psalm-config }} --shepherd --stats --output-format=github --php-version=${{ matrix.php }} + + - name: Static analysis. + if: ${{ matrix.php == '8.0' }} + run: vendor/bin/psalm --config=psalm4.xml --shepherd --stats --output-format=github --php-version=${{ matrix.php }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e15aba8..b2b24f21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Enh #286: Change property `Schema::$typeMap` to constant `Schema::TYPE_MAP` (@Tigrov) - Bug #287: Fix `DMLQueryBuilder::insertWithReturningPks()` and `Command::insertWithReturningPks()` methods (@Tigrov) +- Enh #292: Minor refactoring of `Command` and `Quoter` (@Tigrov) ## 1.1.0 November 12, 2023 diff --git a/composer.json b/composer.json index 29561e3e..90826a54 100644 --- a/composer.json +++ b/composer.json @@ -31,7 +31,7 @@ "rector/rector": "^0.19", "roave/infection-static-analysis-plugin": "^1.16", "spatie/phpunit-watcher": "^1.23", - "vimeo/psalm": "^4.3|^5.6", + "vimeo/psalm": "^4.30|^5.20", "yiisoft/aliases": "^2.0", "yiisoft/cache-file": "^3.1", "yiisoft/var-dumper": "^1.5" diff --git a/psalm.xml b/psalm.xml index 23bfcce1..5001d0a7 100644 --- a/psalm.xml +++ b/psalm.xml @@ -14,4 +14,7 @@ + + + diff --git a/psalm4.xml b/psalm4.xml new file mode 100644 index 00000000..23bfcce1 --- /dev/null +++ b/psalm4.xml @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/src/Command.php b/src/Command.php index 69e30f76..c7c665b7 100644 --- a/src/Command.php +++ b/src/Command.php @@ -15,7 +15,7 @@ final class Command extends AbstractPdoCommand public function insertWithReturningPks(string $table, array $columns): bool|array { if (empty($this->db->getSchema()->getTableSchema($table)?->getPrimaryKey())) { - if (parent::insert($table, $columns)->execute() === 0) { + if ($this->insert($table, $columns)->execute() === 0) { return false; } diff --git a/src/Quoter.php b/src/Quoter.php index 2a7fd735..5ab8d06c 100644 --- a/src/Quoter.php +++ b/src/Quoter.php @@ -25,7 +25,7 @@ public function quoteColumnName(string $name): string public function getTableNameParts(string $name, bool $withColumn = false): array { - if (preg_match_all('/([^.\[\]]+)|\[([^\[\]]+)]/', $name, $matches)) { + if (preg_match_all('/([^.\[\]]+)|\[([^\[\]]+)]/', $name, $matches) > 0) { $parts = array_slice($matches[0], -4, 4); } else { $parts = [$name];