diff --git a/.github/workflows/mssql.yml b/.github/workflows/mssql.yml index 5592c14..d06dd80 100644 --- a/.github/workflows/mssql.yml +++ b/.github/workflows/mssql.yml @@ -17,7 +17,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index fa2ba58..1725441 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -7,6 +7,7 @@ on: - 'tests/**' - 'phpunit.xml.dist' - 'infection.json.dist' + - 'tools/infection/composer.json' - 'composer.json' - '.github/workflows/mutation.yml' push: diff --git a/.github/workflows/mysql.yml b/.github/workflows/mysql.yml index 6b4231f..642c826 100644 --- a/.github/workflows/mysql.yml +++ b/.github/workflows/mysql.yml @@ -17,7 +17,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/oracle.yml b/.github/workflows/oracle.yml index 51ca673..40b7074 100644 --- a/.github/workflows/oracle.yml +++ b/.github/workflows/oracle.yml @@ -17,7 +17,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/pgsql.yml b/.github/workflows/pgsql.yml index 070f053..a926409 100644 --- a/.github/workflows/pgsql.yml +++ b/.github/workflows/pgsql.yml @@ -17,7 +17,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/rector-cs.yml b/.github/workflows/rector-cs.yml index a6f5a57..add2ba7 100644 --- a/.github/workflows/rector-cs.yml +++ b/.github/workflows/rector-cs.yml @@ -18,7 +18,9 @@ concurrency: cancel-in-progress: true jobs: - rector: + rector-cs: + permissions: + contents: write # Required to commit formatting fixes back to the PR uses: yiisoft/actions/.github/workflows/rector-cs.yml@master with: php: '8.1' diff --git a/.github/workflows/sqlite.yml b/.github/workflows/sqlite.yml index cdcfda0..839ce5b 100644 --- a/.github/workflows/sqlite.yml +++ b/.github/workflows/sqlite.yml @@ -17,7 +17,7 @@ permissions: contents: read concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.gitignore b/.gitignore index f1fb048..021a49d 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,3 @@ composer.phar # PhpUnit /phpunit.phar /phpunit.xml -/.phpunit.cache - -# PHP CS Fixer -/.php-cs-fixer.cache diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index c809122..0e03959 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -2,21 +2,21 @@ declare(strict_types=1); -use PhpCsFixer\Config; use PhpCsFixer\Finder; use PhpCsFixer\Runner\Parallel\ParallelConfigFactory; +use Yiisoft\CodeStyle\ConfigBuilder; $finder = (new Finder())->in([ __DIR__ . '/src', __DIR__ . '/tests', ]); -return (new Config()) +return ConfigBuilder::build() + ->setCacheFile(__DIR__ . '/runtime/.php-cs-fixer.cache') + ->setRiskyAllowed(true) ->setParallelConfig(ParallelConfigFactory::detect()) ->setRules([ - '@PER-CS3.0' => true, - 'no_unused_imports' => true, - 'ordered_class_elements' => true, - 'class_attributes_separation' => ['elements' => ['method' => 'one']], + '@Yiisoft/Core' => true, + '@Yiisoft/Core:risky' => true, ]) ->setFinder($finder); diff --git a/CHANGELOG.md b/CHANGELOG.md index a82405e..571be26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.0.1 under development -- no changes in this release. +- Enh #146: Explicitly import `SORT_ASC` constant in `QueryDataReader` (@vjik) ## 1.0.0 December 13, 2025 diff --git a/Makefile b/Makefile index dcc0cf6..ec1ea81 100644 --- a/Makefile +++ b/Makefile @@ -64,8 +64,8 @@ vendor/bin/roave-infection-static-analysis-plugin \ --only-covered" ## Run mutation tests using Infection mutation: run -composer-require-checker: CMD="vendor/bin/composer-require-checker" ## Check dependencies using Composer Require Checker -composer-require-checker: run +composer-dependency-analyser: CMD="vendor/bin/composer-dependency-analyser" ## Check dependencies using Composer Dependency Analyser +composer-dependency-analyser: run rector: CMD="vendor/bin/rector" ## Check code style using Rector rector: run diff --git a/composer.json b/composer.json index 677bc2f..c841285 100644 --- a/composer.json +++ b/composer.json @@ -34,14 +34,15 @@ }, "require-dev": { "ext-pdo": "*", - "friendsofphp/php-cs-fixer": "^3.92.0", - "phpunit/phpunit": "^10.5.60", - "rector/rector": "^2.2.14", - "roave/infection-static-analysis-plugin": "^1.35", + "bamarni/composer-bin-plugin": "^1.9.1", + "friendsofphp/php-cs-fixer": "^3.95.27", + "phpunit/phpunit": "^10.5.66", + "rector/rector": "^2.7.0", "shipmonk/composer-dependency-analyser": "^1.8", "spatie/phpunit-watcher": "^1.24", - "vimeo/psalm": "^5.26.1 || ^6.9.1", + "vimeo/psalm": "^6.20.0", "vlucas/phpdotenv": "^5.6.2", + "yiisoft/code-style": "^1.1", "yiisoft/db-mssql": "^2.0", "yiisoft/db-mysql": "^2.0", "yiisoft/db-oracle": "^2.0", @@ -62,11 +63,17 @@ }, "files": ["tests/bootstrap.php"] }, + "extra": { + "bamarni-bin": { + "bin-links": true, + "target-directory": "tools", + "forward-command": true + } + }, "config": { "sort-packages": true, "allow-plugins": { - "infection/extension-installer": true, - "composer/package-versions-deprecated": true + "bamarni/composer-bin-plugin": true } }, "scripts": { diff --git a/docker/Dockerfile b/docker/Dockerfile index 41923b1..9129422 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -87,7 +87,7 @@ COPY --from=composer /composer /usr/bin/composer # Code COPY . /code -RUN rm -f /code/composer.lock +RUN rm -f /code/composer.lock /code/tools/*/composer.lock WORKDIR /code # PHP packages diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 16e2851..e2f9ee6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -2,7 +2,7 @@ withPaths([ @@ -14,11 +11,6 @@ __DIR__ . '/tests', ]) ->withPhpSets(php81: true) - ->withRules([ - InlineConstructorDefaultToPropertyRector::class, - ]) - ->withSkip([ - ClosureToArrowFunctionRector::class, - ReadOnlyPropertyRector::class, - NullToStrictStringFuncCallArgRector::class, + ->withSets([ + SetList::YII_CORE, ]); diff --git a/runtime/.gitignore b/runtime/.gitignore new file mode 100644 index 0000000..d6b7ef3 --- /dev/null +++ b/runtime/.gitignore @@ -0,0 +1,2 @@ +* +!.gitignore diff --git a/src/QueryDataReader.php b/src/QueryDataReader.php index c29cc00..fd23255 100644 --- a/src/QueryDataReader.php +++ b/src/QueryDataReader.php @@ -39,6 +39,8 @@ use function is_string; use function sprintf; +use const SORT_ASC; + /** * @template TKey as array-key * @template TValue as array|object diff --git a/tests/Base/DataTrait.php b/tests/Base/DataTrait.php index 9f2258c..404a77b 100644 --- a/tests/Base/DataTrait.php +++ b/tests/Base/DataTrait.php @@ -41,9 +41,7 @@ abstract protected function getConnectionId(): string; protected function getConnection(): PdoConnectionInterface { $connectionId = $this->getConnectionId(); - if (!isset(self::$connection[$connectionId])) { - self::$connection[$connectionId] = $this->makeConnection(); - } + self::$connection[$connectionId] ??= $this->makeConnection(); return self::$connection[$connectionId]; } diff --git a/tools/.gitignore b/tools/.gitignore new file mode 100644 index 0000000..cf452dc --- /dev/null +++ b/tools/.gitignore @@ -0,0 +1,2 @@ +/*/vendor +/*/composer.lock diff --git a/tools/infection/composer.json b/tools/infection/composer.json new file mode 100644 index 0000000..917bef6 --- /dev/null +++ b/tools/infection/composer.json @@ -0,0 +1,10 @@ +{ + "require-dev": { + "roave/infection-static-analysis-plugin": "^1.35" + }, + "config": { + "allow-plugins": { + "infection/extension-installer": true + } + } +}