Skip to content

Commit

Permalink
Merge branch 'FriendsOfPHP:master' into feature-support-external-rule…
Browse files Browse the repository at this point in the history
…sets
  • Loading branch information
niklam committed Jan 29, 2022
2 parents 5baeeef + b0a9fca commit cf05ddb
Show file tree
Hide file tree
Showing 242 changed files with 9,457 additions and 2,803 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
*.php text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4 diff=php
*.rst text whitespace=blank-at-eol,blank-at-eof
*.yml text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4
*.png binary eol=unset
/tests/Fixtures/**/* -text -filter
3 changes: 1 addition & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ labels: kind/bug
Before reporting a bug, make sure PHP CS Fixer is up-to-date.
Please describe the problem and provide technical details such as:
* PHP version: php -v
* PHP CS Fixer version: php-cs-fixer -V
* PHP CS Fixer version and PHP runtime: php-cs-fixer -V
* the command used to run PHP CS Fixer (run with `-vvv`)
* the configuration (file) you used
-->
Expand Down
31 changes: 17 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,43 +11,46 @@ jobs:
matrix:
include:
- operating-system: 'ubuntu-20.04'
php-version: '7.1'
php-version: '7.4'
job-description: 'with lowest deps'
composer-flags: '--prefer-stable --prefer-lowest' # should be checked on lowest supported PHP version

- operating-system: 'ubuntu-20.04'
php-version: '7.2'
job-description: 'with Sf ^4'
execute-flex-with-symfony-version: '^4' # Explicit check for Sf 4.x compatibility
php-version: '7.4'

- operating-system: 'ubuntu-20.04'
php-version: '7.3'
php-version: '7.4'
job-description: 'with Sf ^5'
execute-flex-with-symfony-version: '^5' # Explicit check for Sf 5.x compatibility

- operating-system: 'ubuntu-20.04'
php-version: '7.4'
job-description: 'with deployment'
execute-deployment: 'yes'
php-version: '8.0'
job-description: 'with Sf ^6'
execute-flex-with-symfony-version: '^6' # Explicit check for Sf 6.x compatibility

- operating-system: 'ubuntu-20.04'
php-version: '8.0'
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'
job-description: 'with deployment'
execute-deployment: 'yes'

- operating-system: 'windows-latest'
php-version: '7.4'
php-version: '8.1'
job-description: 'on Windows'
FAST_LINT_TEST_CASES: 1

- operating-system: 'macos-latest'
php-version: '7.4'
php-version: '8.1'
job-description: 'on macOS'

name: PHP ${{ matrix.php-version }} ${{ matrix.job-description }}
Expand Down Expand Up @@ -124,8 +127,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
12 changes: 10 additions & 2 deletions .github/workflows/sca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
operating-system:
- ubuntu-20.04
php-version:
- 8.0
- 8.1

name: Static Code Analysis

Expand All @@ -28,6 +28,8 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: none # without this Xdebug will be enabled
tools: cs2pr

- name: Get Composer cache directory
id: composer-cache
Expand Down Expand Up @@ -55,6 +57,12 @@ jobs:
- name: Report versions
run: composer info -D

## We want to have a lock-file used on PR level, so contributors are not bothered by SCA complains unrelated to their changes,
## and same time we want to be aware that we are complying with bleeding edge of SCA tools as maintainers observing the push hook.
- name: Unlock dev-tools
if: ${{ github.event_name != 'pull_request' }}
run: rm ./dev-tools/composer.lock

- name: Install dev-tools
uses: nick-invision/retry@v2
with:
Expand All @@ -70,7 +78,7 @@ jobs:
run: ./dev-tools/check_trailing_spaces.sh

- name: Check - phpstan
run: ./dev-tools/vendor/bin/phpstan analyse
run: ./dev-tools/vendor/bin/phpstan analyse --error-format=checkstyle | cs2pr

- name: Check - composer-require-checker
run: ./dev-tools/vendor/bin/composer-require-checker check composer.json --config-file .composer-require-checker.json
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/.phpunit.result.cache
/box.json
/composer.lock
/dev-tools/composer.lock
/dev-tools/bin/
/dev-tools/phpstan/cache/
/dev-tools/vendor/
Expand Down
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
EOF;

$finder = PhpCsFixer\Finder::create()
->ignoreDotFiles(false)
->ignoreVCSIgnored(true)
->exclude('tests/Fixtures')
->in(__DIR__)
->append([
__DIR__.'/dev-tools/doc.php',
// __DIR__.'/php-cs-fixer', disabled, as we want to be able to run bootstrap file even on lower PHP version, to show nice message
__FILE__,
])
;

Expand Down
11 changes: 7 additions & 4 deletions .php-cs-fixer.php-highest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of PHP CS Fixer.
*
Expand All @@ -10,16 +12,17 @@
* 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 = require __DIR__.'/.php-cs-fixer.dist.php';

