From 49e21b71afeb4e5701260ad60c7492832a977ab2 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Thu, 30 Jul 2026 16:53:46 +0200 Subject: [PATCH] Deprecate package in favor of tomasvotruba/type-coverage Rules were merged into tomasvotruba/type-coverage 2.3.0. Mark the package abandoned, document how to switch, and drop the downgraded release build for anywherephp/type-perfect. --- .github/workflows/downgraded_release.yaml | 85 ------------------- README.md | 59 +++++++++++++ build/rector-downgrade-php-74.php | 12 --- .../.github/workflows/auto_closer.yaml | 23 ----- build/target-repository/README.md | 3 - build/target-repository/composer.json | 23 ----- composer.json | 3 +- full-tool-build.sh | 15 ---- 8 files changed, 61 insertions(+), 162 deletions(-) delete mode 100644 .github/workflows/downgraded_release.yaml delete mode 100644 build/rector-downgrade-php-74.php delete mode 100644 build/target-repository/.github/workflows/auto_closer.yaml delete mode 100644 build/target-repository/README.md delete mode 100644 build/target-repository/composer.json delete mode 100644 full-tool-build.sh diff --git a/.github/workflows/downgraded_release.yaml b/.github/workflows/downgraded_release.yaml deleted file mode 100644 index e1cbb62d..00000000 --- a/.github/workflows/downgraded_release.yaml +++ /dev/null @@ -1,85 +0,0 @@ -name: Downgraded Release - -on: - push: - branches: - - main - tags: - - '*' - -jobs: - downgrade_release: - runs-on: ubuntu-latest - - steps: - - uses: "actions/checkout@v5" - with: - token: ${{ secrets.WORKFLOWS_TOKEN || github.token }} - - - - uses: "shivammathur/setup-php@v2" - with: - php-version: 8.4 - coverage: none - - - run: composer install --ansi - - # downgrade /src to PHP 7.4 - - run: vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi - - run: vendor/bin/ecs check src --fix --ansi - - # clear the dev files, the vendor is not shipped as this is a phpstan extension - - run: rm -rf vendor tests ecs.php phpstan.neon phpunit.xml rector.php composer.lock .gitignore .editorconfig full-tool-build.sh - - # remove the original .github, to fully override it with the target repository one below - - run: rm -rf .github - - # copy PHP 7.4 composer + workflows - - run: cp -r build/target-repository/. . - - # clear the build files - - run: rm -rf build - - # clone the remote repository, so we can commit on top of its history and push without --force - # inspired by https://github.com/easy-coding-standard/ecs-src/blob/main/.github/workflows/buid_release.yaml - - - uses: "actions/checkout@v5" - with: - repository: anywherephp/type-perfect - path: remote-repository - token: ${{ secrets.WORKFLOWS_TOKEN }} - - # remove remote files, to avoid piling up dead code in remote repository - - run: rm -rf remote-repository/src remote-repository/config remote-repository/.github - - # copy the downgraded code to the remote repository - - run: rsync -a --exclude .git --exclude remote-repository ./ remote-repository/ - - # setup git user - - - working-directory: remote-repository - run: | - git config user.email "tomas@getrector.org" - git config user.name "rector-bot" - - # publish to remote repository without tag - - - name: "Push Downgraded Code - branch" - working-directory: remote-repository - if: "!startsWith(github.ref, 'refs/tags/')" - run: | - git add --all - git commit -m "Updated TypePerfect to commit ${{ github.event.after }}" - git push --quiet origin main - - # publish to remote repository with tag - - - name: "Push Downgraded Code - tag" - working-directory: remote-repository - if: "startsWith(github.ref, 'refs/tags/')" - run: | - git add --all - git commit --allow-empty -m "TypePerfect ${GITHUB_REF#refs/tags/}" - git push --quiet origin main - git tag "${GITHUB_REF#refs/tags/}" -m "${GITHUB_REF#refs/tags/}" - git push --quiet origin "${GITHUB_REF#refs/tags/}" diff --git a/README.md b/README.md index e575f27f..8eb605ec 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,18 @@ [![Downloads](https://img.shields.io/packagist/dt/rector/type-perfect.svg?style=flat-square)](https://packagist.org/packages/rector/type-perfect/stats) +> [!WARNING] +> **This package is deprecated and no longer maintained.** +> +> Its rules have been merged into [tomasvotruba/type-coverage](https://github.com/TomasVotruba/type-coverage) since version 2.3.0. Use that package instead: +> +> ```bash +> composer remove rector/type-perfect --dev +> composer require tomasvotruba/type-coverage --dev +> ``` +> +> See [How to switch](#how-to-switch) below. + Next level type declaration check PHPStan rules. We use these sets to improve code quality of our clients' code beyond PHPStan features. @@ -14,8 +26,55 @@ If you care about code quality and type safety, add these 10 rules to your CI.
+## How to switch + +### 1. Swap the package + +```diff + "require-dev": { +- "rector/type-perfect": "^2.1" ++ "tomasvotruba/type-coverage": "^2.3" + } +``` + +Type Coverage requires PHP `^8.4` (Type Perfect required `^8.2`). + +If you already use `tomasvotruba/type-coverage`, only remove `rector/type-perfect` — keeping both loads every rule twice. + +### 2. Keep your `ignoreErrors` as they are + +Rules keep the `Rector\TypePerfect\` namespace in Type Coverage, so existing ignore patterns and baselines still match. The extension is registered by [`phpstan/extension-installer`](https://github.com/phpstan/extension-installer#usage), so no `includes` change is needed either. + +### 3. Enable the rules that used to be on by default + +`NoParamTypeRemovalRule`, `NoIssetOnObjectRule` and `NoEmptyOnObjectRule` ran right after install here. In Type Coverage they're opt-in like the rest, one parameter each: + +```diff + parameters: + type_perfect: + narrow_param: true + narrow_return: true + no_mixed_property: true + no_mixed_caller: true + null_over_false: true ++ no_param_type_removal: true ++ no_isset_on_object: true ++ no_empty_on_object: true +``` + +Every other parameter name is unchanged. + +### Not carried over + +* **`NoArrayAccessOnObjectRule`** — the `$object['key']` over `$object->getKey()` check is not part of Type Coverage. If you rely on it, pin `rector/type-perfect` `2.2.0` next to Type Coverage and keep only that rule enabled. +* Two fixes released here after the merge are not in Type Coverage yet: the `NarrowPublicClassMethodParamTypeRule` generic-object false-positive ([#74](https://github.com/rectorphp/type-perfect/pull/74)) and the Symfony DomCrawler skip in `NoArrayAccessOnObjectRule` ([#77](https://github.com/rectorphp/type-perfect/pull/77)). + +
+ ## Install +*This package is deprecated — install [tomasvotruba/type-coverage](https://github.com/TomasVotruba/type-coverage) instead. The docs below are kept as reference for the rules.* + ```bash composer require rector/type-perfect --dev ``` diff --git a/build/rector-downgrade-php-74.php b/build/rector-downgrade-php-74.php deleted file mode 100644 index 48e8c8b1..00000000 --- a/build/rector-downgrade-php-74.php +++ /dev/null @@ -1,12 +0,0 @@ -sets([DowngradeLevelSetList::DOWN_TO_PHP_74]); - - $rectorConfig->skip(['*/tests/*']); -}; diff --git a/build/target-repository/.github/workflows/auto_closer.yaml b/build/target-repository/.github/workflows/auto_closer.yaml deleted file mode 100644 index 06400c05..00000000 --- a/build/target-repository/.github/workflows/auto_closer.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Auto Closer PR - -on: - pull_request_target: - types: [opened] - -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: superbrothers/close-pull-request@v3 - with: - # Optional. Post a issue comment just before closing a pull request. - comment: | - Hi, thank you for your contribution. - - Unfortunately, this repository is read-only. It's a build of the main repository. - - We'd like to kindly ask you to move the contribution there - https://github.com/rectorphp/type-perfect. - - We'll check it, review it and give you feed back right way. - - Thank you. diff --git a/build/target-repository/README.md b/build/target-repository/README.md deleted file mode 100644 index 3fd7b37f..00000000 --- a/build/target-repository/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Type Perfect - Anywhere version - -See original repository for more details: https://github.com/rectorphp/type-perfect diff --git a/build/target-repository/composer.json b/build/target-repository/composer.json deleted file mode 100644 index 8d106402..00000000 --- a/build/target-repository/composer.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "anywherephp/type-perfect", - "type": "phpstan-extension", - "description": "Next level type declaration checks", - "license": "proprietary", - "require": { - "php": "^7.4|^8.0", - "phpstan/phpstan": "^2.1.14", - "webmozart/assert": "^1.11 || ^2.1" - }, - "autoload": { - "psr-4": { - "Rector\\TypePerfect\\": "src" - } - }, - "extra": { - "phpstan": { - "includes": [ - "config/extension.neon" - ] - } - } -} diff --git a/composer.json b/composer.json index 8c55fcf1..c6725326 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,9 @@ { "name": "rector/type-perfect", "type": "phpstan-extension", - "description": "Next level type declaration checks", + "description": "Next level type declaration checks - DEPRECATED, merged into tomasvotruba/type-coverage", "license": "MIT", + "abandoned": "tomasvotruba/type-coverage", "require": { "php": "^8.2", "phpstan/phpstan": "^2.1.30", diff --git a/full-tool-build.sh b/full-tool-build.sh deleted file mode 100644 index 93136248..00000000 --- a/full-tool-build.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -# add patches -composer install --ansi - -# but skip dev dependencies -composer update --no-dev --ansi - -# remove tests and useless files, to make downgraded, scoped and deployed codebase as small as possible -rm -rf tests - -# downgrade with rector -mkdir rector-local -composer require rector/rector --working-dir rector-local -rector-local/vendor/bin/rector process src --config build/rector-downgrade-php-74.php --ansi