Skip to content

Commit 2ba0fa4

Browse files
Enable native_constant_invocation CS fixer
1 parent 2f6125f commit 2ba0fa4

File tree

82 files changed

+487
-489
lines changed

Some content is hidden

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

82 files changed

+487
-489
lines changed

.php_cs.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ return PhpCsFixer\Config::create()
1616
// rule disabled due to https://bugs.php.net/bug.php?id=60573 bug;
1717
// to be re-enabled (by dropping next line, rule is part of @Symfony already) on branch that requires PHP 5.4+
1818
'self_accessor' => false,
19-
// TODO remove the disabling once https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3876 is merged and released
20-
'native_constant_invocation' => false,
2119
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
2220
'native_function_invocation' => array('include' => array('@compiler_optimized'), 'scope' => 'namespaced'),
2321
))

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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static function register($mode = 0)
106106
echo "\n".ucfirst($group).' deprecation triggered by '.$class.'::'.$method.':';
107107
echo "\n".$msg;
108108
echo "\nStack trace:";
109-
echo "\n".str_replace(' '.getcwd().DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
109+
echo "\n".str_replace(' '.getcwd().\DIRECTORY_SEPARATOR, ' ', $e->getTraceAsString());
110110
echo "\n";
111111

112112
exit(1);
@@ -230,7 +230,7 @@ private static function hasColorSupport()
230230
return true;
231231
}
232232

233-
if (DIRECTORY_SEPARATOR === '\\') {
233+
if (\DIRECTORY_SEPARATOR === '\\') {
234234
return (\function_exists('sapi_windows_vt100_support')
235235
&& sapi_windows_vt100_support(STDOUT))
236236
|| false !== getenv('ANSICON')

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

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

@@ -164,11 +164,11 @@ public function formatFile($file, $line, $text = null)
164164
$file = trim($file);
165165

166166
if (null === $text) {
167-
$text = str_replace('/', DIRECTORY_SEPARATOR, $file);
167+
$text = str_replace('/', \DIRECTORY_SEPARATOR, $file);
168168
if (0 === strpos($text, $this->rootDir)) {
169169
$text = substr($text, \strlen($this->rootDir));
170-
$text = explode(DIRECTORY_SEPARATOR, $text, 2);
171-
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : '');
170+
$text = explode(\DIRECTORY_SEPARATOR, $text, 2);
171+
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? \DIRECTORY_SEPARATOR.$text[1] : '');
172172
}
173173
}
174174

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
@@ -143,13 +143,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
143143
}
144144

145145
if ($method === $expectedMethod) {
146-
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
146+
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
147147
} else {
148-
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
148+
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
149149
}
150150
} catch (\Exception $e) {
151151
$exitCode = 1;
152-
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
152+
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
153153
}
154154
}
155155
// remove the assets of the bundles that no longer exist

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9696
$this->warmup($warmupDir, $realCacheDir, !$input->getOption('no-optional-warmers'));
9797

9898
$filesystem->rename($realCacheDir, $oldCacheDir);
99-
if ('\\' === DIRECTORY_SEPARATOR) {
99+
if ('\\' === \DIRECTORY_SEPARATOR) {
100100
sleep(1); // workaround for Windows PHP rename bug
101101
}
102102
$filesystem->rename($warmupDir, $realCacheDir);
@@ -171,7 +171,7 @@ protected function warmup($warmupDir, $realCacheDir, $enableOptionalWarmers = tr
171171
foreach (Finder::create()->files()->depth('<2')->name($tempContainerClass.'*')->in($warmupDir) as $file) {
172172
$content = str_replace($tempContainerClass, $realContainerClass, file_get_contents($file));
173173
file_put_contents($file, $content);
174-
rename($file, str_replace(DIRECTORY_SEPARATOR.$tempContainerClass, DIRECTORY_SEPARATOR.$realContainerClass, $file));
174+
rename($file, str_replace(\DIRECTORY_SEPARATOR.$tempContainerClass, \DIRECTORY_SEPARATOR.$realContainerClass, $file));
175175
}
176176

177177
// remove temp kernel file after cache warmed up

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

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

4949
$dir = static::getPhpUnitCliConfigArgument();
5050
if (null === $dir &&
51-
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
52-
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
51+
(is_file(getcwd().\DIRECTORY_SEPARATOR.'phpunit.xml') ||
52+
is_file(getcwd().\DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
5353
$dir = getcwd();
5454
}
5555

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected function setUp()
3333
{
3434
$this->fs = new Filesystem();
3535
$this->kernel = new TestAppKernel('test', true);
36-
$this->rootDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('sf2_cache_', true);
36+
$this->rootDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf2_cache_', true);
3737
$this->kernel->setRootDir($this->rootDir);
3838
$this->fs->mkdir($this->rootDir);
3939
}

src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@ public function setRootDir($rootDir)
3131

3232
public function registerContainerConfiguration(LoaderInterface $loader)
3333
{
34-
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
34+
$loader->load(__DIR__.\DIRECTORY_SEPARATOR.'config.yml');
3535
}
3636
}

0 commit comments

Comments
 (0)