From f648fe411c12cc7589a9f82703d00508a515e305 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sun, 17 Oct 2021 12:01:53 +0000 Subject: [PATCH 1/5] DevKit updates --- .github/workflows/documentation.yaml | 4 ++-- .github/workflows/lint.yaml | 32 ++++++++++++++++++++-------- .github/workflows/qa.yaml | 14 ++++++------ .github/workflows/stale.yaml | 2 +- .github/workflows/test.yaml | 32 ++++++++++++++-------------- .php-cs-fixer.dist.php | 9 +++----- Makefile | 11 +++++++--- phpunit.xml.dist | 6 ++++-- 8 files changed, 64 insertions(+), 46 deletions(-) diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index b094c047..308e2bb7 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -25,7 +25,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v2 with: - python-version: '3.7' + python-version: 3.7 - name: Display Python version run: python -c "import sys; print(sys.version)" @@ -58,4 +58,4 @@ jobs: with: args: --short --error-format=github env: - DOCS_DIR: 'docs/' + DOCS_DIR: docs/ diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index f1ac9503..fc60d6e3 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -22,13 +22,20 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Run PHP-CS-Fixer - uses: docker://oskarstark/php-cs-fixer-ga:3.0.0 + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 with: - args: --ansi --verbose --diff --dry-run + php-version: 8.0 + coverage: none + tools: composer:v2, php-cs-fixer:3 + env: + COMPOSER_TOKEN: $ - composer-normalize: - name: composer-normalize + - name: Lint PHP files + run: make lint-php + + composer: + name: Composer runs-on: ubuntu-latest @@ -36,10 +43,17 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Run composer-normalize - uses: docker://ergebnis/composer-normalize-action:0.8.0 + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 with: - args: --dry-run + php-version: 8.0 + coverage: none + tools: composer:v2, composer-normalize:2 + env: + COMPOSER_TOKEN: $ + + - name: Lint Composer + run: make lint-composer yaml-files: name: YAML files @@ -53,7 +67,7 @@ jobs: - name: Install Ruby 2.6 uses: actions/setup-ruby@v1 with: - ruby-version: '2.6' + ruby-version: 2.6 - name: Install required gem run: gem install yaml-lint diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index b655a766..42b348cc 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -31,13 +31,13 @@ jobs: extensions: mongodb-1.9.0, zip - name: Install Composer dependencies (highest) - uses: "ramsey/composer-install@v1" + uses: ramsey/composer-install@v1 with: - dependency-versions: "highest" - composer-options: "--prefer-dist --prefer-stable" + dependency-versions: highest + composer-options: --prefer-dist --prefer-stable - name: PHPStan - run: vendor/bin/phpstan --memory-limit=1G analyse + run: vendor/bin/phpstan --memory-limit=1G analyse --error-format=github psalm: name: Psalm @@ -56,10 +56,10 @@ jobs: extensions: mongodb-1.9.0, zip - name: Install Composer dependencies (highest) - uses: "ramsey/composer-install@v1" + uses: ramsey/composer-install@v1 with: - dependency-versions: "highest" - composer-options: "--prefer-dist --prefer-stable" + dependency-versions: highest + composer-options: --prefer-dist --prefer-stable - name: Psalm run: vendor/bin/psalm --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.0 diff --git a/.github/workflows/stale.yaml b/.github/workflows/stale.yaml index 6ddf10f0..0eab92da 100644 --- a/.github/workflows/stale.yaml +++ b/.github/workflows/stale.yaml @@ -8,7 +8,7 @@ name: Stale on: schedule: - - cron: "0 9-18 * * *" + - cron: 0 9-18 * * * jobs: stale: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index dc6055a5..892e781a 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,27 +32,27 @@ jobs: strategy: matrix: php-version: - - '7.3' - - '7.4' - - '8.0' + - 7.3 + - 7.4 + - 8.0 dependencies: [highest] allowed-to-fail: [false] - symfony-require: [""] + symfony-require: [''] variant: [normal] include: - - php-version: '7.3' + - php-version: 7.3 dependencies: lowest allowed-to-fail: false variant: normal - - php-version: '8.0' + - php-version: 8.0 dependencies: highest allowed-to-fail: false - variant: 'sonata-project/admin-bundle:"3.*"' - - php-version: '8.0' + variant: sonata-project/admin-bundle:"3.*" + - php-version: 8.0 dependencies: highest allowed-to-fail: false symfony-require: 4.4.* - variant: 'symfony/symfony:"4.4.*"' + variant: symfony/symfony:"4.4.*" steps: - name: Checkout @@ -69,9 +69,9 @@ jobs: - name: Add PHPUnit matcher run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" - - name: "Globally install symfony/flex" + - name: Globally install symfony/flex if: matrix.symfony-require != '' - run: "composer global require --no-progress --no-scripts --no-plugins symfony/flex" + run: composer global require --no-progress --no-scripts --no-plugins symfony/flex - name: Install variant if: matrix.variant != 'normal' && !startsWith(matrix.variant, 'symfony/symfony') @@ -84,16 +84,16 @@ jobs: if: matrix.symfony-require == '6.0.*' run: composer remove vimeo/psalm psalm/plugin-phpunit psalm/plugin-symfony weirdan/doctrine-psalm-plugin --dev --no-update --no-interaction - - name: "Install Composer dependencies (${{ matrix.dependencies }})" - uses: "ramsey/composer-install@v1" + - name: Install Composer dependencies (${{ matrix.dependencies }}) + uses: ramsey/composer-install@v1 with: - dependency-versions: "${{ matrix.dependencies }}" - composer-options: "--prefer-dist --prefer-stable" + dependency-versions: ${{ matrix.dependencies }} + composer-options: --prefer-dist --prefer-stable - name: Run Tests with coverage run: make coverage - name: Send coverage to Codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 with: file: build/logs/clover.xml diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 905971f8..534b2184 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -24,16 +24,12 @@ '@PHPUnit60Migration:risky' => true, '@Symfony' => true, '@Symfony:risky' => true, - 'array_syntax' => [ - 'syntax' => 'short', - ], + 'array_syntax' => ['syntax' => 'short'], 'combine_consecutive_issets' => true, 'combine_consecutive_unsets' => true, 'compact_nullable_typehint' => true, 'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false], - 'header_comment' => [ - 'header' => $header, - ], + 'header_comment' => ['header' => $header], 'list_syntax' => ['syntax' => 'short'], 'logical_operators' => true, 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], @@ -56,6 +52,7 @@ 'static_lambda' => true, 'strict_comparison' => true, 'strict_param' => true, + 'types_spaces' => ['space' => 'single'], 'void_return' => false, ]; diff --git a/Makefile b/Makefile index bf55c4bc..ff76e5a8 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ lint: lint-composer lint-yaml lint-xml lint-xliff lint-php .PHONY: lint lint-composer: + composer-normalize --dry-run composer validate .PHONY: lint-composer @@ -46,7 +47,7 @@ lint-php: php-cs-fixer fix --ansi --verbose --diff --dry-run .PHONY: lint-php -cs-fix: cs-fix-php cs-fix-xml cs-fix-xliff +cs-fix: cs-fix-php cs-fix-xml cs-fix-xliff cs-fix-composer .PHONY: cs-fix cs-fix-php: @@ -73,15 +74,19 @@ cs-fix-xliff: done .PHONY: cs-fix-xliff +cs-fix-composer: + composer-normalize +.PHONY: cs-fix-composer + build: mkdir $@ test: - vendor/bin/simple-phpunit -c phpunit.xml.dist + vendor/bin/phpunit -c phpunit.xml.dist .PHONY: test coverage: - vendor/bin/simple-phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml + vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover build/logs/clover.xml .PHONY: coverage docs: diff --git a/phpunit.xml.dist b/phpunit.xml.dist index dbf05520..2f89d1c6 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -26,6 +26,10 @@ It's auto-generated by sonata-project/dev-kit package. + + + + @@ -33,8 +37,6 @@ It's auto-generated by sonata-project/dev-kit package. - - From bc9ac6a11c4d4ed129a24a127253a324748b0a2e Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sun, 17 Oct 2021 12:58:04 +0000 Subject: [PATCH 2/5] DevKit updates --- .github/workflows/lint.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index fc60d6e3..83519afc 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -29,7 +29,7 @@ jobs: coverage: none tools: composer:v2, php-cs-fixer:3 env: - COMPOSER_TOKEN: $ + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Lint PHP files run: make lint-php @@ -50,7 +50,7 @@ jobs: coverage: none tools: composer:v2, composer-normalize:2 env: - COMPOSER_TOKEN: $ + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Lint Composer run: make lint-composer From 07345a56dc53889a57b6b7b7abe3ccd7dadd9727 Mon Sep 17 00:00:00 2001 From: SonataCI Date: Sun, 17 Oct 2021 13:48:31 +0000 Subject: [PATCH 3/5] DevKit updates --- .github/workflows/documentation.yaml | 2 +- .github/workflows/lint.yaml | 6 +++--- .github/workflows/qa.yaml | 4 ++-- .github/workflows/test.yaml | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index 308e2bb7..5a3b4b07 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -25,7 +25,7 @@ jobs: - name: Set up Python 3.7 uses: actions/setup-python@v2 with: - python-version: 3.7 + python-version: '3.7' - name: Display Python version run: python -c "import sys; print(sys.version)" diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 83519afc..8b0b988f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -25,7 +25,7 @@ jobs: - name: Install PHP with extensions uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: '8.0' coverage: none tools: composer:v2, php-cs-fixer:3 env: @@ -46,7 +46,7 @@ jobs: - name: Install PHP with extensions uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: '8.0' coverage: none tools: composer:v2, composer-normalize:2 env: @@ -67,7 +67,7 @@ jobs: - name: Install Ruby 2.6 uses: actions/setup-ruby@v1 with: - ruby-version: 2.6 + ruby-version: '2.6' - name: Install required gem run: gem install yaml-lint diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 42b348cc..83a7c432 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -25,7 +25,7 @@ jobs: - name: Install PHP with extensions uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: '8.0' coverage: none tools: composer:v2 extensions: mongodb-1.9.0, zip @@ -50,7 +50,7 @@ jobs: - name: Install PHP with extensions uses: shivammathur/setup-php@v2 with: - php-version: 8.0 + php-version: '8.0' coverage: none tools: composer:v2 extensions: mongodb-1.9.0, zip diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 892e781a..01dcd812 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -32,23 +32,23 @@ jobs: strategy: matrix: php-version: - - 7.3 - - 7.4 - - 8.0 + - '7.3' + - '7.4' + - '8.0' dependencies: [highest] allowed-to-fail: [false] symfony-require: [''] variant: [normal] include: - - php-version: 7.3 + - php-version: '7.3' dependencies: lowest allowed-to-fail: false variant: normal - - php-version: 8.0 + - php-version: '8.0' dependencies: highest allowed-to-fail: false variant: sonata-project/admin-bundle:"3.*" - - php-version: 8.0 + - php-version: '8.0' dependencies: highest allowed-to-fail: false symfony-require: 4.4.* From 016e674e6c086706f0c1596a9c122e1d435e77e1 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 17 Oct 2021 19:44:26 +0200 Subject: [PATCH 4/5] Add phpunit/phpunit as dev dependency --- composer.json | 9 +-------- phpstan.neon.dist | 3 --- psalm.xml | 2 +- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index 9f99a71c..52f84d3e 100644 --- a/composer.json +++ b/composer.json @@ -53,6 +53,7 @@ "phpstan/phpstan": "^0.12.52", "phpstan/phpstan-phpunit": "^0.12.17", "phpstan/phpstan-symfony": "^0.12.20", + "phpunit/phpunit": "^9.5", "psalm/plugin-phpunit": "^0.15.1", "psalm/plugin-symfony": "^2.0", "symfony/browser-kit": "^4.4 || ^5.1", @@ -78,13 +79,5 @@ "psr-4": { "Sonata\\DoctrineMongoDBAdminBundle\\Tests\\": "tests/" } - }, - "scripts": { - "post-install-cmd": [ - "[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/simple-phpunit install" - ], - "post-update-cmd": [ - "[ $COMPOSER_DEV_MODE -eq 0 ] || vendor/bin/simple-phpunit install" - ] } } diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 7fc5947a..87d8daf8 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -4,9 +4,6 @@ includes: parameters: level: 2 - bootstrapFiles: - - vendor/bin/.phpunit/phpunit/vendor/autoload.php - paths: - src - tests diff --git a/psalm.xml b/psalm.xml index 3cd9c6ee..dd6945bb 100644 --- a/psalm.xml +++ b/psalm.xml @@ -1,5 +1,5 @@ - + From 759902ed4b36aaa1c185ab23d10fba2db9577ca2 Mon Sep 17 00:00:00 2001 From: Fran Moreno Date: Sun, 17 Oct 2021 21:56:38 +0200 Subject: [PATCH 5/5] Simplify phpdoc --- src/Datagrid/ProxyQuery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Datagrid/ProxyQuery.php b/src/Datagrid/ProxyQuery.php index f4450df9..c8886f6c 100644 --- a/src/Datagrid/ProxyQuery.php +++ b/src/Datagrid/ProxyQuery.php @@ -70,7 +70,7 @@ public function __clone() /** * @psalm-suppress TooManyTemplateParams until release of doctrine/mongodb-odm 2.3 * - * @return \Traversable&Iterator + * @return Iterator */ public function execute() {