Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPStan 2.0 support #271

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

PHPStan 2.0 support #271

wants to merge 5 commits into from

Conversation

GeniJaho
Copy link
Collaborator

Fixes #270.

@GeniJaho GeniJaho changed the title PHPStan 2 support PHPStan 2.0 support Nov 13, 2024
@samsonasik
Copy link
Collaborator

Try latest rector/rector:dev-main , it now already use phpstan 2 and php-parser 5 :)

@samsonasik
Copy link
Collaborator

You can upgrade to php-parser 5 nodes with rector-php-parser package

https://github.com/rectorphp/rector-php-parser

composer require rector/rector-php-parser:dev-main --dev

add rector.php

<?php

return RectorConfig::configure()
    // ...
+    ->withSets([\Rector\PhpParser\Set\PhpParserSetList::PHP_PARSER_50]);

and then, run rector:

vendor/bin/rector

@samsonasik
Copy link
Collaborator

Update composer.json require and require dev:

-        "rector/rector": "^1.2.5"
+        "rector/rector": "dev-main as 1.2.10"

and update phpstan and phpstan extension to v2:

        "phpstan/phpstan": "^2.0",
        "phpstan/phpstan-strict-rules": "^2.0",
        "phpstan/phpstan-webmozart-assert": "^2.0",

and temporary remove the following extension

       "symplify/phpstan-extensions": "^11.4",
        "symplify/phpstan-rules": "^12.4",

then remove --error-format symplify in composer command registered in composer.json temporary, until everything ready.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incoming PHPStan 2.0
2 participants