Skip to content

Commit f569f58

Browse files
Merge branch '2.8' into 3.4
* 2.8: Enable native_constant_invocation CS fixer
2 parents dcdd803 + 2ba0fa4 commit f569f58

File tree

105 files changed

+499
-501
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+499
-501
lines changed

.php_cs.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ return PhpCsFixer\Config::create()
1313
'array_syntax' => array('syntax' => 'long'),
1414
'ordered_imports' => true,
1515
'protected_to_private' => false,
16-
// TODO remove the disabling once https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3876 is merged and released
17-
'native_constant_invocation' => false,
1816
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
1917
'native_function_invocation' => array('include' => array('@compiler_optimized'), 'scope' => 'namespaced'),
2018
))

src/Symfony/Bridge/Doctrine/Tests/PropertyInfo/DoctrineExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class DoctrineExtractorTest extends TestCase
3030

3131
protected function setUp()
3232
{
33-
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'), true);
33+
$config = Setup::createAnnotationMetadataConfiguration(array(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'), true);
3434
$entityManager = EntityManager::create(array('driver' => 'pdo_sqlite'), $config);
3535

3636
if (!DBALType::hasType('foo')) {

src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static function register($mode = 0)
8080
return true;
8181
}
8282
foreach ($vendors as $vendor) {
83-
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) {
83+
if (0 === strpos($realPath, $vendor) && false !== strpbrk(substr($realPath, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
8484
return true;
8585
}
8686
}
@@ -159,7 +159,7 @@ public static function register($mode = 0)
159159
echo "\n".ucfirst($group).' deprecation triggered by '.$class.'::'.$method.':';
160160
echo "\n".$msg;
161161
echo "\nStack trace:";
162-
echo "\n".str_replace(' '.getcwd().DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
162+
echo "\n".str_replace(' '.getcwd().\DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
163163
echo "\n";
164164

165165
exit(1);
@@ -315,7 +315,7 @@ private static function hasColorSupport()
315315
return true;
316316
}
317317

318-
if (DIRECTORY_SEPARATOR === '\\') {
318+
if (\DIRECTORY_SEPARATOR === '\\') {
319319
return (\function_exists('sapi_windows_vt100_support')
320320
&& sapi_windows_vt100_support(STDOUT))
321321
|| false !== getenv('ANSICON')

src/Symfony/Bridge/Twig/Command/DebugCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
159159
}
160160
$firstNamespace = false;
161161
foreach ($paths as $path) {
162-
$rows[] = array($namespace, $path.DIRECTORY_SEPARATOR);
162+
$rows[] = array($namespace, $path.\DIRECTORY_SEPARATOR);
163163
$namespace = '';
164164
}
165165
if (\count($paths) > 1) {
@@ -188,7 +188,7 @@ private function getLoaderPaths()
188188
foreach ($loader->getNamespaces() as $namespace) {
189189
$paths = array_map(function ($path) {
190190
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
191-
$path = ltrim(substr($path, \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
191+
$path = ltrim(substr($path, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
192192
}
193193

194194
return $path;

src/Symfony/Bridge/Twig/Extension/CodeExtension.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class CodeExtension extends AbstractExtension
3434
public function __construct($fileLinkFormat, $rootDir, $charset)
3535
{
3636
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
37-
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, \dirname($rootDir)).DIRECTORY_SEPARATOR;
37+
$this->rootDir = str_replace('/', \DIRECTORY_SEPARATOR, \dirname($rootDir)).\DIRECTORY_SEPARATOR;
3838
$this->charset = $charset;
3939
}
4040

@@ -173,11 +173,11 @@ public function formatFile($file, $line, $text = null)
173173
$file = trim($file);
174174

175175
if (null === $text) {
176-
$text = str_replace('/', DIRECTORY_SEPARATOR, $file);
176+
$text = str_replace('/', \DIRECTORY_SEPARATOR, $file);
177177
if (0 === strpos($text, $this->rootDir)) {
178178
$text = substr($text, \strlen($this->rootDir));
179-
$text = explode(DIRECTORY_SEPARATOR, $text, 2);
180-
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : '');
179+
$text = explode(\DIRECTORY_SEPARATOR, $text, 2);
180+
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? \DIRECTORY_SEPARATOR.$text[1] : '');
181181
}
182182
}
183183

src/Symfony/Bridge/Twig/Tests/Command/DebugCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testLineSeparatorInLoaderPaths()
3939
FilesystemLoader::MAIN_NAMESPACE => array('extractor', 'extractor'),
4040
));
4141
$ret = $tester->execute(array(), array('decorated' => false));
42-
$ds = DIRECTORY_SEPARATOR;
42+
$ds = \DIRECTORY_SEPARATOR;
4343
$loaderPaths = <<<TXT
4444
Loader Paths
4545
------------

src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function testExtractSyntaxError($resources)
9090
$extractor->extract($resources, new MessageCatalogue('en'));
9191
} catch (Error $e) {
9292
if (method_exists($e, 'getSourceContext')) {
93-
$this->assertSame(\dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile());
93+
$this->assertSame(\dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', \DIRECTORY_SEPARATOR), $e->getFile());
9494
$this->assertSame(1, $e->getLine());
9595
$this->assertSame('Unclosed "block".', $e->getMessage());
9696
} else {

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
175175
}
176176

177177
if ($method === $expectedMethod) {
178-
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
178+
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
179179
} else {
180-
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
180+
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
181181
}
182182
} catch (\Exception $e) {
183183
$exitCode = 1;
184-
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
184+
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
185185
}
186186
}
187187
// remove the assets of the bundles that no longer exist

src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
253253
foreach (Finder::create()->files()->depth('<2')->name($tempContainerClass.'*')->in($warmupDir) as $file) {
254254
$content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file));
255255
file_put_contents($file, $content);
256-
rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file));
256+
rename($file, str_replace(\DIRECTORY_SEPARATOR.$tempContainerClass, \DIRECTORY_SEPARATOR.$realContainerClass, $file));
257257
}
258258
if (is_dir($tempContainerDir = $warmupDir.'/'.\get_class($tempKernel->getContainer()))) {
259259
foreach (Finder::create()->files()->in($tempContainerDir) as $file) {

src/Symfony/Bundle/FrameworkBundle/Test/KernelTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ protected static function getPhpUnitXmlDir()
5252

5353
$dir = static::getPhpUnitCliConfigArgument();
5454
if (null === $dir &&
55-
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
56-
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
55+
(is_file(getcwd().\DIRECTORY_SEPARATOR.'phpunit.xml') ||
56+
is_file(getcwd().\DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
5757
$dir = getcwd();
5858
}
5959

0 commit comments

Comments
 (0)