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

Get ready for PHPStan 2.0 #8815

Open
ondrejmirtes opened this issue Sep 4, 2024 · 16 comments
Open

Get ready for PHPStan 2.0 #8815

ondrejmirtes opened this issue Sep 4, 2024 · 16 comments
Labels

Comments

@ondrejmirtes
Copy link
Contributor

Feature Request

Hi, I just started working on PHPStan 2.0 which will come with PHP-Parser 5. These are early days of the development, but you can already require phpstan/phpstan:^2.0 (with minimum-stability dev) and start working on making Rector compatible.

There will be more backward compatibility breaks coming in the next few months as I work towards to release, but you can already start getting rector-src ready for Rector 2.0 which will require PHPStan 2.0.

Please keep this issue open so we can discuss the next major PHPStan version. I'd also appreciate any feedback from your side. Thanks. 🤞

@TomasVotruba
Copy link
Member

TomasVotruba commented Sep 4, 2024

Sounds good 👍

We'll give this a priority by the end of the year and do upgrade of both PHPStan 2 and php-parser 5 at once.

@ondrejmirtes
Copy link
Contributor Author

We're now in the release candidate period phpstan/phpstan#11816

@samsonasik
Copy link
Member

rector phpstan's extensions seems need to have compatible to phpstan 2 first:

  Problem 1
    - Root composer.json requires rector/type-perfect ^0.1.6 -> satisfiable by rector/type-perfect[0.1.6, 0.1.7, 0.1.8].
    - rector/type-perfect[0.1.6, ..., 0.1.8] require phpstan/phpstan ^1.11 -> found phpstan/phpstan[1.11.0, ..., 1.12.x-dev] but it conflicts with your root composer.json require (^2.0).
  Problem 2
    - Root composer.json requires symplify/phpstan-extensions ^11.4 -> satisfiable by symplify/phpstan-extensions[11.4.0, 11.4.1, 11.4.2, 11.4.3].
    - symplify/phpstan-extensions[11.4.0, ..., 11.4.3] require phpstan/phpstan ^1.10 -> found phpstan/phpstan[1.10.0, ..., 1.12.x-dev] but it conflicts with your root composer.json require (^2.0).
  Problem 3
    - Root composer.json requires symplify/phpstan-rules ^13.0 -> satisfiable by symplify/phpstan-rules[13.0.0, 13.0.1].
    - symplify/phpstan-rules[13.0.0, ..., 13.0.1] require phpstan/phpstan ^1.10.30 -> found phpstan/phpstan[1.10.30, ..., 1.12.x-dev] but it conflicts with your root composer.json require (^2.0).
  Problem 4
    - Root composer.json requires tomasvotruba/unused-public ^0.3.10 -> satisfiable by tomasvotruba/unused-public[0.3.10, 0.3.11].
    - tomasvotruba/unused-public[0.3.10, ..., 0.3.11] require phpstan/phpstan ^1.10.19 -> found phpstan/phpstan[1.10.19, ..., 1.12.x-dev] but it conflicts with your root composer.json require (^2.0).
  Problem 5
    - Root composer.json requires phpstan/phpstan-phpunit ^1.4 -> satisfiable by phpstan/phpstan-phpunit[1.4.0, 1.4.x-dev].
    - phpstan/phpstan-phpunit 1.4.0 requires phpstan/phpstan ^1.11 -> found phpstan/phpstan[1.11.0, ..., 1.12.x-dev] but it conflicts with your root composer.json require (^2.0).
    - phpstan/phpstan-phpunit 1.4.x-dev requires phpstan/phpstan ^1.12 -> found phpstan/phpstan[1.12.0, ..., 1.12.x-dev] but it conflicts with your root composer.json require (^2.0).

@szepeviktor
Copy link
Contributor

@TomasVotruba Today is 11.11. Do you plan to make Rector PHPStan 2 compatible this week?

@samsonasik
Copy link
Member

First step: symplify/phpstan-extensions#12

@TomasVotruba
Copy link
Member

@szepeviktor Depends how many only-in-Rector BC breaks we'll have to deal with. We use lot of internal code, so it might be a challange.

@samsonasik Could you look into it? rector/rector first, so we can keep it focused on single repository

@samsonasik
Copy link
Member

@TomasVotruba sure, phpstan 2 require php-parser 5 so it will need revisit my old PR:

to be reincorporated ;)

@canvural
Copy link

I think best way to start is to enable bleeding edge and maybe install phpstan-deprecation-rules and start fixing stuff that pops up. We don't need to require 2.0 for that.

@ondrejmirtes
Copy link
Contributor Author

Exactly, as the upgrading guide says!

@samsonasik
Copy link
Member

sure, see rectorphp/rector-src#6415

@carlos-granados
Copy link

I created this PR for tomasvotruba/unused-public TomasVotruba/unused-public#135, probably complementary to TomasVotruba/unused-public#134

@carlos-granados
Copy link

Another PR for tomasvotruba/type-coverage TomasVotruba/type-coverage#46, complementary to TomasVotruba/type-coverage#45

@samsonasik
Copy link
Member

I am trying to install phpstan 2 and php-parser 5

the php-parser is patched, and currently got error on phpstan service:

44) Rector\Tests\Issues\AutoImport\AutoImportTest::test with data set #43 ('/Users/samsonasik/www/rector-...hp.inc')
_PHPStan_2a200beec\Nette\DI\ServiceCreationException: Service 'rectorParser' (type of PHPStan\Parser\RichParser): Unable to pass specified arguments to RichParser::__construct().

@samsonasik
Copy link
Member

Remove lexer params seems handle it rectorphp/rector-src@f7e9549

will continue updating there at:

@carlos-granados
Copy link

Another PR for rector/type-perfect rectorphp/type-perfect#48

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

No branches or pull requests

6 participants