Thanks to visit codestin.com
Credit goes to github.com

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

src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplatePathsCacheWarmerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function setUp()
5050

5151
$this->templateLocator = new TemplateLocator($this->fileLocator);
5252

53-
$this->tmpDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('cache_template_paths_', true);
53+
$this->tmpDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('cache_template_paths_', true);
5454

5555
$this->filesystem = new Filesystem();
5656
$this->filesystem->mkdir($this->tmpDir);

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

Lines changed: 2 additions & 2 deletions
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
}
@@ -86,7 +86,7 @@ public function testCacheIsFreshAfterCacheClearedWithWarmup()
8686
return;
8787
}
8888
$containerRef = new \ReflectionClass(require $containerFile);
89-
$containerFile = str_replace('tes_'.DIRECTORY_SEPARATOR, 'test'.DIRECTORY_SEPARATOR, $containerRef->getFileName());
89+
$containerFile = str_replace('tes_'.\DIRECTORY_SEPARATOR, 'test'.\DIRECTORY_SEPARATOR, $containerRef->getFileName());
9090
$this->assertRegExp(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container');
9191
}
9292
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function setRootDir($rootDir)
3333

3434
public function registerContainerConfiguration(LoaderInterface $loader)
3535
{
36-
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
36+
$loader->load(__DIR__.\DIRECTORY_SEPARATOR.'config.yml');
3737
}
3838

3939
protected function build(ContainerBuilder $container)

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -501,29 +501,29 @@ public function testTranslator()
501501
$files = array_map('realpath', $options['resource_files']['en']);
502502
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
503503
$this->assertContains(
504-
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
504+
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
505505
$files,
506506
'->registerTranslatorConfiguration() finds Validator translation resources'
507507
);
508508
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
509509
$this->assertContains(
510-
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
510+
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
511511
$files,
512512
'->registerTranslatorConfiguration() finds Form translation resources'
513513
);
514514
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
515515
$this->assertContains(
516-
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
516+
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', \DIRECTORY_SEPARATOR),
517517
$files,
518518
'->registerTranslatorConfiguration() finds Security translation resources'
519519
);
520520
$this->assertContains(
521-
strtr(__DIR__.'/Fixtures/translations/test_paths.en.yml', '/', DIRECTORY_SEPARATOR),
521+
strtr(__DIR__.'/Fixtures/translations/test_paths.en.yml', '/', \DIRECTORY_SEPARATOR),
522522
$files,
523523
'->registerTranslatorConfiguration() finds translation resources in custom paths'
524524
);
525525
$this->assertContains(
526-
strtr(__DIR__.'/translations/test_default.en.xlf', '/', DIRECTORY_SEPARATOR),
526+
strtr(__DIR__.'/translations/test_default.en.xlf', '/', \DIRECTORY_SEPARATOR),
527527
$files,
528528
'->registerTranslatorConfiguration() finds translation resources in default path'
529529
);
@@ -572,7 +572,7 @@ public function testValidation()
572572
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
573573
$xmlMappings = array(
574574
\dirname($ref->getFileName()).'/Resources/config/validation.xml',
575-
strtr($projectDir.'/config/validator/foo.xml', '/', DIRECTORY_SEPARATOR),
575+
strtr($projectDir.'/config/validator/foo.xml', '/', \DIRECTORY_SEPARATOR),
576576
);
577577

