phpstan / phpstan-strict-rules

Extra strict and opinionated rules for PHPStan
MIT License
592 stars 46 forks source link

Upgrade to PHP-Parser 5 #241

Closed etienneroudeix closed 6 months ago

etienneroudeix commented 6 months ago

Recent phpunit/phpunit:^11, released on February 2, 2024, requires nikic/php-parser ^5.0.

However, phpstan-strict-rules:1.5.2 requires nikic/php-parser": "^4.13.0.

Upgrading PHPUnit is therefore blocked by phpstan-strict-rules.

PHPUnit looks to me a popular quality tool to run alongside PHPStan, therefore phpstan-strict-rules should consider updating.

herndlm commented 6 months ago

Are you sure? php-parser is a dev dependency here which should not install along when you require this package 🤔

ondrejmirtes commented 6 months ago

@etienneroudeix What error prevents you from upgrading to PHPUnit 11?

etienneroudeix commented 6 months ago

@herndlm @ondrejmirtes

Thanks for your help, I am so sorry, I figured out my error has nothing to deal with neither phpstan/phpstan or phpstan/phpstan-strict-rules but with shipmonk/phpstan-rules:2.11.2.

TIL that dev dependency cannot block composer dependency chain and I am so sorry it took some of your time.


The original error confusing me was running composer require --dev phpunit/phpunit:^11 --with-all-dependencies results in:

  Problem 1
    - phpunit/php-code-coverage 11.0.0 requires nikic/php-parser ^5.0 -> found nikic/php-parser[v5.0.0, v5.0.1] but these were not loaded, likely because it conflicts with another require.
    - phpunit/phpunit[11.0.0, ..., 11.0.4] require phpunit/php-code-coverage ^11.0 -> satisfiable by phpunit/php-code-coverage[11.0.0].
    - Root composer.json requires phpunit/phpunit ^11 -> satisfiable by phpunit/phpunit[11.0.0, ..., 11.0.4].

And all I was seeing was

{
            "name": "phpstan/phpstan-strict-rules",
            [...]
            "require-dev": {
                "nikic/php-parser": "^4.13.0",

in composer.lock.

ondrejmirtes commented 6 months ago

No problem 😊

github-actions[bot] commented 5 months ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.