phpstan/phpstan-shim

The replacement rule for nikic/php-parser should be an exact version based on what is inside the phar

stof opened this issue · 9 comments

stof commented

This package cannot replace future 4.x version of nikic-parser. That does not make sense. and it might break project if something depends on a newer version of nikic-/php-parser than what is in the phar, as composer will happily think that this newer version is provided.

stof commented

btw, is nikic/php-parser really autoloaded from the phar ? If no, the replacement rule should be dropped entirely.

phpstan-shim will be obsoleted on Tuesday. phpstan/phpstan 0.12 will consist of a single PHAR file and it doesn't have the replace problem.

@ondrejmirtes We're going back to my previous question on another issue: Symfony 5 support where you suggested to use phpstan-shim. Sure, it will be obsolete, but projects that will still rely on PHPStan 0.11 and want to upgrade to Symfony 5 cannot use phpstan-shim in certain cases.

See here for the issue I'm having because of the replace: composer/composer#8456

You can use phpstan/phpstan dev-master now or wait until Tuesday when it will be stable.

I can, but that will upgrade PHPStan to 0.12. Not something I can tackle right now, since on level 7 I'm currently using, upgrading results in way too much errors. Basically, if I want to keep using 0.11 for a while, I can't upgrade to Symfony 5.

You can use the baseline and be on 0.12: https://medium.com/@ondrejmirtes/phpstans-baseline-feature-lets-you-hold-new-code-to-a-higher-standard-e77d815a5dff It was created so that everyone can upgrade immediately.

Hm, okay. I wasn't aware of the baseline feature. Thanks!

phpstan-shim will be obsoleted on Tuesday. phpstan/phpstan 0.12 will consist of a single PHAR file and it doesn't have the replace problem.

Is this documented somewhere?

The README.md on phpstan/phpstan still says:

You can also use the phpstan/phpstan-shim package to install PHPStan via Composer without the risk of conflicting dependencies.

There is also no note about this in the README.md of this repository.

It's mentioned in PHPStan 0.12 release notes and this article.

I've removed the mention of phpstan-shim in phpstan/phpstan README and I'm yet to update phpstan-shim repo README itself.