overtrue / phplint

:bug: A tool that can speed up linting of php files by running several lint processes at once.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0".

teal-bauer opened this issue · comments

New Issue

Diagnose

If you use PHAR version of PHP Lint, please specify:

I downloaded the latest version, which is 9.0.4 at this time:

curl -Ls https://github.com/overtrue/phplint/releases/latest/download/phplint.phar -o phplint
Output of `phplint.phar --manifest` command
Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.28. in phar:///var/www/phplint/vendor/composer/platform_check.php on line 24

Call Stack:
    0.0007     401104   1. {main}() /var/www/phplint:0
    0.0088     935312   2. require('phar:///var/www/phplint/bin/phplint') /var/www/phplint:17
    0.0092    1015968   3. require('phar:///var/www/phplint/vendor/autoload.php') phar:///var/www/phplint/bin/phplint:11
    0.0092    1088896   4. ComposerAutoloaderInit50fd98c3738b6ce14acfa636801aebfd::getLoader() phar:///var/www/phplint/vendor/autoload.php:32
    0.0093    1092944   5. require('phar:///var/www/phplint/vendor/composer/platform_check.php') phar:///var/www/phplint/vendor/composer/autoload_real.php:25
    0.0093    1093520   6. trigger_error($message = 'Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.28.', $error_level = 256) phar:///var/www/phplint/vendor/composer/platform_check.php:24

Summary

While the project README states that phplint 9.x is usable with PHP >= 8.0, running the PHAR fails with a Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.28

Expected behaviour

phplint 9.0.4 should run under php 8.0.28.

Actual behaviour

$ ../phplint -vvv

Box Requirements Checker
========================

> Using PHP 8.0.28
> PHP is using the following php.ini file:
  WARNING: No configuration file (php.ini) used by PHP!

> Checking Box requirements:
  ✔ The application requires the version "^8.0" or greater.
  ✔ The application requires the extension "json".
  
                                                                                                                                                                                                                                                                                                                                                                                                                 
 [OK] Your system is ready to run the application.                                                                                                                                                                                                                                                                                                                                                               
                                                                                                                                                                                                                                                                                                                                                                                                                 


Fatal error: Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.28. in phar:///var/www/phplint/vendor/composer/platform_check.php on line 24

Call Stack:
    0.0009     401096   1. {main}() /var/www/phplint:0
    0.0087     932136   2. require('phar:///var/www/phplint/bin/phplint') /var/www/phplint:17
    0.0092    1012792   3. require('phar:///var/www/phplint/vendor/autoload.php') phar:///var/www/phplint/bin/phplint:11
    0.0092    1085720   4. ComposerAutoloaderInit50fd98c3738b6ce14acfa636801aebfd::getLoader() phar:///var/www/phplint/vendor/autoload.php:32
    0.0093    1089768   5. require('phar:///var/www/phplint/vendor/composer/platform_check.php') phar:///var/www/phplint/vendor/composer/autoload_real.php:25
    0.0093    1090344   6. trigger_error($message = 'Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 8.1.0". You are running 8.0.28.', $error_level = 256) phar:///var/www/phplint/vendor/composer/platform_check.php:24

Hello,

First, Thanks to report this issue !
But I won't waste more time to fix it, and I 'll try to explain you why.

  • PHP 8.0 will reach End Of Life at the end of this year 2023 (currently only security fixes)
  • Infrastructure to build the PHAR distribution used my project box-manifest that is a version of BOX project with manifests support. The workflow used the box-manifest 2.3.1 that support BOX v4.x (that requires itself PHP 8.1 or greater)
    BOX v3.x that support PHP 7.4 and 8.0 are also supported via box-manifest 1.2.0 (but has already reached End Of Life).

My suggestion, is if you really want to use a PHAR version of PHPLint 9.0 is to compile it yourself with BOX 3.16.0 (the lastest version that support PHP 8.0).
The metadata in box.json config file will be ignored and considered as simple text.

Follows this steps :

curl -Ls https://github.com/box-project/box/releases/download/3.16.0/box.phar -o box-3.phar
chmod +x box-3.phar
./box-3.phar compile --config /absolute/path/to/phplint_clone/box.json

And used your fresh copy of PHPLint v9 (PHP 8.0 compatible) that may be found in your phplint clone.

Hope that will help you

Yeah, very understandable, I also hope to move everything off PHP 8.0 soon. And yeah, that is helpful, but for the time being I've just downgraded to an older phplint as the easiest workaround.

Even if older versions are still identified as active support, this is only for help.
I won't apply any fix code on them except for security if needed.
Major version 9.0 is an homogeneous branch code with new feature.

Gotcha! For our use case, I think it's fine, we're running v4.x in a Github workflow on self-hosted runners with our own code, but good to know.