$config->setRules(array_merge($config->getRules(), [
'@PHP80Migration' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'heredoc_indentation' => false,
]));
Expand Down
9 changes: 6 additions & 3 deletions .php-cs-fixer.php-lowest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

/*
* This file is part of PHP CS Fixer.
*
Expand All @@ -10,13 +12,14 @@
* 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 < 70400 || PHP_VERSION_ID >= 70500) {
fwrite(STDERR, "PHP CS Fixer's config for PHP-LOWEST can be executed only on lowest supported PHP version - ~7.4.0.\n");
fwrite(STDERR, "Running it on higher PHP version would falsy expect more changes, eg `mixed` type on PHP 8.\n");

exit(1);
}

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

$config->getFinder()->notPath([
// @TODO 4.0 change interface to be fully typehinted and remove the exceptions from this list
Expand Down
111 changes: 111 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,112 @@ CHANGELOG for PHP CS Fixer

This file contains changelogs for stable releases only.

Changelog for v3.5.0
--------------------

* bug #6058 Fix `Tokens::insertSlices` not moving around all affected tokens (paulbalandan, SpacePossum)
* bug #6160 NonPrintableCharacterFixer - fix for when removing non-printable character break PHP syntax (kubawerlos)
* bug #6165 DeclareEqualNormalizeFixer - fix for declare having multiple directives (kubawerlos)
* bug #6170 NonPrintableCharacterFixer - fix for string in single quotes, having non-breaking space, linebreak, and single quote inside (kubawerlos)
* bug #6181 UseTransformer - Trait import in enum fix (PHP8.1) (SpacePossum)
* bug #6188 PhpdocTo(Param|Property|Return)TypeFixer - fix for type intersections (kubawerlos)
* bug #6202 SquareBraceTransformer - fix for destructing square brace after double arrow (kubawerlos)
* bug #6209 OrderedClassElementsFixer - PHP8.0 support abstract private methods in traits (SpacePossum)
* bug #6224 ArgumentsAnalyzer - support PHP8.1 readonly (SpacePossum)
* feature #4571 BlankLineBeforeStatementFixer - can now add blank lines before doc-comments (addiks, SpacePossum)
* feature #5953 GetClassToClassKeywordFixer - introduction (paulbalandan)
* minor #6108 Drop support for Symfony v4 (keradus)
* minor #6163 CI: update used PHP version (keradus)
* minor #6167 SingleSpaceAfterConstructFixer - allow multiline const (y_ahiru, SpacePossum)
* minor #6168 indexes -> indices (SpacePossum)
* minor #6171 Fix tests and CS (SpacePossum)
* minor #6172 DX: Tokens::insertSlices - groom code and fix tests (keradus)
* minor #6174 PhpdocAlignFixer: fix property-read/property-write descriptions not getting aligned (antichris)
* minor #6177 DX: chmod +x for benchmark.sh file (keradus)
* minor #6180 gitlab reporter - add fixed severity to match format (cbourreau)
* minor #6183 Simplify DiffConsoleFormatter (kubawerlos)
* minor #6184 Do not support array of patterns in Preg methods (kubawerlos)
* minor #6185 Upgrade PHPStan (kubawerlos)
* minor #6189 Finder - fix usage of ignoreDotFiles (kubawerlos)
* minor #6190 DX: DiffConsoleFormatter - escape - (keradus)
* minor #6194 Update Docker setup (julienfalque)
* minor #6196 clean ups (SpacePossum)
* minor #6198 DX: format dot files (kubawerlos)
* minor #6200 DX: Composer's branch-alias leftovers cleanup (kubawerlos)
* minor #6203 Bump required PHP to 7.4 (keradus)
* minor #6205 DX: bump PHPUnit to v9, PHPUnit bridge to v6 and Prophecy-PHPUnit to v2 (keradus)
* minor #6210 NullableTypeDeclarationForDefaultNullValueFixer - fix tests (HypeMC)
* minor #6212 bump year 2021 -> 2022 (SpacePossum)
* minor #6215 DX: Doctrine\Annotation\Tokens - fix phpstan violations (keradus)
* minor #6216 DX: Doctrine\Annotation\Tokens - drop unused methods (keradus)
* minor #6217 DX: lock SCA tools for PR builds (keradus)
* minor #6218 Use composer/xdebug-handler v3 (gharlan)
* minor #6222 Show runtime on version command (SpacePossum)
* minor #6229 Simplify Tokens::isMonolithicPhp tests (kubawerlos)
* minor #6232 Use expectNotToPerformAssertions where applicable (SpacePossum)
* minor #6233 Update Tokens::isMonolithicPhp (kubawerlos)
* minor #6236 Annotation - improve getting variable name (kubawerlos)

Changelog for v3.4.0
--------------------

* bug #6117 SingleSpaceAfterConstruct - handle before destructuring close brace (liquid207)
* bug #6122 NoMultilineWhitespaceAroundDoubleArrowFixer - must run before MethodArgumentSpaceFixer (kubawerlos)
* bug #6130 StrictParamFixer - must run before MethodArgumentSpaceFixer (kubawerlos)
* bug #6137 NewWithBracesFixer - must run before ClassDefinitionFixer (kubawerlos)
* bug #6139 PhpdocLineSpanFixer - must run before NoSuperfluousPhpdocTagsFixer (kubawerlos)
* bug #6143 OperatorLinebreakFixer - fix for alternative syntax (kubawerlos)
* bug #6159 ImportTransformer - fix for grouped constant and function imports (kubawerlos)
* bug #6161 NoUnreachableDefaultArgumentValueFixer - fix for attributes (kubawerlos)
* feature #5776 DX: test on PHP 8.1 (kubawerlos)
* feature #6152 PHP8.1 support (SpacePossum)
* minor #6095 Allow Symfony 6 (derrabus, keradus)
* minor #6107 Drop support of PHPUnit v7 dependency (keradus)
* minor #6109 Add return type to `DummyTestSplFileInfo::getRealPath()` (derrabus)
* minor #6115 Remove PHP 7.2 polyfill (derrabus)
* minor #6116 CI: remove installation of mbstring polyfill in build script, it's required dependency now (keradus)
* minor #6119 OrderedClassElementsFixer - PHPUnit assert(Pre|Post)Conditions methods support (meyerbaptiste)
* minor #6121 Use Tokens::ensureWhitespaceAtIndex to simplify code (kubawerlos)
* minor #6127 Remove 2nd parameter to XdebugHandler constructor (phil-davis)
* minor #6129 clean ups (SpacePossum)
* minor #6138 PHP8.1 - toString cannot return type hint void (SpacePossum)
* minor #6146 PHP 8.1: add new_in_initializers to PHP 8.1 integration test (keradus)
* minor #6147 DX: update composer-normalize (keradus)
* minor #6156 DX: drop hack for Prophecy incompatibility (keradus)

Changelog for v3.3.1
--------------------

* minor #6067 Bump minimum PHP version to 7.2 (keradus)

Changelog for v3.3.0
--------------------

* bug #6054 Utils - Add multibyte and UTF-8 support (paulbalandan)
* bug #6061 ModernizeStrposFixer - fix for negated with leading slash (kubawerlos)
* bug #6064 SquareBraceTransformer - fix detect array destructing in foreach (SpacePossum)
* bug #6082 PhpUnitDedicateAssertFixer must run before NoUnusedImportsFixer (kubawerlos)
* bug #6089 TokensAnalyzer.php - Fix T_ENCAPSED_AND_WHITESPACE handling in isBina… (SpacePossum)
* feature #5123 PhpdocTypesFixer - support generic types (kubawerlos)
* minor #5775 DX: run static code analysis on PHP 8.0 (kubawerlos)
* minor #6050 DX: TypeIntersectionTransformer - prove to not touch T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG (keradus)
* minor #6051 NoExtraBlankLinesFixer - Improve deprecation message (paulbalandan)
* minor #6060 DX: Add upgrade guide link when next Major is available (keradus)
* minor #6066 Clean ups (SpacePossum, kubawerlos)
* minor #6069 DX: cleanup stub file (keradus)
* minor #6070 Update UPGRADE-v3.md with php_unit_test_annotation/case deprecation (kubawerlos)
* minor #6072 Update usage doc to reflect change to PSR12 default. (hannob, keradus)
* minor #6084 Change: Remove __constructor() from RuleSetDescriptionInterface (niklam)
* 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 Expand Up @@ -285,6 +391,11 @@ Changelog for v3.0.0
* minor #5657 DX: convert some properties to constants (keradus)
* minor #5669 Remove TrailingCommaInMultilineArrayFixer (kubawerlos, keradus)

Changelog for v2.19.3
---------------------

* minor #6060 DX: Add upgrade guide link when next Major is available (keradus)

Changelog for v2.19.2
---------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2021 Fabien Potencier, Dariusz Rumiński
Copyright (c) 2012-2022 Fabien Potencier, Dariusz Rumiński

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion benchmark.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ BRANCH2=${2:-''}

if [ "" = "$BRANCH1" ] || [ "" = "$BRANCH2" ];
then
echo "Usage: bash benchmark.sh BRANCH1 BRANCH2 ...BRANCHN"
echo "Usage: ./benchmark.sh BRANCH1 BRANCH2 ...BRANCHN"
exit 1;
fi

Expand Down
Loading

0 comments on commit cf05ddb

Please sign in to comment.