Skip to content

Commit 653f619

Browse files
committed
Merge branch '2.15' into 2.16
2 parents 00c70d1 + 82b6e2b commit 653f619

File tree

12 files changed

+125
-16
lines changed

12 files changed

+125
-16
lines changed

.composer-require-checker.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"symbol-whitelist" : [
3+
"Symfony\\Contracts\\EventDispatcher\\Event",
34
"Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface",
5+
"Symfony\\Component\\EventDispatcher\\Event",
46
"PhpCsFixer\\Tests\\Test\\Constraint\\SameStringsConstraint",
57
"PhpCsFixer\\Tests\\Test\\IsIdenticalConstraint",
68
"PHPUnit\\Framework\\Constraint\\IsIdentical",

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ jobs:
8888
<<: *STANDARD_TEST_JOB
8989
stage: Test
9090
php: 7.2
91+
env: SYMFONY_DEPRECATIONS_HELPER=disabled PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER=1 SYMFONY_VERSION="^5.0"
9192

9293
-
9394
<<: *STANDARD_TEST_JOB

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
"composer/xdebug-handler": "^1.2",
2222
"doctrine/annotations": "^1.2",
2323
"php-cs-fixer/diff": "^1.3",
24-
"symfony/console": "^3.4.17 || ^4.1.6",
25-
"symfony/event-dispatcher": "^3.0 || ^4.0",
26-
"symfony/filesystem": "^3.0 || ^4.0",
27-
"symfony/finder": "^3.0 || ^4.0",
28-
"symfony/options-resolver": "^3.0 || ^4.0",
24+
"symfony/console": "^3.4.17 || ^4.1.6 || ^5.0",
25+
"symfony/event-dispatcher": "^3.0 || ^4.0 || ^5.0",
26+
"symfony/filesystem": "^3.0 || ^4.0 || ^5.0",
27+
"symfony/finder": "^3.0 || ^4.0 || ^5.0",
28+
"symfony/options-resolver": "^3.0 || ^4.0 || ^5.0",
2929
"symfony/polyfill-php70": "^1.0",
3030
"symfony/polyfill-php72": "^1.4",
31-
"symfony/process": "^3.0 || ^4.0",
32-
"symfony/stopwatch": "^3.0 || ^4.0"
31+
"symfony/process": "^3.0 || ^4.0 || ^5.0",
32+
"symfony/stopwatch": "^3.0 || ^4.0 || ^5.0"
3333
},
3434
"require-dev": {
3535
"johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0",
@@ -42,8 +42,8 @@
4242
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.1",
4343
"phpunit/phpunit": "^5.7.27 || ^6.5.14 || ^7.1",
4444
"phpunitgoodpractices/traits": "^1.8",
45-
"symfony/phpunit-bridge": "^4.3",
46-
"symfony/yaml": "^3.0 || ^4.0"
45+
"symfony/phpunit-bridge": "^4.3 || ^5.0",
46+
"symfony/yaml": "^3.0 || ^4.0 || ^5.0"
4747
},
4848
"suggest": {
4949
"ext-mbstring": "For handling non-UTF8 characters in cache signature.",

phpstan.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ parameters:
1313
- '/^Return typehint of method PhpCsFixer\\Tests\\Test\\.+::createIsIdenticalStringConstraint\(\) has invalid type PHPUnit_Framework_Constraint_IsIdentical\.$/'
1414
## cannot analyse out of PHP 7.4
1515
- '/^Constant T_FN not found\.$/'
16+
- '/^Class (Symfony\\Contracts\\EventDispatcher\\Event|Symfony\\Component\\EventDispatcher\\Event) not found.$/'

src/Console/ConfigurationResolver.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,11 +302,15 @@ public function getDirectory()
302302
{
303303
if (null === $this->directory) {
304304
$path = $this->getCacheFile();
305-
$filesystem = new Filesystem();
305+
if (null === $path) {
306+
$absolutePath = $this->cwd;
307+
} else {
308+
$filesystem = new Filesystem();
306309

307-
$absolutePath = $filesystem->isAbsolutePath($path)
308-
? $path
309-
: $this->cwd.\DIRECTORY_SEPARATOR.$path;
310+
$absolutePath = $filesystem->isAbsolutePath($path)
311+
? $path
312+
: $this->cwd.\DIRECTORY_SEPARATOR.$path;
313+
}
310314

311315
$this->directory = new Directory(\dirname($absolutePath));
312316
}

src/Event/Event.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
/*
4+
* This file is part of PHP CS Fixer.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
* Dariusz Rumiński <dariusz.ruminski@gmail.com>
8+
*
9+
* This source file is subject to the MIT license that is bundled
10+
* with this source code in the file LICENSE.
11+
*/
12+
13+
namespace PhpCsFixer\Event;
14+
15+
// Since PHP-CS-FIXER is PHP 5.6 compliant we can't always use Symfony Contracts (currently needs PHP ^7.1.3)
16+
// This conditionnal inheritance will be useless when PHP-CS-FIXER no longer supports PHP versions
17+
// inferior to Symfony/Contracts PHP minimal version
18+
if (class_exists(\Symfony\Contracts\EventDispatcher\Event::class)) {
19+
class Event extends \Symfony\Contracts\EventDispatcher\Event
20+
{
21+
}
22+
} else {
23+
class Event extends \Symfony\Component\EventDispatcher\Event
24+
{
25+
}
26+
}

src/FixerFileProcessedEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
namespace PhpCsFixer;
1414

15-
use Symfony\Component\EventDispatcher\Event;
15+
use PhpCsFixer\Event\Event;
1616

1717
/**
1818
* Event that is fired when file was processed by Fixer.

src/Runner/FileFilterIterator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
namespace PhpCsFixer\Runner;
1414

1515
use PhpCsFixer\Cache\CacheManagerInterface;
16+
use PhpCsFixer\Event\Event;
1617
use PhpCsFixer\FileReader;
1718
use PhpCsFixer\FixerFileProcessedEvent;
18-
use Symfony\Component\EventDispatcher\Event;
1919
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
2020

2121
/**

src/Runner/Runner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
use PhpCsFixer\Differ\DifferInterface;
2020
use PhpCsFixer\Error\Error;
2121
use PhpCsFixer\Error\ErrorsManager;
22+
use PhpCsFixer\Event\Event;
2223
use PhpCsFixer\FileReader;
2324
use PhpCsFixer\Fixer\FixerInterface;
2425
use PhpCsFixer\FixerFileProcessedEvent;
2526
use PhpCsFixer\Linter\LinterInterface;
2627
use PhpCsFixer\Linter\LintingException;
2728
use PhpCsFixer\Linter\LintingResultInterface;
2829
use PhpCsFixer\Tokenizer\Tokens;
29-
use Symfony\Component\EventDispatcher\Event;
3030
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
3131
use Symfony\Component\Filesystem\Exception\IOException;
3232

tests/AutoReview/ProjectCodeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ function (\ReflectionClass $interface) {
114114
// @TODO: 3.0 should be removed
115115
$exceptionMethodsPerClass = [
116116
\PhpCsFixer\Config::class => ['create'],
117+
\PhpCsFixer\Event\Event::class => ['stopPropagation'],
117118
\PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer::class => ['fixSpace'],
118119
];
119120

0 commit comments

Comments
 (0)