-
-
Notifications
You must be signed in to change notification settings - Fork 67
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
Stop providing a phar #167
Comments
Created a Twitter poll: https://twitter.com/nmdmatt/status/1259687829904465920 |
I responded on Twitter and then realised I could do that here without the restriction of 280 chars. Currently, I am using version 1.0.14 in my https://github.com/hussainweb/drupalqa Docker image. I would like to continue to make it easy for people to use this via the image. If phar isn't going to be supported, what other methods could work? Thanks. |
😄 I'll copy my reply here, too. 1.0.x works because it's phpstan 0.11 The fix would be to include phpstan-src and directly call internal classes again, and basically build our own compiled version of phpstan. So drupal-check would become a bespoke compilation of phpstan. Which could be good, but also raises the maintenance. Depends if this tool is still valuable to the community. |
@hussainweb do you have usage states for your Because the |
i've had success installing it as a dependency of my drupal project, but that's only because installing via composer and also building from source both failed me. |
You never want to do that, it’s really complex and my job as PHPStan creator to do this. |
This option is something I’d get behind as it’s meant to be used like that: https://twitter.com/nmdmatt/status/1259688161149628417?s=21 |
@mglaman, unfortunately, I don't have any usage stats except total number of downloads (7.7k). It feels to me that the "custom compile phpstan-src" is more trouble than it's worth. If, in the long run, developers are expected to I still feel that it makes sense for a tool like this to live globally with config per project. At the same time, I don't want to make it extremely hard to maintain. |
At the same time, PHAR distribution of PHPStan means there are zero dependencies so everyone should be able to install it without risking conflicts. |
I support 100% that you no longer provide a phar. As a Drupal developer, you are (forced?) to use Composer as one of your main tools. Hence, it's no additional cost for your users to install drupal-check using Composer - either site-local or globally. Until Composer is fixed, we should avoid “composer global require”, but rather use cgr. (The reason so few people are voting for cgr is that they don't know about it or don't understand the problems with "composer global require”.) Using cgr also "means there are zero dependencies so everyone should be able to install it without risking conflicts". Finally, I dislike phar installation since you no longer have easy access to the files - and the installation is manual. |
I'd never heard of
|
I recommend “composer require” as the preferred approach so that PHPStan version is shared for all the developers and the CI build is reproducible. Classic “composer global require” is also fine because PHPStan is distributed as PHAR even inside Composer package so there’s no risk of dependencies conflict. |
@ondrejmirtes yeah, in #172 I consider deprecating this tool for just PHPStan. Earlier I was borrowing from larastan which wrapped PHPStan internals. A goal here was to reduce the setup for requiring the Drupal extension and the deprecation rules and only running deprecation checks. Maybe drupal-check isn't completely deprecated, but it really shouldn't be considered a standalone CLI. It could be used to generate PHPStan configuration and then folks just run |
@mglaman Larastan also switched to be "just another" PHPStan extension. |
@ondrejmirtes that's what I thought. So I'll formulate a plan to push So I'll stop shipping the Phar. And move towards "hey, let's just use PHPStan directly" and help the Drupal community find ways to migrate that way. Given some of the issues I've seen in this queue, quite a few have moved that way anyways. |
Now uses composer because of mglaman/drupal-check#167
Remove building and usage of the Phar
drupal-check has long removed the PHAR support. It had stopped working since version after 1.0.14 and so we stuck to that version. Now, we can install this using jakzal/toolbox (really, just composer bin plugin) and drupal-check can now live in its own namespace. More details at mglaman/drupal-check#167 (comment)
FWIW, I figured out a way to put drupal-check in my |
TL;DR phpstan 0.12 support broke packaging as a phar, install as a project dependency or globally via Composer
Supporting PHPStan 0.12 caused the removal of PHPStan's source code, leaving only the built and namespaced. We have to call the PHPStan phar directly. This does not work when using
drupal-check
as a phar.This file cannot be executed. PHP can detect it and load it, but nothing outside of the phar. As far as I can tell we cannot run it with PHP.
We had to switch to running PHPStan as a process instead of directly loading the analyzer class.
This also means none of the includes for configuration work, either.
The text was updated successfully, but these errors were encountered: