phar-io / phive

The Phar Installation and Verification Environment (PHIVE)
https://phar.io
BSD 3-Clause "New" or "Revised" License
571 stars 44 forks source link

Allow phpstan/extension-installer #417

Open dereuromark opened 7 months ago

dereuromark commented 7 months ago

Is it possible to allow/support also

Refs https://github.com/cakephp/cakephp/pull/17448

We currently have phpstan installed via phive, but also having those (depending directly on phpstan) available makes it a bit tricky. It almost sounds like we would have to remove phpstan from phive installation back to normal require-dev.

Would be nice if those could somehow we supported as well. Is this feasable?

pereorga commented 7 months ago

Similar here, for my case I've found that I still prefer to use Composer for phpstan, phpunit and psalm, because it is easier to set-up:

    "phpstan/phpstan": "^1.10",
    "phpstan/phpstan-deprecation-rules": "^1.1",
    "phpstan/phpstan-strict-rules": "^1.5",
    "phpunit/phpunit": "^10.4",
    "psalm/plugin-phpunit": "^0.18.4",
    "rector/rector": "^0.18.10",
    "vimeo/psalm": "^5.16"

(And rector, because it is not available in Phive, as per https://github.com/rectorphp/rector/issues/2724).

I use Phive for php-cs-fixer, phan, composer-normalize, composer, phpcbf, phpcpd, php-parallel-lint and yaml-lint.

theseer commented 7 months ago

Dealing with extensions isn't easy - as that opens the door to actual dependency handling. See #88 for details.

PHPStan, if i recall correctly, is particularly problematic as it uses - for no apparent reason to me - PHPScoper when creating its phar archive. That makes it virtually impossible to install extensions for the phar distribution of it as the namespace of PHPStan or any child components is random. Unless the PHPStan authors drop that, there is nothing phive can do to make things work - even if we'd have a means of installing extensions.

theseer commented 7 months ago

PHPUnit is actually one of the main reasons phive exits: As it's a tool with runtime impact when executing tests, collisions in packages are a nightmare. I fail to see how installing phpunit with composer is in any possible way better.

Extensions to PHPUnit are best distributed as phar as well.

pereorga commented 7 months ago

@theseer It's because I use psalm for analysing PHPUnit tests, with psalm/plugin-phpunit. If I install PHPUnit with Phive, psalm fails with ERROR: UnusedClass. I didn't know how to get it to work.

Additionally, the architecture of my project may not be very common. It's a very simple and efficient website, with no OOP and free from any PHP dependencies: https://github.com/Softcatala/pccd