578578
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
@@ -666,10 +666,10 @@ public function testValidationPaths()
666666
$this->assertCount(3, $xmlMappings);
667667
try {
668668
// Testing symfony/symfony
669-
$this->assertStringEndsWith('Component'.DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
669+
$this->assertStringEndsWith('Component'.\DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
670670
} catch (\Exception $e) {
671671
// Testing symfony/framework-bundle with deps=high
672-
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
672+
$this->assertStringEndsWith('symfony'.\DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
673673
}
674674
$this->assertStringEndsWith('TestBundle/Resources/config/validation.xml', $xmlMappings[1]);
675675

@@ -693,10 +693,10 @@ public function testValidationPathsUsingCustomBundlePath()
693693

694694
try {
695695
// Testing symfony/symfony
696-
$this->assertStringEndsWith('Component'.DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
696+
$this->assertStringEndsWith('Component'.\DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
697697
} catch (\Exception $e) {
698698
// Testing symfony/framework-bundle with deps=high
699-
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
699+
$this->assertStringEndsWith('symfony'.\DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
700700
}
701701
$this->assertStringEndsWith('CustomPathBundle/Resources/config/validation.xml', $xmlMappings[1]);
702702

@@ -921,15 +921,15 @@ public function testSerializerMapping()
921921

922922
foreach ($expectedLoaders as $definition) {
923923
if (is_file($arg = $definition->getArgument(0))) {
924-
$definition->replaceArgument(0, strtr($arg, '/', DIRECTORY_SEPARATOR));
924+
$definition->replaceArgument(0, strtr($arg, '/', \DIRECTORY_SEPARATOR));
925925
}
926926
$definition->setPublic(false);
927927
}
928928

929929
$loaders = $container->getDefinition('serializer.mapping.chain_loader')->getArgument(0);
930930
foreach ($loaders as $loader) {
931931
if (is_file($arg = $loader->getArgument(0))) {
932-
$loader->replaceArgument(0, strtr($arg, '/', DIRECTORY_SEPARATOR));
932+
$loader->replaceArgument(0, strtr($arg, '/', \DIRECTORY_SEPARATOR));
933933
}
934934
}
935935
$this->assertEquals($expectedLoaders, $loaders);

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function openAction(Request $request)
383383
$file = $request->query->get('file');
384384
$line = $request->query->get('line');
385385

386-
$filename = $this->baseDir.DIRECTORY_SEPARATOR.$file;
386+
$filename = $this->baseDir.\DIRECTORY_SEPARATOR.$file;
387387

388388
if (preg_match("'(^|[/\\\\])\.'", $file) || !is_readable($filename)) {
389389
throw new NotFoundHttpException(sprintf('The file "%s" cannot be opened.', $file));

src/Symfony/Component/Cache/Tests/Adapter/ApcuAdapterTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public function createCachePool($defaultLifetime = 0)
2727
if (!\function_exists('apcu_fetch') || !ini_get('apc.enabled')) {
2828
$this->markTestSkipped('APCu extension is required.');
2929
}
30-
if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
30+
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
3131
if ('testWithCliSapi' !== $this->getName()) {
3232
$this->markTestSkipped('apc.enable_cli=1 is required.');
3333
}
3434
}
35-
if ('\\' === DIRECTORY_SEPARATOR) {
35+
if ('\\' === \DIRECTORY_SEPARATOR) {
3636
$this->markTestSkipped('Fails transiently on Windows.');
3737
}
3838

src/Symfony/Component/Cache/Tests/Simple/ApcuCacheTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ class ApcuCacheTest extends CacheTestCase
2323

2424
public function createSimpleCache($defaultLifetime = 0)
2525
{
26-
if (!\function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) {
26+
if (!\function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli'))) {
2727
$this->markTestSkipped('APCu extension is required.');
2828
}
29-
if ('\\' === DIRECTORY_SEPARATOR) {
29+
if ('\\' === \DIRECTORY_SEPARATOR) {
3030
$this->markTestSkipped('Fails transiently on Windows.');
3131
}
3232

src/Symfony/Component/Cache/Traits/ApcuTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ private function init($namespace, $defaultLifetime, $version)
3131
if (!static::isSupported()) {
3232
throw new CacheException('APCu is not enabled');
3333
}
34-
if ('cli' === PHP_SAPI) {
34+
if ('cli' === \PHP_SAPI) {
3535
ini_set('apc.use_request_time', 0);
3636
}
3737
parent::__construct($namespace, $defaultLifetime);
@@ -75,7 +75,7 @@ protected function doHave($id)
7575
*/
7676
protected function doClear($namespace)
7777
{
78-
return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== PHP_SAPI || ini_get('apc.enable_cli'))
78+
return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== \PHP_SAPI || ini_get('apc.enable_cli'))
7979
? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), APC_ITER_KEY))
8080
: apcu_clear_cache();
8181
}

src/Symfony/Component/Cache/Traits/FilesystemCommonTrait.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ private function init($namespace, $directory)
3434
if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) {
3535
throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
3636
}
37-
$directory .= DIRECTORY_SEPARATOR.$namespace;
37+
$directory .= \DIRECTORY_SEPARATOR.$namespace;
3838
}
3939
if (!file_exists($directory)) {
4040
@mkdir($directory, 0777, true);
4141
}
42-
$directory .= DIRECTORY_SEPARATOR;
42+
$directory .= \DIRECTORY_SEPARATOR;
4343
// On Windows the whole path is limited to 258 chars
44-
if ('\\' === DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
44+
if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
4545
throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory));
4646
}
4747

@@ -99,7 +99,7 @@ private function write($file, $data, $expiresAt = null)
9999
private function getFile($id, $mkdir = false)
100100
{
101101
$hash = str_replace('/', '-', base64_encode(hash('sha256', static::class.$id, true)));
102-
$dir = $this->directory.strtoupper($hash[0].DIRECTORY_SEPARATOR.$hash[1].DIRECTORY_SEPARATOR);
102+
$dir = $this->directory.strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR);
103103

104104
if ($mkdir && !file_exists($dir)) {
105105
@mkdir($dir, 0777, true);

0 commit comments

Comments
 (0)