From 7ef74afa7c23964f4a77e828e4291452a12fda2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Sat, 7 Dec 2019 17:28:47 +0100 Subject: [PATCH] Enhancement: Synchronize with ergebnis/php-library-template --- .github/CONTRIBUTING.md | 2 +- .github/workflows/continuous-integration.yml | 87 ++++++++++---------- Makefile | 6 +- composer.json | 1 + composer.lock | 46 ++++++++++- phpstan.neon | 7 +- 6 files changed, 92 insertions(+), 57 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index c84731f8..ceddbcd7 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -68,7 +68,7 @@ to run all the tests. We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests. -Enable `Xdebug` and run +Enable `pcov` or `Xdebug` and run ``` $ make mutation-tests diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3305bbde..fcf8184b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -23,20 +23,20 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v1 with: coverage: none - extension-csv: "mbstring" + extensions: "mbstring" php-version: ${{ matrix.php-version }} - name: "Validate composer.json and composer.lock" - run: $(which composer) validate --strict + run: composer validate --strict - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} @@ -44,18 +44,18 @@ jobs: php${{ matrix.php-version }}-composer-locked- - name: "Install locked dependencies with composer" - run: $(which composer) install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-suggest - name: "Run localheinz/composer-normalize" - run: $(which composer) normalize --dry-run + run: composer normalize --dry-run - name: "Create cache directory for friendsofphp/php-cs-fixer" run: mkdir -p .build/php-cs-fixer - name: "Cache cache directory for friendsofphp/php-cs-fixer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: - path: ~/.build/php-cs-fixer + path: .build/php-cs-fixer key: php${{ matrix.php-version }}-php-cs-fixer-${{ hashFiles('**/composer.lock') }} restore-keys: | php${{ matrix.php-version }}-php-cs-fixer- @@ -75,17 +75,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v1 with: coverage: none - extension-csv: "mbstring" + extensions: "mbstring" php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} @@ -93,10 +93,10 @@ jobs: php${{ matrix.php-version }}-composer-locked- - name: "Install locked dependencies with composer" - run: $(which composer) install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-suggest - name: "Run maglnet/composer-require-checker" - uses: docker://localheinz/composer-require-checker-action:1.1.0 + uses: docker://localheinz/composer-require-checker-action:1.1.1 static-code-analysis: name: "Static Code Analysis" @@ -110,17 +110,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v1 with: coverage: none - extension-csv: "mbstring" + extensions: "mbstring" php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: path: ~/.composer/cache key: ${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} @@ -128,7 +128,7 @@ jobs: ${{ matrix.php-version }}-composer-locked- - name: "Install locked dependencies with composer" - run: $(which composer) install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-suggest - name: "Run phpstan/phpstan" run: vendor/bin/phpstan analyse --configuration=phpstan.neon @@ -152,17 +152,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v1 with: coverage: none - extension-csv: "mbstring" + extensions: "mbstring" php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.lock') }} @@ -171,15 +171,15 @@ jobs: - name: "Install lowest dependencies with composer" if: matrix.dependencies == 'lowest' - run: $(which composer) update --no-interaction --no-progress --no-suggest --prefer-lowest + run: composer update --no-interaction --no-progress --no-suggest --prefer-lowest - name: "Install locked dependencies with composer" if: matrix.dependencies == 'locked' - run: $(which composer) install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-suggest - name: "Install highest dependencies with composer" if: matrix.dependencies == 'highest' - run: $(which composer) update --no-interaction --no-progress --no-suggest + run: composer update --no-interaction --no-progress --no-suggest - name: "Run auto-review tests with phpunit/phpunit" run: vendor/bin/phpunit --configuration=test/AutoReview/phpunit.xml @@ -202,17 +202,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v1 with: - coverage: xdebug - extension-csv: "mbstring" + coverage: pcov + extensions: "mbstring" php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} @@ -220,13 +220,10 @@ jobs: php${{ matrix.php-version }}-composer-locked- - name: "Install locked dependencies with composer" - run: $(which composer) install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-suggest - - name: "Dump Xdebug filter with phpunit/phpunit" - run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php - - - name: "Collect code coverage with Xdebug and phpunit/phpunit" - run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml --prepend=.build/phpunit/xdebug-filter.php + - name: "Collect code coverage with pcov and phpunit/phpunit" + run: vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=build/logs/clover.xml - name: "Send code coverage report to Codecov.io" env: @@ -245,17 +242,17 @@ jobs: steps: - name: "Checkout" - uses: actions/checkout@v1.1.0 + uses: actions/checkout@v1 - name: "Install PHP with extensions" - uses: shivammathur/setup-php@master + uses: shivammathur/setup-php@v1 with: - coverage: xdebug - extension-csv: "mbstring" + coverage: pcov + extensions: "mbstring" php-version: ${{ matrix.php-version }} - name: "Cache dependencies installed with composer" - uses: actions/cache@v1.0.2 + uses: actions/cache@v1 with: path: ~/.composer/cache key: php${{ matrix.php-version }}-composer-locked-${{ hashFiles('**/composer.lock') }} @@ -263,7 +260,7 @@ jobs: php${{ matrix.php-version }}-composer-locked- - name: "Install locked dependencies with composer" - run: $(which composer) install --no-interaction --no-progress --no-suggest + run: composer install --no-interaction --no-progress --no-suggest - - name: "Run mutation tests with infection/infection" + - name: "Run mutation tests with pcov and infection/infection" run: vendor/bin/infection --ignore-msi-with-no-mutations --min-covered-msi=100 --min-msi=100 diff --git a/Makefile b/Makefile index 21fbad8b..9c72933b 100644 --- a/Makefile +++ b/Makefile @@ -3,9 +3,7 @@ it: coding-standards dependency-analysis static-code-analysis tests ## Runs the .PHONY: code-coverage code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit - mkdir -p .build/phpunit - vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --dump-xdebug-filter=.build/phpunit/xdebug-filter.php - vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text --prepend=.build/phpunit/xdebug-filter.php + vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text .PHONY: coding-standards coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fixer @@ -14,7 +12,7 @@ coding-standards: vendor ## Fixes code style issues with friendsofphp/php-cs-fix .PHONY: dependency-analysis dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker - docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-require-checker-action:1.1.0 + docker run --interactive --rm --tty --workdir=/app --volume ${PWD}:/app localheinz/composer-require-checker-action:1.1.1 .PHONY: help help: ## Displays this list of targets with descriptions diff --git a/composer.json b/composer.json index 7bfb58b0..dcbebc3a 100644 --- a/composer.json +++ b/composer.json @@ -23,6 +23,7 @@ "jangregor/phpstan-prophecy": "~0.4.2", "localheinz/composer-normalize": "^1.3.1", "localheinz/phpstan-rules": "~0.13.0", + "phpstan/extension-installer": "^1.0.3", "phpstan/phpstan": "~0.11.19", "phpstan/phpstan-deprecation-rules": "~0.11.2", "phpstan/phpstan-strict-rules": "~0.11.1", diff --git a/composer.lock b/composer.lock index 8d1315c5..7cc6512c 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "36785227cbda4c51ba156d5f33966b70", + "content-hash": "0e17dc53a6091741c193b9805e5b0397", "packages": [ { "name": "composer/semver", @@ -3129,6 +3129,50 @@ ], "time": "2019-10-03T11:07:50+00:00" }, + { + "name": "phpstan/extension-installer", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "295656793c53b5eb73a38486032ad1bd650264bc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/295656793c53b5eb73a38486032ad1bd650264bc", + "reference": "295656793c53b5eb73a38486032ad1bd650264bc", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.1", + "php": "^7.1", + "phpstan/phpstan": ">=0.11.6" + }, + "require-dev": { + "composer/composer": "^1.8", + "consistence/coding-standard": "^3.8", + "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", + "jakub-onderka/php-parallel-lint": "^1.0", + "phing/phing": "^2.16", + "phpstan/phpstan-strict-rules": "^0.11", + "slevomat/coding-standard": "^5.0.4" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "time": "2019-10-18T17:09:48+00:00" + }, { "name": "phpstan/phpdoc-parser", "version": "0.3.5", diff --git a/phpstan.neon b/phpstan.neon index d9baa936..c092e951 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,17 +1,12 @@ includes: - phpstan-baseline.neon - - vendor/jangregor/phpstan-prophecy/src/extension.neon - - vendor/localheinz/phpstan-rules/rules.neon - - vendor/phpstan/phpstan-deprecation-rules/rules.neon - - vendor/phpstan/phpstan-strict-rules/rules.neon - - vendor/phpstan/phpstan/conf/bleedingEdge.neon - - vendor/phpstan/phpstan/conf/config.levelmax.neon parameters: classesAllowedToBeExtended: - Ergebnis\PhpCsFixer\Config\RuleSet\AbstractRuleSet - Ergebnis\PhpCsFixer\Config\Test\Unit\RuleSet\AbstractRuleSetTestCase inferPrivatePropertyTypeFromConstructor: true + level: max paths: - src - test