From 3dd89944a471150e7dd5b4ab9cb9b2c32cb8700b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Tue, 2 May 2023 10:25:19 +0200 Subject: [PATCH] Enhancement: Synchronize with ergebnis/php-package-template --- .gitattributes | 1 + .github/CODEOWNERS | 2 + .github/CONTRIBUTING.md | 53 +++++++++---- .github/settings.yml | 37 +++++---- .github/workflows/integrate.yaml | 117 ++++++++++++++++++++++++++--- .github/workflows/merge.yaml | 2 +- .github/workflows/prune.yaml | 35 --------- .github/workflows/renew.yaml | 2 +- .gitignore | 2 + .phive/phars.xml | 2 +- Makefile | 34 ++++++--- README.md | 7 +- composer-require-checker.json | 18 +---- composer.json | 1 + composer.lock | 125 ++++++++++++++++++++++++++++++- infection.json | 2 +- psalm.xml | 3 + rector.php | 33 ++++++++ test/Util/Helper.php | 2 +- 19 files changed, 363 insertions(+), 115 deletions(-) delete mode 100644 .github/workflows/prune.yaml create mode 100644 rector.php diff --git a/.gitattributes b/.gitattributes index 9daaa22d..391a4384 100644 --- a/.gitattributes +++ b/.gitattributes @@ -12,3 +12,4 @@ /Makefile export-ignore /psalm-baseline.xml export-ignore /psalm.xml export-ignore +/rector.php export-ignore diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 01c24919..21dd5340 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,3 @@ +# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners + * @ergebnis-bot @localheinz diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index a8c04a0c..4cc7edf5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -6,7 +6,6 @@ For details, take a look at the following workflow configuration files: - [`workflows/integrate.yaml`](workflows/integrate.yaml) - [`workflows/merge.yaml`](workflows/merge.yaml) -- [`workflows/prune.yaml`](workflows/prune.yaml) - [`workflows/release.yaml`](workflows/release.yaml) - [`workflows/renew.yaml`](workflows/renew.yaml) - [`workflows/triage.yaml`](workflows/triage.yaml) @@ -47,9 +46,45 @@ make dependency-analysis to run a dependency analysis. +## Mutation Tests + +We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests. + +Enable `Xdebug` and run + +```sh +make mutation-tests +``` + +to run mutation tests. + +## Refactoring + +We are using [`rector/rector`](https://github.com/rectorphp/rector) to automatically refactor code. + +Run + +```sh +make refactoring +``` + +to automatically refactor code. + +## Security Analysis + +We are using [`composer`](https://github.com/composer/composer) to run a security analysis. + +Run + +```sh +make security-analysis +``` + +to run a security analysis. + ## Static Code Analysis -We are using [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code. +We are using [`phpstan/phpstan`](https://github.com/phpstan/phpstan) and [`vimeo/psalm`](https://github.com/vimeo/psalm) to statically analyze the code. Run @@ -83,18 +118,6 @@ make tests to run all the tests. -## Mutation Tests - -We are using [`infection/infection`](https://github.com/infection/infection) to ensure a minimum quality of the tests. - -Enable `pcov` or `Xdebug` and run - -```sh -make mutation-tests -``` - -to run mutation tests. - ## Extra lazy? Run @@ -103,7 +126,7 @@ Run make ``` -to enforce coding standards, run a static code analysis, and run tests! +to automatically refactor code, enforce coding standards, run a static code analysis, and run tests! ## Help diff --git a/.github/settings.yml b/.github/settings.yml index 026ae1ba..133208e2 100644 --- a/.github/settings.yml +++ b/.github/settings.yml @@ -13,21 +13,23 @@ branches: require_code_owner_reviews: true required_approving_review_count: 1 required_status_checks: - contexts: - - "Code Coverage (8.0, locked)" - - "Coding Standards (8.0, locked)" - - "Dependency Analysis (8.0, locked)" - - "Mutation Tests (8.0, locked)" - - "Static Code Analysis (8.0, locked)" - - "Tests (8.0, highest)" - - "Tests (8.0, locked)" - - "Tests (8.0, lowest)" - - "Tests (8.1, highest)" - - "Tests (8.1, locked)" - - "Tests (8.1, lowest)" - - "Tests (8.2, highest)" - - "Tests (8.2, locked)" - - "Tests (8.2, lowest)" + checks: + - context: "Code Coverage (8.0, locked)" + - context: "Coding Standards (8.0, locked)" + - context: "Dependency Analysis (8.0, locked)" + - context: "Mutation Tests (8.0, locked)" + - context: "Refactoring (8.0, locked)" + - context: "Security Analysis (8.0, locked)" + - context: "Static Code Analysis (8.0, locked)" + - context: "Tests (8.0, highest)" + - context: "Tests (8.0, locked)" + - context: "Tests (8.0, lowest)" + - context: "Tests (8.1, highest)" + - context: "Tests (8.1, locked)" + - context: "Tests (8.1, lowest)" + - context: "Tests (8.2, highest)" + - context: "Tests (8.2, locked)" + - context: "Tests (8.2, lowest)" strict: false restrictions: @@ -65,10 +67,6 @@ labels: color: "ee0701" description: "" - - name: "stale" - color: "eeeeee" - description: "" - # https://docs.github.com/en/rest/reference/repos#update-a-repository repository: @@ -81,6 +79,7 @@ repository: description: ":page_with_curl: Provides JSON pointer as a value object." enable_automated_security_fixes: true enable_vulnerability_alerts: true + has_discussions: false has_downloads: true has_issues: true has_pages: false diff --git a/.github/workflows/integrate.yaml b/.github/workflows/integrate.yaml index 1fd95be0..4dcfb647 100644 --- a/.github/workflows/integrate.yaml +++ b/.github/workflows/integrate.yaml @@ -57,12 +57,13 @@ jobs: - name: "Collect code coverage with Xdebug and phpunit/phpunit" env: XDEBUG_MODE: "coverage" - run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml" + run: "vendor/bin/phpunit --colors=always --configuration=test/Unit/phpunit.xml --coverage-clover=.build/phpunit/logs/clover.xml" - - name: "Send code coverage report to Codecov.io" - env: - CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}" - run: "bash <(curl -s https://codecov.io/bash)" + - name: "Send code coverage report to codecov.io" + uses: "codecov/codecov-action@v3.1.3" + with: + files: ".build/phpunit/logs/clover.xml" + token: "${{ secrets.CODECOV_TOKEN }}" coding-standards: name: "Coding Standards" @@ -82,7 +83,7 @@ jobs: uses: "actions/checkout@v3.5.2" - name: "Lint YAML files" - uses: "ibiqlik/action-yamllint@v3.1" + uses: "ibiqlik/action-yamllint@v3.1.1" with: config_file: ".yamllint.yaml" file_or_dir: "." @@ -132,7 +133,7 @@ jobs: php-${{ matrix.php-version }}-php-cs-fixer- - name: "Run friendsofphp/php-cs-fixer" - run: "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --dry-run --verbose" + run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --dry-run --verbose" dependency-analysis: name: "Dependency Analysis" @@ -157,6 +158,7 @@ jobs: coverage: "none" extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" + tools: "phive" - name: "Set up problem matchers for PHP" run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" @@ -176,6 +178,11 @@ jobs: with: dependencies: "${{ matrix.dependencies }}" + - name: "Install dependencies with phive" + uses: "ergebnis/.github/actions/phive/install@1.8.0" + with: + trust-gpg-keys: "0x033E5F8D801A2F8D" + - name: "Run maglnet/composer-require-checker" run: ".phive/composer-require-checker check --config-file=$(pwd)/composer-require-checker.json" @@ -224,7 +231,97 @@ jobs: - name: "Run mutation tests with Xdebug and infection/infection" env: XDEBUG_MODE: "coverage" - run: "vendor/bin/infection --configuration=infection.json --logger-github" + run: "vendor/bin/infection --ansi --configuration=infection.json --logger-github" + + refactoring: + name: "Refactoring" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + php-version: + - "8.0" + + dependencies: + - "locked" + + steps: + - name: "Checkout" + uses: "actions/checkout@v3.5.2" + + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.25.1" + with: + coverage: "none" + extensions: "none, ctype, dom, intl, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + php-version: "${{ matrix.php-version }}" + + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + + - name: "Determine composer cache directory" + uses: "ergebnis/.github/actions/composer/determine-cache-directory@1.8.0" + + - name: "Cache dependencies installed with composer" + uses: "actions/cache@v3.3.1" + with: + path: "${{ env.COMPOSER_CACHE_DIR }}" + key: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('composer.lock') }}" + restore-keys: "php-${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-" + + - name: "Install ${{ matrix.dependencies }} dependencies with composer" + uses: "ergebnis/.github/actions/composer/install@1.8.0" + with: + dependencies: "${{ matrix.dependencies }}" + + - name: "Create cache directory for rector/rector" + run: "mkdir -p .build/rector" + + - name: "Cache cache directory for rector/rector" + uses: "actions/cache@v3.3.1" + with: + path: ".build/rector" + key: "php-${{ matrix.php-version }}-rector-${{ github.ref_name }}" + restore-keys: | + php-${{ matrix.php-version }}-rector-main + php-${{ matrix.php-version }}-rector- + + - name: "Run automated refactoring with rector/rector" + run: "vendor/bin/rector --ansi --config=rector.php --dry-run" + + security-analysis: + name: "Security Analysis" + + runs-on: "ubuntu-latest" + + strategy: + matrix: + php-version: + - "8.0" + + dependencies: + - "locked" + + steps: + - name: "Checkout" + uses: "actions/checkout@v3.5.2" + + - name: "Set up PHP" + uses: "shivammathur/setup-php@2.25.1" + with: + coverage: "none" + extensions: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter" + php-version: "${{ matrix.php-version }}" + + - name: "Set up problem matchers for PHP" + run: "echo \"::add-matcher::${{ runner.tool_cache }}/php.json\"" + + - name: "Validate composer.json and composer.lock" + run: "composer validate --ansi --strict" + + - name: "Check installed packages for security vulnerability advisories" + run: "composer audit --ansi" static-code-analysis: name: "Static Code Analysis" @@ -247,7 +344,7 @@ jobs: uses: "shivammathur/setup-php@2.25.1" with: coverage: "none" - extensions: "none, ctype, curl, dom, json, mbstring, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter" + extensions: "none, ctype, curl, dom, json, mbstring, opcache, pcntl, phar, posix, simplexml, tokenizer, xml, xmlwriter" php-version: "${{ matrix.php-version }}" - name: "Set up problem matchers for PHP" @@ -324,4 +421,4 @@ jobs: dependencies: "${{ matrix.dependencies }}" - name: "Run unit tests with phpunit/phpunit" - run: "vendor/bin/phpunit --configuration=test/Unit/phpunit.xml" + run: "vendor/bin/phpunit --colors=always --configuration=test/Unit/phpunit.xml" diff --git a/.github/workflows/merge.yaml b/.github/workflows/merge.yaml index 5ad9183e..39279b01 100644 --- a/.github/workflows/merge.yaml +++ b/.github/workflows/merge.yaml @@ -33,8 +33,8 @@ jobs: - name: "Assign @ergebnis-bot" uses: "ergebnis/.github/actions/github/pull-request/add-assignee@1.8.0" with: - github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" assignee: "ergebnis-bot" + github-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - name: "Approve pull request" uses: "ergebnis/.github/actions/github/pull-request/approve@1.8.0" diff --git a/.github/workflows/prune.yaml b/.github/workflows/prune.yaml deleted file mode 100644 index b328f7f9..00000000 --- a/.github/workflows/prune.yaml +++ /dev/null @@ -1,35 +0,0 @@ -# https://docs.github.com/en/actions - -name: "Prune" - -on: # yamllint disable-line rule:truthy - schedule: - - cron: "0 12 * * *" - -env: - DAYS_BEFORE_CLOSE: 14 - DAYS_BEFORE_STALE: 180 - -jobs: - prune: - name: "Issues" - - runs-on: "ubuntu-latest" - - steps: - - name: "Prune issues and pull requests" - uses: "actions/stale@v8.0.0" - with: - days-before-close: "${{ env.DAYS_BEFORE_CLOSE }}" - days-before-stale: "${{ env.DAYS_BEFORE_STALE }}" - repo-token: "${{ secrets.ERGEBNIS_BOT_TOKEN }}" - stale-issue-label: "stale" - stale-issue-message: | - Since this issue has not had any activity within the last ${{ env.DAYS_BEFORE_STALE }} days, I have marked it as stale. - - I will close it if no further activity occurs within the next ${{ env.DAYS_BEFORE_CLOSE }} days. - stale-pr-label: "stale" - stale-pr-message: | - Since this pull request has not had any activity within the last ${{ env.DAYS_BEFORE_STALE }} days, I have marked it as stale. - - I will close it if no further activity occurs within the next ${{ env.DAYS_BEFORE_CLOSE }} days. diff --git a/.github/workflows/renew.yaml b/.github/workflows/renew.yaml index 9958199a..efac7759 100644 --- a/.github/workflows/renew.yaml +++ b/.github/workflows/renew.yaml @@ -67,7 +67,7 @@ jobs: php-${{ matrix.php-version }}-php-cs-fixer- - name: "Run friendsofphp/php-cs-fixer" - run: "vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose" + run: "vendor/bin/php-cs-fixer fix --ansi --config=.php-cs-fixer.php --diff --verbose" - name: "Commit modified files" uses: "stefanzweifel/git-auto-commit-action@v4.16.0" diff --git a/.gitignore b/.gitignore index 0d234cb8..c6b4dc9c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ /.build/ /.notes/ +/.phive/ /vendor/ +!/.phive/phars.xml diff --git a/.phive/phars.xml b/.phive/phars.xml index d7a8a866..bf021503 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,4 +1,4 @@ - + diff --git a/Makefile b/Makefile index 38951c97..fa679990 100644 --- a/Makefile +++ b/Makefile @@ -1,20 +1,20 @@ .PHONY: it -it: coding-standards static-code-analysis tests ## Runs the coding-standards, static-code-analysis, and tests targets +it: refactoring coding-standards security-analysis static-code-analysis tests ## Runs the refactoring, coding-standards, security-analysis, static-code-analysis, and tests targets .PHONY: code-coverage code-coverage: vendor ## Collects coverage from running unit tests with phpunit/phpunit - mkdir -p .build/phpunit + mkdir -p .build/phpunit/ vendor/bin/phpunit --configuration=test/Unit/phpunit.xml --coverage-text .PHONY: coding-standards -coding-standards: vendor ## Normalizes composer.json with ergebnis/composer-normalize, lints YAML files with yamllint and fixes code style issues with friendsofphp/php-cs-fixer - composer normalize +coding-standards: vendor ## Lints YAML files with yamllint, normalizes composer.json with ergebnis/composer-normalize, and fixes code style issues with friendsofphp/php-cs-fixer yamllint -c .yamllint.yaml --strict . - mkdir -p .build/php-cs-fixer + composer normalize + mkdir -p .build/php-cs-fixer/ vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --verbose .PHONY: dependency-analysis -dependency-analysis: vendor ## Runs a dependency analysis with maglnet/composer-require-checker +dependency-analysis: phive vendor ## Runs a dependency analysis with maglnet/composer-require-checker .phive/composer-require-checker check --config-file=$(shell pwd)/composer-require-checker.json .PHONY: help @@ -23,24 +23,38 @@ help: ## Displays this list of targets with descriptions .PHONY: mutation-tests mutation-tests: vendor ## Runs mutation tests with infection/infection - mkdir -p .build/infection + mkdir -p .build/infection/ vendor/bin/infection --configuration=infection.json +.PHONY: phive +phive: .phive ## Installs dependencies with phive + mkdir -p .build/phive/ + PHIVE_HOME=.build/phive phive install --trust-gpg-keys 0x033E5F8D801A2F8D + +.PHONY: refactoring +refactoring: vendor ## Runs automated refactoring with rector/rector + mkdir -p .build/rector/ + vendor/bin/rector process --config=rector.php + +.PHONY: security-analysis +security-analysis: vendor ## Runs a security analysis with composer + composer audit + .PHONY: static-code-analysis static-code-analysis: vendor ## Runs a static code analysis with vimeo/psalm - mkdir -p .build/psalm + mkdir -p .build/psalm/ vendor/bin/psalm --config=psalm.xml --clear-cache vendor/bin/psalm --config=psalm.xml --show-info=false --stats --threads=4 .PHONY: static-code-analysis-baseline static-code-analysis-baseline: vendor ## Generates a baseline for static code analysis with vimeo/psalm - mkdir -p .build/psalm + mkdir -p .build/psalm/ vendor/bin/psalm --config=psalm.xml --clear-cache vendor/bin/psalm --config=psalm.xml --set-baseline=psalm-baseline.xml .PHONY: tests tests: vendor ## Runs unit tests with phpunit/phpunit - mkdir -p .build/phpunit + mkdir -p .build/phpunit/ vendor/bin/phpunit --configuration=test/Unit/phpunit.xml vendor: composer.json composer.lock diff --git a/README.md b/README.md index 8d04b57c..516b295c 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # json-pointer [![Integrate](https://github.com/ergebnis/json-pointer/workflows/Integrate/badge.svg)](https://github.com/ergebnis/json-pointer/actions) -[![Prune](https://github.com/ergebnis/json-pointer/workflows/Prune/badge.svg)](https://github.com/ergebnis/json-pointer/actions) +[![Merge](https://github.com/ergebnis/json-pointer/workflows/Merge/badge.svg)](https://github.com/ergebnis/json-pointer/actions) [![Release](https://github.com/ergebnis/json-pointer/workflows/Release/badge.svg)](https://github.com/ergebnis/json-pointer/actions) [![Renew](https://github.com/ergebnis/json-pointer/workflows/Renew/badge.svg)](https://github.com/ergebnis/json-pointer/actions) @@ -10,6 +10,7 @@ [![Latest Stable Version](https://poser.pugx.org/ergebnis/json-pointer/v/stable)](https://packagist.org/packages/ergebnis/json-pointer) [![Total Downloads](https://poser.pugx.org/ergebnis/json-pointer/downloads)](https://packagist.org/packages/ergebnis/json-pointer) +[![Monthly Downloads](http://poser.pugx.org/ergebnis/json-pointer/d/monthly)](https://packagist.org/packages/ergebnis/json-pointer) Provides [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901) as a value object. @@ -327,6 +328,6 @@ This package is licensed using the MIT License. Please have a look at [`LICENSE.md`](LICENSE.md). -## Curious what I am building? +## Curious what I am up to? -:mailbox_with_mail: [Subscribe to my list](https://localheinz.com/projects/), and I will occasionally send you an email to let you know what I am working on. +Follow me on [Twitter](https://twitter.com/intent/follow?screen_name=localheinz)! diff --git a/composer-require-checker.json b/composer-require-checker.json index 67d0aa16..b8b091ad 100644 --- a/composer-require-checker.json +++ b/composer-require-checker.json @@ -1,19 +1,3 @@ { - "symbol-whitelist": [ - "array", - "bool", - "callable", - "false", - "float", - "int", - "iterable", - "null", - "object", - "parent", - "self", - "static", - "string", - "true", - "void" - ] + "symbol-whitelist": [] } diff --git a/composer.json b/composer.json index 428f14cd..ef38eaa6 100644 --- a/composer.json +++ b/composer.json @@ -31,6 +31,7 @@ "infection/infection": "~0.26.19", "phpunit/phpunit": "^9.6.7", "psalm/plugin-phpunit": "~0.18.4", + "rector/rector": "~0.15.25", "vimeo/psalm": "^5.9.0" }, "autoload": { diff --git a/composer.lock b/composer.lock index 5de62897..36eee261 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": "2e9a025513ca17cc69c76a2dc8185ea6", + "content-hash": "6a16d5718f815644d1a5177c26bf7224", "packages": [], "packages-dev": [ { @@ -2620,6 +2620,68 @@ }, "time": "2023-02-07T18:11:17+00:00" }, + { + "name": "phpstan/phpstan", + "version": "1.10.14", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "d232901b09e67538e5c86a724be841bea5768a7c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/d232901b09e67538e5c86a724be841bea5768a7c", + "reference": "d232901b09e67538e5c86a724be841bea5768a7c", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan", + "type": "tidelift" + } + ], + "time": "2023-04-19T13:47:27+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.26", @@ -3303,6 +3365,67 @@ }, "time": "2021-07-14T16:46:02+00:00" }, + { + "name": "rector/rector", + "version": "0.15.25", + "source": { + "type": "git", + "url": "https://github.com/rectorphp/rector.git", + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/015935c7ed9e48a4f5895ba974f337e20a263841", + "reference": "015935c7ed9e48a4f5895ba974f337e20a263841", + "shasum": "" + }, + "require": { + "php": "^7.2|^8.0", + "phpstan/phpstan": "^1.10.14" + }, + "conflict": { + "rector/rector-doctrine": "*", + "rector/rector-downgrade-php": "*", + "rector/rector-phpunit": "*", + "rector/rector-symfony": "*" + }, + "bin": [ + "bin/rector" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "0.15-dev" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Instant Upgrade and Automated Refactoring of any PHP code", + "keywords": [ + "automation", + "dev", + "migration", + "refactoring" + ], + "support": { + "issues": "https://github.com/rectorphp/rector/issues", + "source": "https://github.com/rectorphp/rector/tree/0.15.25" + }, + "funding": [ + { + "url": "https://github.com/tomasvotruba", + "type": "github" + } + ], + "time": "2023-04-20T16:07:39+00:00" + }, { "name": "sanmai/later", "version": "0.1.2", diff --git a/infection.json b/infection.json index a437f0c4..98476cbd 100644 --- a/infection.json +++ b/infection.json @@ -4,7 +4,7 @@ "text": ".build/infection/infection-log.txt" }, "minCoveredMsi": 100, - "minMsi": 84, + "minMsi": 100, "phpUnit": { "configDir": "test\/Unit" }, diff --git a/psalm.xml b/psalm.xml index 12df516b..00713658 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,6 +6,8 @@ cacheDirectory=".build/psalm" errorBaseline="psalm-baseline.xml" errorLevel="1" + findUnusedBaselineEntry="true" + findUnusedCode="true" findUnusedVariablesAndParams="true" resolveFromConfigFile="true" strictBinaryOperands="true" @@ -17,6 +19,7 @@ + diff --git a/rector.php b/rector.php new file mode 100644 index 00000000..208d7a60 --- /dev/null +++ b/rector.php @@ -0,0 +1,33 @@ +cacheDirectory(__DIR__ . '/.build/rector/'); + + $rectorConfig->import(__DIR__ . '/vendor/fakerphp/faker/rector-migrate.php'); + + $rectorConfig->paths([ + __DIR__ . '/src/', + __DIR__ . '/test/', + ]); + + $rectorConfig->phpVersion(Core\ValueObject\PhpVersion::PHP_80); + + $rectorConfig->sets([ + PHPUnit\Set\PHPUnitSetList::PHPUNIT_90, + ]); +}; diff --git a/test/Util/Helper.php b/test/Util/Helper.php index 8d7e8649..ae3322d5 100644 --- a/test/Util/Helper.php +++ b/test/Util/Helper.php @@ -21,7 +21,7 @@ trait Helper final protected static function faker(string $locale = 'en_US'): Generator { /** - * @var array $fakers + * @var array */ static $fakers = [];