Skip to content

Commit

Permalink
feature #6152 PHP8.1 support (SpacePossum)
Browse files Browse the repository at this point in the history
This PR was squashed before being merged into the master branch (closes #6152).

Discussion
----------

PHP8.1 support

@kubawerlos do you maybe have time to run the tests with the top X PHP projects to see if there is regression we overlooked?

Commits
-------

c86c22a PHP8.1 support
  • Loading branch information
SpacePossum committed Dec 10, 2021
2 parents 3de1d1b + c86c22a commit 241b491
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,18 @@ jobs:

- operating-system: 'ubuntu-20.04'
php-version: '8.0'

- operating-system: 'ubuntu-20.04'
php-version: '8.1'
job-description: 'with migration rules'
execute-migration-rules: 'yes' # should be checked on highest supported PHP version

- operating-system: 'ubuntu-20.04'
php-version: '8.0'
php-version: '8.1'
job-description: 'with calculating code coverage'
calculate-code-coverage: 'yes'
phpunit-flags: '--testsuite coverage --exclude-group covers-nothing --coverage-clover build/logs/clover.xml'

- operating-system: 'ubuntu-20.04'
php-version: '8.1'
PHP_CS_FIXER_IGNORE_ENV: 1

- operating-system: 'windows-latest'
php-version: '7.4'
job-description: 'on Windows'
Expand Down
6 changes: 3 additions & 3 deletions .php-cs-fixer.php-highest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
* with this source code in the file LICENSE.
*/

if (PHP_VERSION_ID <= 80001 || PHP_VERSION_ID >= 80100) {
fwrite(STDERR, "PHP CS Fixer's config for PHP-HIGHEST can be executed only on highest supported PHP version - 8.0.*.\n");
if (PHP_VERSION_ID < 80100 || PHP_VERSION_ID >= 80200) {
fwrite(STDERR, "PHP CS Fixer's config for PHP-HIGHEST can be executed only on highest supported PHP version - 8.1.*.\n");
fwrite(STDERR, "Running it on lower PHP version would prevent calling migration rules.\n");
exit(1);
}

$config = require '.php-cs-fixer.dist.php';

$config->setRules(array_merge($config->getRules(), [
'@PHP80Migration' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'heredoc_indentation' => false,
]));
Expand Down
4 changes: 2 additions & 2 deletions php-cs-fixer
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ set_error_handler(static function ($severity, $message, $file, $line) {
exit(1);
} elseif (
\PHP_VERSION_ID < 70205
|| \PHP_VERSION_ID >= 80100
|| \PHP_VERSION_ID >= 80200
) {
fwrite(STDERR, "PHP needs to be a minimum version of PHP 7.2.5 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.1.*.\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/AutoReview/CiConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static function ensureTraversableContainsIdenticalIsAvailable(): void

private static function assertUpcomingPhpVersionIsCoveredByCiJob(string $lastSupportedVersion, array $ciVersions): void
{
if ('8.0' === $lastSupportedVersion) {
if ('8.1' === $lastSupportedVersion) {
return; // no further releases available yet
}

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.2.5 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.1.*.
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 241b491

Please sign in to comment.