overtrue / phplint

:bug: A tool that can speed up linting of php files by running several lint processes at once.
MIT License
984 stars 118 forks source link

Let Composer do the job to install the correct version (v3 / v4 / v5) #139

Closed llaville closed 2 years ago

llaville commented 2 years ago

With current composer php constraints

Code maintain is a bit difficult (see PR #135, PR #134, PR #133), each time there are new versions.

NOTE: Use also a Major.minor (version format only like https://github.com/overtrue/phplint/blob/7.4/src/Console/Application.php#L24) to avoid forgotten bumping new release (as in 5.2.2), see https://github.com/overtrue/phplint/blob/5.2.2/src/Console/Application.php#L13

I propose to remove constraints on Dockerfile and adapt composer php constraint to let do the job as wanted :

Install a PHP5.5/7.4 version on PHP 7.4 platform (code from branch 7.4) Install a PHP 8.0 version (code from branch 8.0) Install a PHP 8.1 version (code from branch 8.1)

Example with branch 8.1

Replace https://github.com/overtrue/phplint/blob/8.1/Dockerfile#L5

RUN composer global require overtrue/phplint:^5.2.0

by

RUN composer global require overtrue/phplint

And let Composer do the job (with php: ^8.1) and add extra config/platform setting (see https://mikemadison.net/blog/2020/11/17/configuring-php-version-with-composer)

@overtrue if you're agree with these changes, PR may follows

overtrue commented 2 years ago

It's a good idea, Thanks.

llaville commented 2 years ago

I'll work on it today !

llaville commented 2 years ago

Composer allow plugins feature was not backported to branch 8.0 and 7.4 from branch 8.1 See origin at https://github.com/overtrue/phplint/blame/8.1/composer.json#L74

I'll add it also in this context

llaville commented 2 years ago

Composer PHP constraint allow PHP 5.5.9 to 7.4, but not PHP 8.0 and 8.1 (for branch 7.4); Can be checked with https://jubianchi.github.io/semver-check/#/constraint/^5.5.9%20||%20^7.0

llaville commented 2 years ago

I've also updated Composer OR constraint syntax (with commit https://github.com/llaville/phplint/commit/8153748f31cb23bc98265d17a2514600ba04c1ed) following recommandation we can read at https://getcomposer.org/doc/articles/versions.md#version-range

llaville commented 2 years ago

@overtrue For patch on branch 8.1, I'll waiting for PR #143 agreement

llaville commented 2 years ago

Fixed now by PR #144, #145 and #147 merged in corresponding branches 7.4, 8.0 and 8.1 This issue may be closed !