Skip to content

Commit

Permalink
minor #6067 Bump minimum PHP version to 7.2 (keradus)
Browse files Browse the repository at this point in the history
This PR was merged into the master branch.

Discussion
----------

Bump minimum PHP version to 7.2

Only 0.2% installations are using PHP 7.1
https://packagist.org/packages/friendsofphp/php-cs-fixer/php-stats#3.2

Commits
-------

a4b59f0 Bump minimum PHP version to 7.2
  • Loading branch information
keradus committed Nov 15, 2021
2 parents 66b2a5d + a4b59f0 commit 96a9f4f
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
matrix:
include:
- operating-system: 'ubuntu-20.04'
php-version: '7.1'
php-version: '7.2'
job-description: 'with lowest deps'
composer-flags: '--prefer-stable --prefer-lowest' # should be checked on lowest supported PHP version

Expand Down Expand Up @@ -124,8 +124,8 @@ jobs:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: php vendor/bin/php-coveralls --verbose

- name: Run PHP CS Fixer for PHP 7.1 types
if: matrix.php-version == '7.1' # we run on lowest supported version, running it on higher would falsy expect more changes, eg `mixed` type on PHP 8
- name: Run PHP CS Fixer for PHP 7.2 types
if: matrix.php-version == '7.2' # we run on lowest supported version, running it on higher would falsy expect more changes, eg `mixed` type on PHP 8
run: php php-cs-fixer fix --diff --dry-run -v --config .php-cs-fixer.php-lowest.php

- name: Run PHP CS Fixer
Expand Down
4 changes: 2 additions & 2 deletions .php-cs-fixer.php-lowest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
* with this source code in the file LICENSE.
*/

if (PHP_VERSION_ID <= 70103 || PHP_VERSION_ID >= 70200) {
fwrite(STDERR, "PHP CS Fixer's config for PHP-LOWEST can be executed only on lowest supported PHP version - 7.1.*.\n");
if (PHP_VERSION_ID < 70205 || PHP_VERSION_ID >= 70300) {
fwrite(STDERR, "PHP CS Fixer's config for PHP-LOWEST can be executed only on lowest supported PHP version - ~7.2.5.\n");
fwrite(STDERR, "Running it on higher PHP version would falsy expect more changes, eg `mixed` type on PHP 8.\n");
exit(1);
}
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ Changelog for v3.3.0
* minor #6085 Dx: reuse WhitespacesAnalyzer::detectIndent (kubawerlos)
* minor #6087 AbstractProxyFixer - more tests (SpacePossum)

Changelog for v3.2.1
---------------------

experimental release

* Require PHP 7.2

Changelog for v3.2.0
--------------------

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "^7.1.3 || ^8.0",
"php": "^7.2.5 || ^8.0",
"ext-json": "*",
"ext-tokenizer": "*",
"composer/semver": "^3.2",
Expand Down
2 changes: 1 addition & 1 deletion dev-tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eu

# ensure that deps will work on lowest supported PHP version
composer config platform.php 2> /dev/null || composer config platform.php 7.1.3
composer config platform.php 2> /dev/null || composer config platform.php 7.2.5

# require suggested packages
composer require --no-update symfony/polyfill-mbstring
Expand Down
2 changes: 1 addition & 1 deletion doc/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Installation
Requirements
------------

PHP needs to be a minimum version of PHP 7.1.3.
PHP needs to be a minimum version of PHP 7.2.5.

Installation
------------
Expand Down
4 changes: 2 additions & 2 deletions php-cs-fixer
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ set_error_handler(static function ($severity, $message, $file, $line) {

exit(1);
} elseif (
\PHP_VERSION_ID < 70103
\PHP_VERSION_ID < 70205
|| \PHP_VERSION_ID >= 80100
) {
fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.1.3 and maximum version of PHP 8.0.*.\n");
fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.2.5 and maximum version of PHP 8.0.*.\n");
fwrite(STDERR, 'Current PHP version: '.PHP_VERSION.".\n");

if (getenv('PHP_CS_FIXER_IGNORE_ENV')) {
Expand Down
2 changes: 1 addition & 1 deletion tests/Smoke/CiIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function testIntegration(
You may find an UPGRADE guide at https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v4.0.0/UPGRADE-v4.md .
';

$optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 7.1.3 and maximum version of PHP 8.0.*.
$optionalIncompatibilityWarning = 'PHP needs to be a minimum version of PHP 7.2.5 and maximum version of PHP 8.0.*.
Current PHP version: '.PHP_VERSION.'.
Ignoring environment requirements because `PHP_CS_FIXER_IGNORE_ENV` is set. Execution may be unstable.
';
Expand Down

0 comments on commit 96a9f4f

Please sign in to comment.