- Issue created by @mondrake
- Status changed to Needs review
7 months ago 7:02pm 16 April 2024 - 🇳🇱Netherlands spokje
Not a big fan of lowering versions of dependencies, but seeing that:
- None of our other dependencies need it
- Tests are green
- PHPUnit 10 waits for no man...I'm going to RTBC
- Status changed to RTBC
7 months ago 9:23am 17 April 2024 - 🇬🇧United Kingdom alexpott 🇪🇺🌍
I;ve read https://github.com/phpstan/phpstan/issues/7943 and it states quite clearly that
Upgrading is not blocked by PHPStan. You can use PHPStan in projects that use PHP-Parser v5.
Reading 📌 Remove DrupalComponentTestListenerTrait and replace with a PHPStan rule RTBC it sounds like the real issue is with DebugClassLoader
- 🇮🇹Italy mondrake 🇮🇹
@alexpott the problem is described here https://github.com/phpstan/phpstan/issues/10620#issuecomment-1959440979
- 🇮🇹Italy mondrake 🇮🇹
You can USE PHPStan for static analysis, but you cannot TEST your own rules.
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
So the solution is also written there...
The rare problem happens when you're mixing the two versions at runtime. So if you run tests for something that loads PHP-Parser v5, it's going to crash PHPStan's tests which need PHP-Parser v4.
The solution is to test these things separately. @group the PHPStan extensions tests and run them in a separate CI target.
Given how PHPStan runs we can hit this problem in the future. If we adding PHPStan tests to core then we're going to need to run them separately.
- 🇬🇧United Kingdom longwave UK
This will also prevent us from going to PHPUnit 11, though I suppose we cross that bridge when we come to it: https://github.com/sebastianbergmann/php-code-coverage/blob/main/compose...
- Status changed to Needs review
7 months ago 12:17pm 17 April 2024 - 🇬🇧United Kingdom catch
Looks like this needs more discussion.
I think it would be fine to exclude phpstan tests in the main phpunit job and add a new job, which could then manually downgrade nikic/php-parser?
- 🇮🇹Italy mondrake 🇮🇹
#13 locally I solved by running
composer require nikic/php-parser:^4
, and the test passes (it throws some debugclassloader deprecations that we'll have to silence, but one thing at a time).So we can
a) downgrade like here
b) create a separate job to just run PHPUnit on PHPstan rules, downgrading viacomposer require nikic/php-parser:^4
on each run
c) mark the test skipped in 📌 Remove DrupalComponentTestListenerTrait and replace with a PHPStan rule RTBC while we wait for PHPStan 2To me this one seemed the lightest to do, and in any case is temp. If we do want to do b) for more separation, then it's another discussion, and I think should happen in 📌 Remove DrupalComponentTestListenerTrait and replace with a PHPStan rule RTBC .
- 🇬🇧United Kingdom alexpott 🇪🇺🌍
I'm for B. I think or PHPStan test should not use our root composer.json for installing and testing things. Or perhaps even better and maybe option D, we should not put the PHPStan rules in core. Can we contribute them to mglaman's package or can we add another package.
- Status changed to Needs work
7 months ago 5:07pm 18 April 2024 The Needs Review Queue Bot → tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide → to find step-by-step guides for working with issues.
- Status changed to Needs review
7 months ago 5:08pm 18 April 2024 - Status changed to Closed: won't fix
7 months ago 9:44am 2 May 2024 - 🇮🇹Italy mondrake 🇮🇹
As discussed in the parent, we will likely go for a decoupling of the PHPStan rule tests from Drupal core test, so this is not going to be necessary.