Merge branch '4.1'
* 4.1: Enable native_constant_invocation CS fixer
This commit is contained in:
commit
510977dd19
|
@ -13,8 +13,6 @@ return PhpCsFixer\Config::create()
|
|||
'array_syntax' => array('syntax' => 'long'),
|
||||
'ordered_imports' => true,
|
||||
'protected_to_private' => false,
|
||||
// TODO remove the disabling once https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/3876 is merged and released
|
||||
'native_constant_invocation' => false,
|
||||
// Part of @Symfony:risky in PHP-CS-Fixer 2.13.0. To be removed from the config file once upgrading
|
||||
'native_function_invocation' => array('include' => array('@compiler_optimized'), 'scope' => 'namespaced'),
|
||||
))
|
||||
|
|
|
@ -126,7 +126,7 @@ EOF
|
|||
}
|
||||
$firstNamespace = false;
|
||||
foreach ($paths as $path) {
|
||||
$rows[] = array($namespace, $path.DIRECTORY_SEPARATOR);
|
||||
$rows[] = array($namespace, $path.\DIRECTORY_SEPARATOR);
|
||||
$namespace = '';
|
||||
}
|
||||
if (\count($paths) > 1) {
|
||||
|
@ -159,7 +159,7 @@ EOF
|
|||
foreach ($loader->getNamespaces() as $namespace) {
|
||||
$paths = array_map(function ($path) {
|
||||
if (null !== $this->projectDir && 0 === strpos($path, $this->projectDir)) {
|
||||
$path = ltrim(substr($path, \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
||||
$path = ltrim(substr($path, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
return $path;
|
||||
|
@ -272,7 +272,7 @@ EOF
|
|||
|
||||
if ($this->rootDir && $this->projectDir) {
|
||||
$folders = glob($this->rootDir.'/Resources/*/views', GLOB_ONLYDIR);
|
||||
$relativePath = ltrim(substr($this->rootDir.'/Resources/', \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
||||
$relativePath = ltrim(substr($this->rootDir.'/Resources/', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
|
||||
$bundleNames = array_reduce(
|
||||
$folders,
|
||||
function ($carry, $absolutePath) use ($relativePath) {
|
||||
|
@ -290,13 +290,13 @@ EOF
|
|||
|
||||
if ($this->twigDefaultPath && $this->projectDir) {
|
||||
$folders = glob($this->twigDefaultPath.'/bundles/*', GLOB_ONLYDIR);
|
||||
$relativePath = ltrim(substr($this->twigDefaultPath.'/bundles', \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
||||
$relativePath = ltrim(substr($this->twigDefaultPath.'/bundles', \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
|
||||
$bundleNames = array_reduce(
|
||||
$folders,
|
||||
function ($carry, $absolutePath) use ($relativePath) {
|
||||
if (0 === strpos($absolutePath, $this->projectDir)) {
|
||||
$path = ltrim(substr($absolutePath, \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
||||
$name = ltrim(substr($path, \strlen($relativePath)), DIRECTORY_SEPARATOR);
|
||||
$path = ltrim(substr($absolutePath, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
|
||||
$name = ltrim(substr($path, \strlen($relativePath)), \DIRECTORY_SEPARATOR);
|
||||
$carry[$name] = $path;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ class CodeExtension extends AbstractExtension
|
|||
public function __construct($fileLinkFormat, string $rootDir, string $charset, string $projectDir = null)
|
||||
{
|
||||
$this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
|
||||
$this->rootDir = str_replace('/', DIRECTORY_SEPARATOR, \dirname($rootDir)).DIRECTORY_SEPARATOR;
|
||||
$this->rootDir = str_replace('/', \DIRECTORY_SEPARATOR, \dirname($rootDir)).\DIRECTORY_SEPARATOR;
|
||||
$this->charset = $charset;
|
||||
$this->projectDir = $projectDir;
|
||||
}
|
||||
|
@ -176,11 +176,11 @@ class CodeExtension extends AbstractExtension
|
|||
$file = trim($file);
|
||||
|
||||
if (null === $text) {
|
||||
$text = str_replace('/', DIRECTORY_SEPARATOR, $file);
|
||||
$text = str_replace('/', \DIRECTORY_SEPARATOR, $file);
|
||||
if (0 === strpos($text, $this->rootDir)) {
|
||||
$text = substr($text, \strlen($this->rootDir));
|
||||
$text = explode(DIRECTORY_SEPARATOR, $text, 2);
|
||||
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? DIRECTORY_SEPARATOR.$text[1] : '');
|
||||
$text = explode(\DIRECTORY_SEPARATOR, $text, 2);
|
||||
$text = sprintf('<abbr title="%s%2$s">%s</abbr>%s', $this->rootDir, $text[0], isset($text[1]) ? \DIRECTORY_SEPARATOR.$text[1] : '');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class DebugCommandTest extends TestCase
|
|||
FilesystemLoader::MAIN_NAMESPACE => array('extractor', 'extractor'),
|
||||
));
|
||||
$ret = $tester->execute(array(), array('decorated' => false));
|
||||
$ds = DIRECTORY_SEPARATOR;
|
||||
$ds = \DIRECTORY_SEPARATOR;
|
||||
$loaderPaths = <<<TXT
|
||||
Loader Paths
|
||||
------------
|
||||
|
|
|
@ -90,7 +90,7 @@ class TwigExtractorTest extends TestCase
|
|||
$extractor->extract($resources, new MessageCatalogue('en'));
|
||||
} catch (Error $e) {
|
||||
if (method_exists($e, 'getSourceContext')) {
|
||||
$this->assertSame(\dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', DIRECTORY_SEPARATOR), $e->getFile());
|
||||
$this->assertSame(\dirname(__DIR__).strtr('/Fixtures/extractor/syntax_error.twig', '/', \DIRECTORY_SEPARATOR), $e->getFile());
|
||||
$this->assertSame(1, $e->getLine());
|
||||
$this->assertSame('Unclosed "block".', $e->getMessage());
|
||||
} else {
|
||||
|
|
|
@ -154,13 +154,13 @@ EOT
|
|||
}
|
||||
|
||||
if ($method === $expectedMethod) {
|
||||
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
|
||||
$rows[] = array(sprintf('<fg=green;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'OK' : "\xE2\x9C\x94" /* HEAVY CHECK MARK (U+2714) */), $message, $method);
|
||||
} else {
|
||||
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
|
||||
$rows[] = array(sprintf('<fg=yellow;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'WARNING' : '!'), $message, $method);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
$exitCode = 1;
|
||||
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
|
||||
$rows[] = array(sprintf('<fg=red;options=bold>%s</>', '\\' === \DIRECTORY_SEPARATOR ? 'ERROR' : "\xE2\x9C\x98" /* HEAVY BALLOT X (U+2718) */), $message, $e->getMessage());
|
||||
}
|
||||
}
|
||||
// remove the assets of the bundles that no longer exist
|
||||
|
|
|
@ -50,7 +50,7 @@ class TemplatePathsCacheWarmerTest extends TestCase
|
|||
|
||||
$this->templateLocator = new TemplateLocator($this->fileLocator);
|
||||
|
||||
$this->tmpDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('cache_template_paths_', true);
|
||||
$this->tmpDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('cache_template_paths_', true);
|
||||
|
||||
$this->filesystem = new Filesystem();
|
||||
$this->filesystem->mkdir($this->tmpDir);
|
||||
|
|
|
@ -33,7 +33,7 @@ class CacheClearCommandTest extends TestCase
|
|||
{
|
||||
$this->fs = new Filesystem();
|
||||
$this->kernel = new TestAppKernel('test', true);
|
||||
$this->rootDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('sf2_cache_', true);
|
||||
$this->rootDir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.uniqid('sf2_cache_', true);
|
||||
$this->kernel->setRootDir($this->rootDir);
|
||||
$this->fs->mkdir($this->rootDir);
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class CacheClearCommandTest extends TestCase
|
|||
$this->assertTrue($found, 'Kernel file should present as resource');
|
||||
|
||||
$containerRef = new \ReflectionClass(require $containerFile);
|
||||
$containerFile = str_replace('tes_'.DIRECTORY_SEPARATOR, 'test'.DIRECTORY_SEPARATOR, $containerRef->getFileName());
|
||||
$containerFile = str_replace('tes_'.\DIRECTORY_SEPARATOR, 'test'.\DIRECTORY_SEPARATOR, $containerRef->getFileName());
|
||||
$this->assertRegExp(sprintf('/\'kernel.container_class\'\s*=>\s*\'%s\'/', $containerClass), file_get_contents($containerFile), 'kernel.container_class is properly set on the dumped container');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ class TestAppKernel extends Kernel
|
|||
|
||||
public function registerContainerConfiguration(LoaderInterface $loader)
|
||||
{
|
||||
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
|
||||
$loader->load(__DIR__.\DIRECTORY_SEPARATOR.'config.yml');
|
||||
}
|
||||
|
||||
protected function build(ContainerBuilder $container)
|
||||
|
|
|
@ -657,29 +657,29 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
$files = array_map('realpath', $options['resource_files']['en']);
|
||||
$ref = new \ReflectionClass('Symfony\Component\Validator\Validation');
|
||||
$this->assertContains(
|
||||
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
|
||||
$files,
|
||||
'->registerTranslatorConfiguration() finds Validator translation resources'
|
||||
);
|
||||
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
|
||||
$this->assertContains(
|
||||
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||
strtr(\dirname($ref->getFileName()).'/Resources/translations/validators.en.xlf', '/', \DIRECTORY_SEPARATOR),
|
||||
$files,
|
||||
'->registerTranslatorConfiguration() finds Form translation resources'
|
||||
);
|
||||
$ref = new \ReflectionClass('Symfony\Component\Security\Core\Security');
|
||||
$this->assertContains(
|
||||
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||
strtr(\dirname($ref->getFileName()).'/Resources/translations/security.en.xlf', '/', \DIRECTORY_SEPARATOR),
|
||||
$files,
|
||||
'->registerTranslatorConfiguration() finds Security translation resources'
|
||||
);
|
||||
$this->assertContains(
|
||||
strtr(__DIR__.'/Fixtures/translations/test_paths.en.yml', '/', DIRECTORY_SEPARATOR),
|
||||
strtr(__DIR__.'/Fixtures/translations/test_paths.en.yml', '/', \DIRECTORY_SEPARATOR),
|
||||
$files,
|
||||
'->registerTranslatorConfiguration() finds translation resources in custom paths'
|
||||
);
|
||||
$this->assertContains(
|
||||
strtr(__DIR__.'/translations/test_default.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||
strtr(__DIR__.'/translations/test_default.en.xlf', '/', \DIRECTORY_SEPARATOR),
|
||||
$files,
|
||||
'->registerTranslatorConfiguration() finds translation resources in default path'
|
||||
);
|
||||
|
@ -728,7 +728,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
$ref = new \ReflectionClass('Symfony\Component\Form\Form');
|
||||
$xmlMappings = array(
|
||||
\dirname($ref->getFileName()).'/Resources/config/validation.xml',
|
||||
strtr($projectDir.'/config/validator/foo.xml', '/', DIRECTORY_SEPARATOR),
|
||||
strtr($projectDir.'/config/validator/foo.xml', '/', \DIRECTORY_SEPARATOR),
|
||||
);
|
||||
|
||||
$calls = $container->getDefinition('validator.builder')->getMethodCalls();
|
||||
|
@ -822,10 +822,10 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
$this->assertCount(3, $xmlMappings);
|
||||
try {
|
||||
// Testing symfony/symfony
|
||||
$this->assertStringEndsWith('Component'.DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
$this->assertStringEndsWith('Component'.\DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
} catch (\Exception $e) {
|
||||
// Testing symfony/framework-bundle with deps=high
|
||||
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
$this->assertStringEndsWith('symfony'.\DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
}
|
||||
$this->assertStringEndsWith('TestBundle/Resources/config/validation.xml', $xmlMappings[1]);
|
||||
|
||||
|
@ -849,10 +849,10 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
|
||||
try {
|
||||
// Testing symfony/symfony
|
||||
$this->assertStringEndsWith('Component'.DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
$this->assertStringEndsWith('Component'.\DIRECTORY_SEPARATOR.'Form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
} catch (\Exception $e) {
|
||||
// Testing symfony/framework-bundle with deps=high
|
||||
$this->assertStringEndsWith('symfony'.DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
$this->assertStringEndsWith('symfony'.\DIRECTORY_SEPARATOR.'form/Resources/config/validation.xml', $xmlMappings[0]);
|
||||
}
|
||||
$this->assertStringEndsWith('CustomPathBundle/Resources/config/validation.xml', $xmlMappings[1]);
|
||||
|
||||
|
@ -1096,7 +1096,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
|
||||
foreach ($expectedLoaders as $definition) {
|
||||
if (is_file($arg = $definition->getArgument(0))) {
|
||||
$definition->replaceArgument(0, strtr($arg, '/', DIRECTORY_SEPARATOR));
|
||||
$definition->replaceArgument(0, strtr($arg, '/', \DIRECTORY_SEPARATOR));
|
||||
}
|
||||
$definition->setPublic(false);
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ abstract class FrameworkExtensionTest extends TestCase
|
|||
$loaders = $container->getDefinition('serializer.mapping.chain_loader')->getArgument(0);
|
||||
foreach ($loaders as $loader) {
|
||||
if (is_file($arg = $loader->getArgument(0))) {
|
||||
$loader->replaceArgument(0, strtr($arg, '/', DIRECTORY_SEPARATOR));
|
||||
$loader->replaceArgument(0, strtr($arg, '/', \DIRECTORY_SEPARATOR));
|
||||
}
|
||||
}
|
||||
$this->assertEquals($expectedLoaders, $loaders);
|
||||
|
|
|
@ -368,7 +368,7 @@ class ProfilerController
|
|||
$file = $request->query->get('file');
|
||||
$line = $request->query->get('line');
|
||||
|
||||
$filename = $this->baseDir.DIRECTORY_SEPARATOR.$file;
|
||||
$filename = $this->baseDir.\DIRECTORY_SEPARATOR.$file;
|
||||
|
||||
if (preg_match("'(^|[/\\\\])\.'", $file) || !is_readable($filename)) {
|
||||
throw new NotFoundHttpException(sprintf('The file "%s" cannot be opened.', $file));
|
||||
|
|
|
@ -27,12 +27,12 @@ class ApcuAdapterTest extends AdapterTestCase
|
|||
if (!\function_exists('apcu_fetch') || !ini_get('apc.enabled')) {
|
||||
$this->markTestSkipped('APCu extension is required.');
|
||||
}
|
||||
if ('cli' === PHP_SAPI && !ini_get('apc.enable_cli')) {
|
||||
if ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli')) {
|
||||
if ('testWithCliSapi' !== $this->getName()) {
|
||||
$this->markTestSkipped('apc.enable_cli=1 is required.');
|
||||
}
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Fails transiently on Windows.');
|
||||
}
|
||||
|
||||
|
|
|
@ -23,10 +23,10 @@ class ApcuCacheTest extends CacheTestCase
|
|||
|
||||
public function createSimpleCache($defaultLifetime = 0)
|
||||
{
|
||||
if (!\function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === PHP_SAPI && !ini_get('apc.enable_cli'))) {
|
||||
if (!\function_exists('apcu_fetch') || !ini_get('apc.enabled') || ('cli' === \PHP_SAPI && !ini_get('apc.enable_cli'))) {
|
||||
$this->markTestSkipped('APCu extension is required.');
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Fails transiently on Windows.');
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ trait ApcuTrait
|
|||
if (!static::isSupported()) {
|
||||
throw new CacheException('APCu is not enabled');
|
||||
}
|
||||
if ('cli' === PHP_SAPI) {
|
||||
if ('cli' === \PHP_SAPI) {
|
||||
ini_set('apc.use_request_time', 0);
|
||||
}
|
||||
parent::__construct($namespace, $defaultLifetime);
|
||||
|
@ -81,7 +81,7 @@ trait ApcuTrait
|
|||
*/
|
||||
protected function doClear($namespace)
|
||||
{
|
||||
return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== PHP_SAPI || ini_get('apc.enable_cli'))
|
||||
return isset($namespace[0]) && class_exists('APCuIterator', false) && ('cli' !== \PHP_SAPI || ini_get('apc.enable_cli'))
|
||||
? apcu_delete(new \APCuIterator(sprintf('/^%s/', preg_quote($namespace, '/')), APC_ITER_KEY))
|
||||
: apcu_clear_cache();
|
||||
}
|
||||
|
|
|
@ -34,14 +34,14 @@ trait FilesystemCommonTrait
|
|||
if (preg_match('#[^-+_.A-Za-z0-9]#', $namespace, $match)) {
|
||||
throw new InvalidArgumentException(sprintf('Namespace contains "%s" but only characters in [-+_.A-Za-z0-9] are allowed.', $match[0]));
|
||||
}
|
||||
$directory .= DIRECTORY_SEPARATOR.$namespace;
|
||||
$directory .= \DIRECTORY_SEPARATOR.$namespace;
|
||||
}
|
||||
if (!file_exists($directory)) {
|
||||
@mkdir($directory, 0777, true);
|
||||
}
|
||||
$directory .= DIRECTORY_SEPARATOR;
|
||||
$directory .= \DIRECTORY_SEPARATOR;
|
||||
// On Windows the whole path is limited to 258 chars
|
||||
if ('\\' === DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && \strlen($directory) > 234) {
|
||||
throw new InvalidArgumentException(sprintf('Cache directory too long (%s)', $directory));
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ trait FilesystemCommonTrait
|
|||
{
|
||||
// Use MD5 to favor speed over security, which is not an issue here
|
||||
$hash = str_replace('/', '-', base64_encode(hash('md5', static::class.$id, true)));
|
||||
$dir = $this->directory.strtoupper($hash[0].DIRECTORY_SEPARATOR.$hash[1].DIRECTORY_SEPARATOR);
|
||||
$dir = $this->directory.strtoupper($hash[0].\DIRECTORY_SEPARATOR.$hash[1].\DIRECTORY_SEPARATOR);
|
||||
|
||||
if ($mkdir && !file_exists($dir)) {
|
||||
@mkdir($dir, 0777, true);
|
||||
|
|
|
@ -57,7 +57,7 @@ class FileLoaderLoadException extends \Exception
|
|||
|
||||
// Is the resource located inside a bundle?
|
||||
if ('@' === $resource[0]) {
|
||||
$parts = explode(DIRECTORY_SEPARATOR, $resource);
|
||||
$parts = explode(\DIRECTORY_SEPARATOR, $resource);
|
||||
$bundle = substr($parts[0], 1);
|
||||
$message .= sprintf(' Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle);
|
||||
$message .= sprintf(' If the bundle is registered, make sure the bundle path "%s" is not empty.', $resource);
|
||||
|
|
|
@ -57,7 +57,7 @@ class FileLocator implements FileLocatorInterface
|
|||
$filepaths = $notfound = array();
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (@file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) {
|
||||
if (@file_exists($file = $path.\DIRECTORY_SEPARATOR.$name)) {
|
||||
if (true === $first) {
|
||||
return $file;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class ReflectionClassResource implements SelfCheckingResourceInterface, \Seriali
|
|||
$file = $class->getFileName();
|
||||
if (false !== $file && file_exists($file)) {
|
||||
foreach ($this->excludedVendors as $vendor) {
|
||||
if (0 === strpos($file, $vendor) && false !== strpbrk(substr($file, \strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) {
|
||||
if (0 === strpos($file, $vendor) && false !== strpbrk(substr($file, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
|
||||
$file = false;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -46,33 +46,33 @@ class FileLocatorTest extends TestCase
|
|||
$loader = new FileLocator(__DIR__.'/Fixtures');
|
||||
|
||||
$this->assertEquals(
|
||||
__DIR__.DIRECTORY_SEPARATOR.'FileLocatorTest.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'FileLocatorTest.php',
|
||||
$loader->locate('FileLocatorTest.php', __DIR__),
|
||||
'->locate() returns the absolute filename if the file exists in the given path'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml',
|
||||
__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml',
|
||||
$loader->locate('foo.xml', __DIR__),
|
||||
'->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml',
|
||||
$loader->locate(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__),
|
||||
__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml',
|
||||
$loader->locate(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__),
|
||||
'->locate() returns the absolute filename if the file exists in one of the paths given in the constructor'
|
||||
);
|
||||
|
||||
$loader = new FileLocator(array(__DIR__.'/Fixtures', __DIR__.'/Fixtures/Again'));
|
||||
|
||||
$this->assertEquals(
|
||||
array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'),
|
||||
array(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.\DIRECTORY_SEPARATOR.'foo.xml'),
|
||||
$loader->locate('foo.xml', __DIR__, false),
|
||||
'->locate() returns an array of absolute filenames'
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'),
|
||||
array(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.\DIRECTORY_SEPARATOR.'foo.xml'),
|
||||
$loader->locate('foo.xml', __DIR__.'/Fixtures', false),
|
||||
'->locate() returns an array of absolute filenames'
|
||||
);
|
||||
|
@ -80,7 +80,7 @@ class FileLocatorTest extends TestCase
|
|||
$loader = new FileLocator(__DIR__.'/Fixtures/Again');
|
||||
|
||||
$this->assertEquals(
|
||||
array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'),
|
||||
array(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.\DIRECTORY_SEPARATOR.'foo.xml'),
|
||||
$loader->locate('foo.xml', __DIR__.'/Fixtures', false),
|
||||
'->locate() returns an array of absolute filenames'
|
||||
);
|
||||
|
|
|
@ -88,7 +88,7 @@ class FileLoaderTest extends TestCase
|
|||
{
|
||||
$loader = new TestFileLoader(new FileLocator(__DIR__));
|
||||
|
||||
$this->assertSame(__FILE__, strtr($loader->import('FileLoaderTest.*'), '/', DIRECTORY_SEPARATOR));
|
||||
$this->assertSame(__FILE__, strtr($loader->import('FileLoaderTest.*'), '/', \DIRECTORY_SEPARATOR));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class DirectoryResourceTest extends TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->directory = sys_get_temp_dir().DIRECTORY_SEPARATOR.'symfonyDirectoryIterator';
|
||||
$this->directory = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'symfonyDirectoryIterator';
|
||||
if (!file_exists($this->directory)) {
|
||||
mkdir($this->directory);
|
||||
}
|
||||
|
|
|
@ -27,12 +27,12 @@ class GlobResourceTest extends TestCase
|
|||
|
||||
public function testIterator()
|
||||
{
|
||||
$dir = \dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures';
|
||||
$dir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures';
|
||||
$resource = new GlobResource($dir, '/Resource', true);
|
||||
|
||||
$paths = iterator_to_array($resource);
|
||||
|
||||
$file = $dir.'/Resource'.DIRECTORY_SEPARATOR.'ConditionalClass.php';
|
||||
$file = $dir.'/Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php';
|
||||
$this->assertEquals(array($file => new \SplFileInfo($file)), $paths);
|
||||
$this->assertInstanceOf('SplFileInfo', current($paths));
|
||||
$this->assertSame($dir, $resource->getPrefix());
|
||||
|
@ -41,7 +41,7 @@ class GlobResourceTest extends TestCase
|
|||
|
||||
$paths = iterator_to_array($resource);
|
||||
|
||||
$file = $dir.DIRECTORY_SEPARATOR.'Resource'.DIRECTORY_SEPARATOR.'ConditionalClass.php';
|
||||
$file = $dir.\DIRECTORY_SEPARATOR.'Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php';
|
||||
$this->assertEquals(array($file => $file), $paths);
|
||||
$this->assertInstanceOf('SplFileInfo', current($paths));
|
||||
$this->assertSame($dir, $resource->getPrefix());
|
||||
|
|
|
@ -296,7 +296,7 @@ class QuestionHelper extends Helper
|
|||
*/
|
||||
private function getHiddenResponse(OutputInterface $output, $inputStream): string
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
|
||||
|
||||
// handle code running from a phar
|
||||
|
|
|
@ -97,7 +97,7 @@ class StreamOutput extends Output
|
|||
return true;
|
||||
}
|
||||
|
||||
if (DIRECTORY_SEPARATOR === '\\') {
|
||||
if (\DIRECTORY_SEPARATOR === '\\') {
|
||||
return (\function_exists('sapi_windows_vt100_support')
|
||||
&& @sapi_windows_vt100_support($this->stream))
|
||||
|| false !== getenv('ANSICON')
|
||||
|
|
|
@ -46,7 +46,7 @@ class SymfonyStyle extends OutputStyle
|
|||
$this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
|
||||
// Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not.
|
||||
$width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH;
|
||||
$this->lineLength = min($width - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
|
||||
$this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
|
||||
|
||||
parent::__construct($output);
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ class SymfonyStyle extends OutputStyle
|
|||
{
|
||||
$progressBar = parent::createProgressBar($max);
|
||||
|
||||
if ('\\' !== DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
|
||||
$progressBar->setEmptyBarCharacter('░'); // light shade character \u2591
|
||||
$progressBar->setProgressCharacter('');
|
||||
$progressBar->setBarCharacter('▓'); // dark shade character \u2593
|
||||
|
|
|
@ -56,7 +56,7 @@ class Terminal
|
|||
|
||||
private static function initDimensions()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) {
|
||||
// extract [w, H] from "wxh (WxH)"
|
||||
// or [w, h] from "wxh"
|
||||
|
|
|
@ -221,7 +221,7 @@ class QuestionHelperTest extends AbstractQuestionHelperTest
|
|||
|
||||
public function testAskHiddenResponse()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is not supported on Windows');
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class Debug
|
|||
error_reporting(E_ALL);
|
||||
}
|
||||
|
||||
if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
|
||||
if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
|
||||
ini_set('display_errors', 0);
|
||||
ExceptionHandler::register();
|
||||
} elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) {
|
||||
|
|
|
@ -42,8 +42,8 @@ class DebugClassLoader
|
|||
$this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
|
||||
|
||||
if (!isset(self::$caseCheck)) {
|
||||
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR);
|
||||
$i = strrpos($file, DIRECTORY_SEPARATOR);
|
||||
$file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
|
||||
$i = strrpos($file, \DIRECTORY_SEPARATOR);
|
||||
$dir = substr($file, 0, 1 + $i);
|
||||
$file = substr($file, 1 + $i);
|
||||
$test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
|
||||
|
@ -289,7 +289,7 @@ class DebugClassLoader
|
|||
}
|
||||
if (self::$caseCheck) {
|
||||
$real = explode('\\', $class.strrchr($file, '.'));
|
||||
$tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file));
|
||||
$tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
|
||||
|
||||
$i = \count($tail) - 1;
|
||||
$j = \count($real) - 1;
|
||||
|
@ -302,7 +302,7 @@ class DebugClassLoader
|
|||
array_splice($tail, 0, $i + 1);
|
||||
}
|
||||
if (self::$caseCheck && $tail) {
|
||||
$tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail);
|
||||
$tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
|
||||
$tailLen = \strlen($tail);
|
||||
$real = $refl->getFileName();
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
|
|||
{
|
||||
$candidates = array(
|
||||
// namespaced class
|
||||
$namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
|
||||
$namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
|
||||
// namespaced class (with target dir)
|
||||
$prefix.$namespacedClass,
|
||||
// namespaced class (with target dir and separator)
|
||||
|
|
|
@ -1588,7 +1588,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
|
|||
$path = realpath($path) ?: $path;
|
||||
|
||||
foreach ($this->vendors as $vendor) {
|
||||
if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, \strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) {
|
||||
if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -171,7 +171,7 @@ class PhpDumper extends Dumper
|
|||
// but every other sub-dir is optional up to the full path in $dir
|
||||
// Mandate at least 2 root dirs and not more that 5 optional dirs.
|
||||
|
||||
$dir = explode(DIRECTORY_SEPARATOR, realpath($dir));
|
||||
$dir = explode(\DIRECTORY_SEPARATOR, realpath($dir));
|
||||
$i = \count($dir);
|
||||
|
||||
if (3 <= $i) {
|
||||
|
@ -180,11 +180,11 @@ class PhpDumper extends Dumper
|
|||
$this->targetDirMaxMatches = $i - $lastOptionalDir;
|
||||
|
||||
while (--$i >= $lastOptionalDir) {
|
||||
$regex = sprintf('(%s%s)?', preg_quote(DIRECTORY_SEPARATOR.$dir[$i], '#'), $regex);
|
||||
$regex = sprintf('(%s%s)?', preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#'), $regex);
|
||||
}
|
||||
|
||||
do {
|
||||
$regex = preg_quote(DIRECTORY_SEPARATOR.$dir[$i], '#').$regex;
|
||||
$regex = preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#').$regex;
|
||||
} while (0 < --$i);
|
||||
|
||||
$this->targetDirRegex = '#'.preg_quote($dir[0], '#').$regex.'#';
|
||||
|
|
|
@ -623,7 +623,7 @@ class XmlFileLoader extends FileLoader
|
|||
$locationstart = 'phar:///';
|
||||
}
|
||||
}
|
||||
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||
|
||||
$imports .= sprintf(' <xsd:import namespace="%s" schemaLocation="%s" />'."\n", $namespace, $location);
|
||||
|
|
|
@ -192,7 +192,7 @@ class PhpDumperTest extends TestCase
|
|||
$container = include self::$fixturesPath.'/containers/container9.php';
|
||||
$container->compile();
|
||||
$dumper = new PhpDumper($container);
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services');
|
||||
|
||||
$container = new ContainerBuilder();
|
||||
$container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(true);
|
||||
|
@ -223,7 +223,7 @@ class PhpDumperTest extends TestCase
|
|||
$container->compile();
|
||||
$dumper = new PhpDumper($container);
|
||||
$dump = print_r($dumper->dump(array('as_files' => true, 'file' => __DIR__, 'hot_path_tag' => 'hot')), true);
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$dump = str_replace('\\\\Fixtures\\\\includes\\\\foo.php', '/Fixtures/includes/foo.php', $dump);
|
||||
}
|
||||
$this->assertStringMatchesFormatFile(self::$fixturesPath.'/php/services9_as_files.txt', $dump);
|
||||
|
@ -914,7 +914,7 @@ class PhpDumperTest extends TestCase
|
|||
$dumper = new PhpDumper($container);
|
||||
|
||||
$dump = $dumper->dump(array('hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'inline_requires', 'file' => self::$fixturesPath.'/php/services_inline_requires.php'));
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$dump = str_replace("'\\\\includes\\\\HotPath\\\\", "'/includes/HotPath/", $dump);
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ class PhpDumperTest extends TestCase
|
|||
$container->compile();
|
||||
$dumper = new PhpDumper($container);
|
||||
$dump = $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Errored_Definition'));
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_errored_definition.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dump));
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_errored_definition.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dump));
|
||||
eval('?>'.$dump);
|
||||
|
||||
$container = new \Symfony_DI_PhpDumper_Errored_Definition();
|
||||
|
@ -1047,7 +1047,7 @@ class PhpDumperTest extends TestCase
|
|||
$container->compile();
|
||||
$dumper = new PhpDumper($container);
|
||||
$dump = $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Service_Locator_Argument'));
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_service_locator_argument.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dump));
|
||||
$this->assertStringEqualsFile(self::$fixturesPath.'/php/services_service_locator_argument.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dump));
|
||||
eval('?>'.$dump);
|
||||
|
||||
$container = new \Symfony_DI_PhpDumper_Service_Locator_Argument();
|
||||
|
|
|
@ -54,7 +54,7 @@ class XmlDumperTest extends TestCase
|
|||
$container = include self::$fixturesPath.'/containers/container9.php';
|
||||
$dumper = new XmlDumper($container);
|
||||
|
||||
$this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/xml/services9.xml')), $dumper->dump(), '->dump() dumps services');
|
||||
$this->assertEquals(str_replace('%path%', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/xml/services9.xml')), $dumper->dump(), '->dump() dumps services');
|
||||
|
||||
$dumper = new XmlDumper($container = new ContainerBuilder());
|
||||
$container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(true);
|
||||
|
|
|
@ -49,7 +49,7 @@ class YamlDumperTest extends TestCase
|
|||
{
|
||||
$container = include self::$fixturesPath.'/containers/container9.php';
|
||||
$dumper = new YamlDumper($container);
|
||||
$this->assertEqualYamlStructure(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services');
|
||||
$this->assertEqualYamlStructure(str_replace('%path%', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services');
|
||||
|
||||
$dumper = new YamlDumper($container = new ContainerBuilder());
|
||||
$container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(true);
|
||||
|
|
|
@ -47,7 +47,7 @@ class PhpFileLoaderTest extends TestCase
|
|||
|
||||
$container->compile();
|
||||
$dumper = new PhpDumper($container);
|
||||
$this->assertStringEqualsFile($fixtures.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', $fixtures.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()));
|
||||
$this->assertStringEqualsFile($fixtures.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', $fixtures.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dumper->dump()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -609,8 +609,8 @@ class XmlFileLoaderTest extends TestCase
|
|||
|
||||
$resources = $container->getResources();
|
||||
|
||||
$fixturesDir = \dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
|
||||
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources));
|
||||
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
|
||||
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources));
|
||||
$this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '/*', true), $resources));
|
||||
$resources = array_map('strval', $resources);
|
||||
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
|
||||
|
@ -629,8 +629,8 @@ class XmlFileLoaderTest extends TestCase
|
|||
|
||||
$resources = $container->getResources();
|
||||
|
||||
$fixturesDir = \dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
|
||||
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.DIRECTORY_SEPARATOR.'services_prototype_array.xml'), $resources));
|
||||
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
|
||||
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype_array.xml'), $resources));
|
||||
$this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '/*', true), $resources));
|
||||
$resources = array_map('strval', $resources);
|
||||
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
|
||||
|
|
|
@ -363,8 +363,8 @@ class YamlFileLoaderTest extends TestCase
|
|||
|
||||
$resources = $container->getResources();
|
||||
|
||||
$fixturesDir = \dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR;
|
||||
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'yaml'.DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources));
|
||||
$fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR;
|
||||
$this->assertTrue(false !== array_search(new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources));
|
||||
$this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '', true), $resources));
|
||||
$resources = array_map('strval', $resources);
|
||||
$this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources);
|
||||
|
|
|
@ -322,7 +322,7 @@ final class Dotenv
|
|||
return substr($matches[0], 1);
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
throw new \LogicException('Resolving commands is not supported on Windows.');
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class DotenvTest extends TestCase
|
|||
array('FOO=${FOO', "Unclosed braces on variable expansion in \".env\" at line 1.\n...FOO=\${FOO...\n ^ line 1 offset 9"),
|
||||
);
|
||||
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$tests[] = array('FOO=$((1dd2))', "Issue expanding a command (%s\n) in \".env\" at line 1.\n...FOO=$((1dd2))...\n ^ line 1 offset 13");
|
||||
}
|
||||
|
||||
|
@ -139,7 +139,7 @@ class DotenvTest extends TestCase
|
|||
array('FOO=$NOTDEFINED', array('FOO' => '')),
|
||||
);
|
||||
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$tests = array_merge($tests, array(
|
||||
// command expansion
|
||||
array('FOO=$(echo foo)', array('FOO' => 'foo')),
|
||||
|
|
|
@ -171,7 +171,7 @@ class Filesystem
|
|||
foreach ($files as $file) {
|
||||
if (is_link($file)) {
|
||||
// See https://bugs.php.net/52176
|
||||
if (!(self::box('unlink', $file) || '\\' !== DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
|
||||
if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
|
||||
throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
|
||||
}
|
||||
} elseif (is_dir($file)) {
|
||||
|
@ -322,7 +322,7 @@ class Filesystem
|
|||
*/
|
||||
public function symlink($originDir, $targetDir, $copyOnWindows = false)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$originDir = strtr($originDir, '/', '\\');
|
||||
$targetDir = strtr($targetDir, '/', '\\');
|
||||
|
||||
|
@ -388,7 +388,7 @@ class Filesystem
|
|||
private function linkException($origin, $target, $linkType)
|
||||
{
|
||||
if (self::$lastError) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
|
||||
throw new IOException(sprintf('Unable to create %s link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target);
|
||||
}
|
||||
}
|
||||
|
@ -422,14 +422,14 @@ class Filesystem
|
|||
return;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$path = readlink($path);
|
||||
}
|
||||
|
||||
return realpath($path);
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return realpath($path);
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ class Filesystem
|
|||
}
|
||||
|
||||
// Normalize separators on Windows
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$endPath = str_replace('\\', '/', $endPath);
|
||||
$startPath = str_replace('\\', '/', $startPath);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
public function testCopyCreatesNewFile()
|
||||
{
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
|
||||
|
@ -34,8 +34,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
public function testCopyFails()
|
||||
{
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
$this->filesystem->copy($sourceFilePath, $targetFilePath);
|
||||
}
|
||||
|
@ -46,12 +46,12 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testCopyUnreadableFileFails()
|
||||
{
|
||||
// skip test on Windows; PHP can't easily set file as unreadable on Windows
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
|
||||
|
@ -63,8 +63,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testCopyOverridesExistingFileIfModified()
|
||||
{
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
|
@ -78,8 +78,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testCopyDoesNotOverrideExistingFileByDefault()
|
||||
{
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
|
@ -97,8 +97,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testCopyOverridesExistingFileIfForced()
|
||||
{
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
|
@ -120,12 +120,12 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testCopyWithOverrideWithReadOnlyTargetFails()
|
||||
{
|
||||
// skip test on Windows; PHP can't easily set file as unwritable on Windows
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test cannot run on Windows.');
|
||||
}
|
||||
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
|
@ -143,9 +143,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
|
||||
{
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFileDirectory = $this->workspace.DIRECTORY_SEPARATOR.'directory';
|
||||
$targetFilePath = $targetFileDirectory.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFileDirectory = $this->workspace.\DIRECTORY_SEPARATOR.'directory';
|
||||
$targetFilePath = $targetFileDirectory.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
|
||||
|
@ -162,7 +162,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
|
||||
{
|
||||
$sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($targetFilePath, 'TARGET FILE');
|
||||
|
||||
|
@ -175,8 +175,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testMkdirCreatesDirectoriesRecursively()
|
||||
{
|
||||
$directory = $this->workspace
|
||||
.DIRECTORY_SEPARATOR.'directory'
|
||||
.DIRECTORY_SEPARATOR.'sub_directory';
|
||||
.\DIRECTORY_SEPARATOR.'directory'
|
||||
.\DIRECTORY_SEPARATOR.'sub_directory';
|
||||
|
||||
$this->filesystem->mkdir($directory);
|
||||
|
||||
|
@ -185,7 +185,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testMkdirCreatesDirectoriesFromArray()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
$directories = array(
|
||||
$basePath.'1', $basePath.'2', $basePath.'3',
|
||||
);
|
||||
|
@ -199,7 +199,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testMkdirCreatesDirectoriesFromTraversableObject()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
$directories = new \ArrayObject(array(
|
||||
$basePath.'1', $basePath.'2', $basePath.'3',
|
||||
));
|
||||
|
@ -216,7 +216,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
public function testMkdirCreatesDirectoriesFails()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
$dir = $basePath.'2';
|
||||
|
||||
file_put_contents($dir, '');
|
||||
|
@ -226,7 +226,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testTouchCreatesEmptyFile()
|
||||
{
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'1';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'1';
|
||||
|
||||
$this->filesystem->touch($file);
|
||||
|
||||
|
@ -238,14 +238,14 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
public function testTouchFails()
|
||||
{
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'1'.DIRECTORY_SEPARATOR.'2';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'1'.\DIRECTORY_SEPARATOR.'2';
|
||||
|
||||
$this->filesystem->touch($file);
|
||||
}
|
||||
|
||||
public function testTouchCreatesEmptyFilesFromArray()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
$files = array(
|
||||
$basePath.'1', $basePath.'2', $basePath.'3',
|
||||
);
|
||||
|
@ -259,7 +259,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testTouchCreatesEmptyFilesFromTraversableObject()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
$files = new \ArrayObject(array(
|
||||
$basePath.'1', $basePath.'2', $basePath.'3',
|
||||
));
|
||||
|
@ -273,7 +273,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testRemoveCleansFilesAndDirectoriesIteratively()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath);
|
||||
mkdir($basePath.'dir');
|
||||
|
@ -286,7 +286,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testRemoveCleansArrayOfFilesAndDirectories()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath.'dir');
|
||||
touch($basePath.'file');
|
||||
|
@ -303,7 +303,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testRemoveCleansTraversableObjectOfFilesAndDirectories()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath.'dir');
|
||||
touch($basePath.'file');
|
||||
|
@ -320,7 +320,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testRemoveIgnoresNonExistingFiles()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath.'dir');
|
||||
|
||||
|
@ -337,7 +337,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath);
|
||||
mkdir($basePath.'dir');
|
||||
|
@ -350,7 +350,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
// create symlink to nonexistent dir
|
||||
rmdir($basePath.'dir');
|
||||
$this->assertFalse('\\' === DIRECTORY_SEPARATOR ? @readlink($basePath.'dir-link') : is_dir($basePath.'dir-link'));
|
||||
$this->assertFalse('\\' === \DIRECTORY_SEPARATOR ? @readlink($basePath.'dir-link') : is_dir($basePath.'dir-link'));
|
||||
|
||||
$this->filesystem->remove($basePath);
|
||||
|
||||
|
@ -359,7 +359,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testFilesExists()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath);
|
||||
touch($basePath.'file1');
|
||||
|
@ -374,7 +374,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
public function testFilesExistsFails()
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Long file names are an issue on Windows');
|
||||
}
|
||||
$basePath = $this->workspace.'\\directory\\';
|
||||
|
@ -393,7 +393,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testFilesExistsTraversableObjectOfFilesAndDirectories()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath.'dir');
|
||||
touch($basePath.'file');
|
||||
|
@ -407,7 +407,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testFilesNotExistsTraversableObjectOfFilesAndDirectories()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($basePath.'dir');
|
||||
touch($basePath.'file');
|
||||
|
@ -424,7 +424,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testInvalidFileNotExists()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR;
|
||||
$basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->assertFalse($this->filesystem->exists($basePath.time()));
|
||||
}
|
||||
|
@ -433,9 +433,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
$file = $dir.DIRECTORY_SEPARATOR.'file';
|
||||
$file = $dir.\DIRECTORY_SEPARATOR.'file';
|
||||
touch($file);
|
||||
|
||||
$this->filesystem->chmod($file, 0400);
|
||||
|
@ -449,7 +449,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
touch($dir);
|
||||
|
||||
$permissions = fileperms($dir);
|
||||
|
@ -463,9 +463,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
$file = $dir.DIRECTORY_SEPARATOR.'file';
|
||||
$file = $dir.\DIRECTORY_SEPARATOR.'file';
|
||||
touch($file);
|
||||
|
||||
$this->filesystem->chmod($file, 0400, 0000, true);
|
||||
|
@ -479,7 +479,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
touch($file);
|
||||
|
||||
$this->filesystem->chmod($file, 0770, 0022);
|
||||
|
@ -490,8 +490,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$directory = $this->workspace.DIRECTORY_SEPARATOR.'directory';
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$directory = $this->workspace.\DIRECTORY_SEPARATOR.'directory';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$files = array($directory, $file);
|
||||
|
||||
mkdir($directory);
|
||||
|
@ -507,8 +507,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$directory = $this->workspace.DIRECTORY_SEPARATOR.'directory';
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$directory = $this->workspace.\DIRECTORY_SEPARATOR.'directory';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$files = new \ArrayObject(array($directory, $file));
|
||||
|
||||
mkdir($directory);
|
||||
|
@ -524,8 +524,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$directory = $this->workspace.DIRECTORY_SEPARATOR.'directory';
|
||||
$subdirectory = $directory.DIRECTORY_SEPARATOR.'subdirectory';
|
||||
$directory = $this->workspace.\DIRECTORY_SEPARATOR.'directory';
|
||||
$subdirectory = $directory.\DIRECTORY_SEPARATOR.'subdirectory';
|
||||
|
||||
mkdir($directory);
|
||||
mkdir($subdirectory);
|
||||
|
@ -540,7 +540,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
|
||||
$owner = $this->getFileOwner($dir);
|
||||
|
@ -553,9 +553,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
$file = $dir.DIRECTORY_SEPARATOR.'file';
|
||||
$file = $dir.\DIRECTORY_SEPARATOR.'file';
|
||||
touch($file);
|
||||
|
||||
$owner = $this->getFileOwner($dir);
|
||||
|
@ -568,8 +568,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -585,8 +585,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -605,8 +605,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -622,8 +622,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -639,7 +639,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
|
||||
$this->filesystem->chown($dir, 'user'.time().mt_rand(1000, 9999));
|
||||
|
@ -649,7 +649,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
|
||||
$group = $this->getFileGroup($dir);
|
||||
|
@ -662,9 +662,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
$file = $dir.DIRECTORY_SEPARATOR.'file';
|
||||
$file = $dir.\DIRECTORY_SEPARATOR.'file';
|
||||
touch($file);
|
||||
|
||||
$group = $this->getFileGroup($dir);
|
||||
|
@ -677,8 +677,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -694,8 +694,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -714,8 +714,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -731,8 +731,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -748,7 +748,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfPosixIsMissing();
|
||||
|
||||
$dir = $this->workspace.DIRECTORY_SEPARATOR.'dir';
|
||||
$dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir';
|
||||
mkdir($dir);
|
||||
|
||||
$this->filesystem->chgrp($dir, 'user'.time().mt_rand(1000, 9999));
|
||||
|
@ -756,8 +756,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testRename()
|
||||
{
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
|
||||
touch($file);
|
||||
|
||||
$this->filesystem->rename($file, $newPath);
|
||||
|
@ -771,8 +771,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
public function testRenameThrowsExceptionIfTargetAlreadyExists()
|
||||
{
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
|
||||
|
||||
touch($file);
|
||||
touch($newPath);
|
||||
|
@ -782,8 +782,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testRenameOverwritesTheTargetIfItAlreadyExists()
|
||||
{
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
|
||||
|
||||
touch($file);
|
||||
touch($newPath);
|
||||
|
@ -799,20 +799,20 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
public function testRenameThrowsExceptionOnError()
|
||||
{
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
|
||||
$newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true);
|
||||
$newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file';
|
||||
|
||||
$this->filesystem->rename($file, $newPath);
|
||||
}
|
||||
|
||||
public function testSymlink()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support creating "broken" symlinks');
|
||||
}
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
// $file does not exists right now: creating "broken" links is a wanted feature
|
||||
$this->filesystem->symlink($file, $link);
|
||||
|
@ -832,7 +832,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
$this->filesystem->remove($link);
|
||||
|
||||
|
@ -845,8 +845,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
symlink($this->workspace, $link);
|
||||
|
@ -861,8 +861,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
symlink($file, $link);
|
||||
|
@ -877,9 +877,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link1 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'link';
|
||||
$link2 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'subdir'.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link1 = $this->workspace.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'link';
|
||||
$link2 = $this->workspace.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'subdir'.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -896,8 +896,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
$this->filesystem->hardlink($file, $link);
|
||||
|
@ -913,7 +913,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
$this->filesystem->remove($link);
|
||||
|
||||
|
@ -924,9 +924,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$file2 = $this->workspace.DIRECTORY_SEPARATOR.'file2';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$file2 = $this->workspace.\DIRECTORY_SEPARATOR.'file2';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
touch($file2);
|
||||
|
@ -942,8 +942,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
link($file, $link);
|
||||
|
@ -958,9 +958,9 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link1 = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$link2 = $this->workspace.DIRECTORY_SEPARATOR.'link2';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link1 = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
$link2 = $this->workspace.\DIRECTORY_SEPARATOR.'link2';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -976,8 +976,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfLinkIsMissing();
|
||||
|
||||
$file = $this->workspace.DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.DIRECTORY_SEPARATOR.'link';
|
||||
$file = $this->workspace.\DIRECTORY_SEPARATOR.'file';
|
||||
$link = $this->workspace.\DIRECTORY_SEPARATOR.'link';
|
||||
|
||||
touch($file);
|
||||
|
||||
|
@ -992,7 +992,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Relative symbolic links are not supported on Windows');
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support creating "broken" symlinks');
|
||||
}
|
||||
|
||||
|
@ -1130,7 +1130,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
array('C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/'),
|
||||
);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$paths[] = array('c:\var\lib/symfony/src/Symfony/', 'c:/var/lib/symfony/', 'src/Symfony/');
|
||||
}
|
||||
|
||||
|
@ -1157,8 +1157,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testMirrorCopiesFilesAndDirectoriesRecursively()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$directory = $sourcePath.'directory'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
$directory = $sourcePath.'directory'.\DIRECTORY_SEPARATOR;
|
||||
$file1 = $directory.'file1';
|
||||
$file2 = $sourcePath.'file2';
|
||||
|
||||
|
@ -1167,41 +1167,41 @@ class FilesystemTest extends FilesystemTestCase
|
|||
file_put_contents($file1, 'FILE1');
|
||||
file_put_contents($file2, 'FILE2');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||
|
||||
$this->assertTrue(is_dir($targetPath));
|
||||
$this->assertTrue(is_dir($targetPath.'directory'));
|
||||
$this->assertFileEquals($file1, $targetPath.'directory'.DIRECTORY_SEPARATOR.'file1');
|
||||
$this->assertFileEquals($file1, $targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1');
|
||||
$this->assertFileEquals($file2, $targetPath.'file2');
|
||||
|
||||
$this->filesystem->remove($file1);
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => false));
|
||||
$this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
|
||||
$this->assertTrue($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1'));
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true));
|
||||
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
|
||||
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1'));
|
||||
|
||||
file_put_contents($file1, 'FILE1');
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true));
|
||||
$this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
|
||||
$this->assertTrue($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1'));
|
||||
|
||||
$this->filesystem->remove($directory);
|
||||
$this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true));
|
||||
$this->assertFalse($this->filesystem->exists($targetPath.'directory'));
|
||||
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'));
|
||||
$this->assertFalse($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1'));
|
||||
}
|
||||
|
||||
public function testMirrorCreatesEmptyDirectory()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($sourcePath);
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||
|
||||
|
@ -1214,46 +1214,46 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($sourcePath);
|
||||
file_put_contents($sourcePath.'file1', 'FILE1');
|
||||
symlink($sourcePath.'file1', $sourcePath.'link1');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||
|
||||
$this->assertTrue(is_dir($targetPath));
|
||||
$this->assertFileEquals($sourcePath.'file1', $targetPath.'link1');
|
||||
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
|
||||
}
|
||||
|
||||
public function testMirrorCopiesLinkedDirectoryContents()
|
||||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing(true);
|
||||
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($sourcePath.'nested/', 0777, true);
|
||||
file_put_contents($sourcePath.'/nested/file1.txt', 'FILE1');
|
||||
// Note: We symlink directory, not file
|
||||
symlink($sourcePath.'nested', $sourcePath.'link1');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||
|
||||
$this->assertTrue(is_dir($targetPath));
|
||||
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
|
||||
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
|
||||
}
|
||||
|
||||
public function testMirrorCopiesRelativeLinkedContents()
|
||||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing(true);
|
||||
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
$oldPath = getcwd();
|
||||
|
||||
mkdir($sourcePath.'nested/', 0777, true);
|
||||
|
@ -1264,25 +1264,25 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
chdir($oldPath);
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$this->filesystem->mirror($sourcePath, $targetPath);
|
||||
|
||||
$this->assertTrue(is_dir($targetPath));
|
||||
$this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt');
|
||||
$this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||
$this->assertEquals('\\' === DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1'));
|
||||
$this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1'));
|
||||
$this->assertEquals('\\' === \DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.\DIRECTORY_SEPARATOR.'link1'));
|
||||
}
|
||||
|
||||
public function testMirrorContentsWithSameNameAsSourceOrTargetWithoutDeleteOption()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($sourcePath);
|
||||
touch($sourcePath.'source');
|
||||
touch($sourcePath.'target');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
$oldPath = getcwd();
|
||||
chdir($this->workspace);
|
||||
|
@ -1298,12 +1298,12 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption()
|
||||
{
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($sourcePath);
|
||||
touch($sourcePath.'source');
|
||||
|
||||
$targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR;
|
||||
$targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR;
|
||||
|
||||
mkdir($targetPath);
|
||||
touch($targetPath.'source');
|
||||
|
@ -1436,11 +1436,11 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testTempnamOnUnwritableFallsBackToSysTmp()
|
||||
{
|
||||
$scheme = 'file://';
|
||||
$dirname = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'does_not_exist';
|
||||
$dirname = $scheme.$this->workspace.\DIRECTORY_SEPARATOR.'does_not_exist';
|
||||
|
||||
$filename = $this->filesystem->tempnam($dirname, 'bar');
|
||||
$realTempDir = realpath(sys_get_temp_dir());
|
||||
$this->assertStringStartsWith(rtrim($scheme.$realTempDir, DIRECTORY_SEPARATOR), $filename);
|
||||
$this->assertStringStartsWith(rtrim($scheme.$realTempDir, \DIRECTORY_SEPARATOR), $filename);
|
||||
$this->assertFileExists($filename);
|
||||
|
||||
// Tear down
|
||||
|
@ -1449,10 +1449,10 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testDumpFile()
|
||||
{
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
|
||||
|
||||
// skip mode check on Windows
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$oldMask = umask(0002);
|
||||
}
|
||||
|
||||
|
@ -1461,7 +1461,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
$this->assertStringEqualsFile($filename, 'bar');
|
||||
|
||||
// skip mode check on Windows
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(664, $filename);
|
||||
umask($oldMask);
|
||||
}
|
||||
|
@ -1469,7 +1469,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testDumpFileOverwritesAnExistingFile()
|
||||
{
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo.txt';
|
||||
file_put_contents($filename, 'FOO BAR');
|
||||
|
||||
$this->filesystem->dumpFile($filename, 'bar');
|
||||
|
@ -1481,7 +1481,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testDumpFileWithFileScheme()
|
||||
{
|
||||
$scheme = 'file://';
|
||||
$filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$filename = $scheme.$this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
|
||||
|
||||
$this->filesystem->dumpFile($filename, 'bar');
|
||||
|
||||
|
@ -1492,7 +1492,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testDumpFileWithZlibScheme()
|
||||
{
|
||||
$scheme = 'compress.zlib://';
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
|
||||
|
||||
$this->filesystem->dumpFile($filename, 'bar');
|
||||
|
||||
|
@ -1503,10 +1503,10 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testAppendToFile()
|
||||
{
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'bar.txt';
|
||||
|
||||
// skip mode check on Windows
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$oldMask = umask(0002);
|
||||
}
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
$this->assertStringEqualsFile($filename, 'foobar');
|
||||
|
||||
// skip mode check on Windows
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(664, $filename);
|
||||
umask($oldMask);
|
||||
}
|
||||
|
@ -1527,7 +1527,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testAppendToFileWithScheme()
|
||||
{
|
||||
$scheme = 'file://';
|
||||
$filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$filename = $scheme.$this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$this->filesystem->dumpFile($filename, 'foo');
|
||||
|
||||
$this->filesystem->appendToFile($filename, 'bar');
|
||||
|
@ -1539,7 +1539,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
public function testAppendToFileWithZlibScheme()
|
||||
{
|
||||
$scheme = 'compress.zlib://';
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt';
|
||||
$this->filesystem->dumpFile($filename, 'foo');
|
||||
|
||||
// Zlib stat uses file:// wrapper so remove it
|
||||
|
@ -1553,17 +1553,17 @@ class FilesystemTest extends FilesystemTestCase
|
|||
|
||||
public function testAppendToFileCreateTheFileIfNotExists()
|
||||
{
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'bar.txt';
|
||||
|
||||
// skip mode check on Windows
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$oldMask = umask(0002);
|
||||
}
|
||||
|
||||
$this->filesystem->appendToFile($filename, 'bar');
|
||||
|
||||
// skip mode check on Windows
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->assertFilePermissions(664, $filename);
|
||||
umask($oldMask);
|
||||
}
|
||||
|
@ -1576,7 +1576,7 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$filename = $this->workspace.DIRECTORY_SEPARATOR.'foo.txt';
|
||||
$filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo.txt';
|
||||
file_put_contents($filename, 'FOO BAR');
|
||||
chmod($filename, 0745);
|
||||
|
||||
|
@ -1589,8 +1589,8 @@ class FilesystemTest extends FilesystemTestCase
|
|||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
chmod($sourceFilePath, 0745);
|
||||
|
@ -1605,6 +1605,6 @@ class FilesystemTest extends FilesystemTestCase
|
|||
*/
|
||||
private function normalize(string $path): string
|
||||
{
|
||||
return str_replace('/', DIRECTORY_SEPARATOR, $path);
|
||||
return str_replace('/', \DIRECTORY_SEPARATOR, $path);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ class FilesystemTestCase extends TestCase
|
|||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
self::$linkOnWindows = true;
|
||||
$originFile = tempnam(sys_get_temp_dir(), 'li');
|
||||
$targetFile = tempnam(sys_get_temp_dir(), 'li');
|
||||
|
@ -133,26 +133,26 @@ class FilesystemTestCase extends TestCase
|
|||
$this->markTestSkipped('link is not supported');
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR && false === self::$linkOnWindows) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && false === self::$linkOnWindows) {
|
||||
$this->markTestSkipped('link requires "Create hard links" privilege on windows');
|
||||
}
|
||||
}
|
||||
|
||||
protected function markAsSkippedIfSymlinkIsMissing($relative = false)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) {
|
||||
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
|
||||
}
|
||||
|
||||
// https://bugs.php.net/bug.php?id=69473
|
||||
if ($relative && '\\' === DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
|
||||
if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
|
||||
$this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions');
|
||||
}
|
||||
}
|
||||
|
||||
protected function markAsSkippedIfChmodIsMissing()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
|
|||
{
|
||||
$filename = $this->current()->getRelativePathname();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$filename = str_replace('\\', '/', $filename);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,8 +48,8 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
|||
parent::__construct($path, $flags);
|
||||
$this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
|
||||
$this->rootPath = $path;
|
||||
if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
|
||||
$this->directorySeparator = DIRECTORY_SEPARATOR;
|
||||
if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
|
||||
$this->directorySeparator = \DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/**/*.neon');
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/**/*.neon', false);
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/Fixtures/one/**');
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ class GlobTest extends TestCase
|
|||
$regex = Glob::toRegex('/Fixtures/one/**', false);
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(DIRECTORY_SEPARATOR, '/', $k);
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
|
|
|
@ -19,9 +19,9 @@ abstract class IteratorTestCase extends TestCase
|
|||
{
|
||||
// set iterator_to_array $use_key to false to avoid values merge
|
||||
// this made FinderTest::testAppendWithAnArray() fail with GnuFinderAdapter
|
||||
$values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false));
|
||||
$values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', \DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false));
|
||||
|
||||
$expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected);
|
||||
$expected = array_map(function ($path) { return str_replace('/', \DIRECTORY_SEPARATOR, $path); }, $expected);
|
||||
|
||||
sort($values);
|
||||
sort($expected);
|
||||
|
|
|
@ -31,37 +31,37 @@ class PathFilterIteratorTest extends IteratorTestCase
|
|||
//PATH: A/B/C/abc.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'abc.dat',
|
||||
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
));
|
||||
|
||||
//PATH: A/B/ab.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'ab.dat',
|
||||
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
));
|
||||
|
||||
//PATH: A/a.dat
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'a.dat',
|
||||
'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat',
|
||||
'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
));
|
||||
|
||||
//PATH: copy/A/B/C/abc.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'abc.dat.copy',
|
||||
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
));
|
||||
|
||||
//PATH: copy/A/B/ab.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'ab.dat.copy',
|
||||
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
));
|
||||
|
||||
//PATH: copy/A/a.dat.copy
|
||||
$inner[] = new MockSplFileInfo(array(
|
||||
'name' => 'a.dat.copy',
|
||||
'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat',
|
||||
'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'a.dat',
|
||||
));
|
||||
|
||||
return array(
|
||||
|
|
|
@ -18,7 +18,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
|
||||
self::$files = array(
|
||||
'.git/',
|
||||
|
@ -53,7 +53,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
}
|
||||
|
||||
foreach (self::$files as $file) {
|
||||
if (DIRECTORY_SEPARATOR === $file[\strlen($file) - 1]) {
|
||||
if (\DIRECTORY_SEPARATOR === $file[\strlen($file) - 1]) {
|
||||
mkdir($file);
|
||||
} else {
|
||||
touch($file);
|
||||
|
@ -93,7 +93,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
* Without the call to setUpBeforeClass() property can be null.
|
||||
*/
|
||||
if (!self::$tmpDir) {
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder';
|
||||
}
|
||||
|
||||
if (\is_array($files)) {
|
||||
|
@ -102,7 +102,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
if (\is_array($file)) {
|
||||
$f[] = self::toAbsolute($file);
|
||||
} else {
|
||||
$f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file);
|
||||
$f[] = self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $file);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
}
|
||||
|
||||
if (\is_string($files)) {
|
||||
return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files);
|
||||
return self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $files);
|
||||
}
|
||||
|
||||
return self::$tmpDir;
|
||||
|
@ -120,7 +120,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
|||
{
|
||||
$f = array();
|
||||
foreach ($files as $file) {
|
||||
$f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file);
|
||||
$f[] = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.$file);
|
||||
}
|
||||
|
||||
return $f;
|
||||
|
|
|
@ -43,8 +43,8 @@ class RecursiveDirectoryIteratorTest extends IteratorTestCase
|
|||
}
|
||||
|
||||
$contains = array(
|
||||
'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'1000GB.zip',
|
||||
'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'100GB.zip',
|
||||
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip',
|
||||
'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip',
|
||||
);
|
||||
$actual = array();
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
|||
if (!\is_callable($mode)) {
|
||||
switch ($mode) {
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
touch(self::toAbsolute('.git'));
|
||||
} else {
|
||||
file_get_contents(self::toAbsolute('.git'));
|
||||
|
@ -62,7 +62,7 @@ class SortableIteratorTest extends RealIteratorTestCase
|
|||
|| SortableIterator::SORT_BY_CHANGED_TIME === $mode
|
||||
|| SortableIterator::SORT_BY_MODIFIED_TIME === $mode
|
||||
) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) {
|
||||
$this->markTestSkipped('Sorting by atime or ctime is not supported on Windows');
|
||||
}
|
||||
$this->assertOrderedIteratorForGroups($expected, $iterator);
|
||||
|
|
|
@ -115,7 +115,7 @@ class File extends \SplFileInfo
|
|||
throw new FileException(sprintf('Unable to write in the "%s" directory', $directory));
|
||||
}
|
||||
|
||||
$target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
|
||||
$target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name));
|
||||
|
||||
return new self($target, false);
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface
|
|||
return $supported;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR || !\function_exists('passthru') || !\function_exists('escapeshellarg')) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR || !\function_exists('passthru') || !\function_exists('escapeshellarg')) {
|
||||
return $supported = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1785,9 +1785,9 @@ class Request
|
|||
return $prefix;
|
||||
}
|
||||
|
||||
if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(\dirname($baseUrl), '/'.DIRECTORY_SEPARATOR).'/')) {
|
||||
if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(\dirname($baseUrl), '/'.\DIRECTORY_SEPARATOR).'/')) {
|
||||
// directory portion of $baseUrl matches
|
||||
return rtrim($prefix, '/'.DIRECTORY_SEPARATOR);
|
||||
return rtrim($prefix, '/'.\DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
$truncatedRequestUri = $requestUri;
|
||||
|
@ -1808,7 +1808,7 @@ class Request
|
|||
$baseUrl = substr($requestUri, 0, $pos + \strlen($baseUrl));
|
||||
}
|
||||
|
||||
return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR);
|
||||
return rtrim($baseUrl, '/'.\DIRECTORY_SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1830,7 +1830,7 @@ class Request
|
|||
$basePath = $baseUrl;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$basePath = str_replace('\\', '/', $basePath);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ class Response
|
|||
|
||||
if (\function_exists('fastcgi_finish_request')) {
|
||||
fastcgi_finish_request();
|
||||
} elseif (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) {
|
||||
} elseif (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
|
||||
static::closeOutputBuffers(0, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ class MimeTypeTest extends TestCase
|
|||
|
||||
public function testGuessWithNonReadablePath()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can not verify chmod operations on Windows');
|
||||
}
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
|
|||
'apcu_enabled' => \extension_loaded('apcu') && ini_get('apc.enabled'),
|
||||
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
|
||||
'bundles' => array(),
|
||||
'sapi_name' => PHP_SAPI,
|
||||
'sapi_name' => \PHP_SAPI,
|
||||
);
|
||||
|
||||
if (isset($this->kernel)) {
|
||||
|
|
|
@ -204,7 +204,7 @@ class DumpDataCollector extends DataCollector implements DataDumperInterface
|
|||
--$i;
|
||||
}
|
||||
|
||||
if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) {
|
||||
if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) {
|
||||
$dumper = new HtmlDumper('php://output', $this->charset);
|
||||
$dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat));
|
||||
} else {
|
||||
|
|
|
@ -97,7 +97,7 @@ class FileLinkFormatter implements \Serializable
|
|||
|
||||
return array(
|
||||
$request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat,
|
||||
$this->baseDir.DIRECTORY_SEPARATOR, '',
|
||||
$this->baseDir.\DIRECTORY_SEPARATOR, '',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
|||
{
|
||||
$events = array(KernelEvents::REQUEST => array('configure', 2048));
|
||||
|
||||
if ('cli' === PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
|
||||
if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) {
|
||||
$events[ConsoleEvents::COMMAND] = array('configure', 2048);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ class RouterListener implements EventSubscriberInterface
|
|||
private function createWelcomeResponse()
|
||||
{
|
||||
$version = Kernel::VERSION;
|
||||
$baseDir = realpath($this->projectDir).DIRECTORY_SEPARATOR;
|
||||
$baseDir = realpath($this->projectDir).\DIRECTORY_SEPARATOR;
|
||||
$docVersion = substr(Kernel::VERSION, 0, 3);
|
||||
|
||||
ob_start();
|
||||
|
|
|
@ -410,7 +410,7 @@ class Store implements StoreInterface
|
|||
|
||||
public function getPath($key)
|
||||
{
|
||||
return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
return $this->root.\DIRECTORY_SEPARATOR.substr($key, 0, 2).\DIRECTORY_SEPARATOR.substr($key, 2, 2).\DIRECTORY_SEPARATOR.substr($key, 4, 2).\DIRECTORY_SEPARATOR.substr($key, 6);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -549,7 +549,7 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl
|
|||
static $legacyContainers = array();
|
||||
$oldContainerDir = \dirname($oldContainer->getFileName());
|
||||
$legacyContainers[$oldContainerDir.'.legacy'] = true;
|
||||
foreach (glob(\dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
|
||||
foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) {
|
||||
if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) {
|
||||
(new Filesystem())->remove(substr($legacyContainer, 0, -7));
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class FileLinkFormatterTest extends TestCase
|
|||
|
||||
public function testWhenFileLinkFormatAndNoRequest()
|
||||
{
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.'file.php';
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
|
||||
$sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', new RequestStack());
|
||||
|
||||
|
@ -36,7 +36,7 @@ class FileLinkFormatterTest extends TestCase
|
|||
|
||||
public function testWhenFileLinkFormatAndRequest()
|
||||
{
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.'file.php';
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
$baseDir = __DIR__;
|
||||
$requestStack = new RequestStack();
|
||||
$request = new Request();
|
||||
|
@ -49,7 +49,7 @@ class FileLinkFormatterTest extends TestCase
|
|||
|
||||
public function testWhenNoFileLinkFormatAndRequest()
|
||||
{
|
||||
$file = __DIR__.DIRECTORY_SEPARATOR.'file.php';
|
||||
$file = __DIR__.\DIRECTORY_SEPARATOR.'file.php';
|
||||
$requestStack = new RequestStack();
|
||||
$request = new Request();
|
||||
$requestStack->push($request);
|
||||
|
|
|
@ -566,7 +566,7 @@ class HttpCacheTest extends HttpCacheTestCase
|
|||
|
||||
public function testDegradationWhenCacheLocked()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Skips on windows to avoid permissions issues.');
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ EOF;
|
|||
|
||||
// Heredocs are preserved, making the output mixing Unix and Windows line
|
||||
// endings, switching to "\n" everywhere on Windows to avoid failure.
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$expected = str_replace("\r\n", "\n", $expected);
|
||||
$output = str_replace("\r\n", "\n", $output);
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ EOF;
|
|||
{
|
||||
$kernel = new KernelForTest('test', true);
|
||||
|
||||
$this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir()));
|
||||
$this->assertEquals(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir()));
|
||||
}
|
||||
|
||||
public function testGetName()
|
||||
|
|
|
@ -34,7 +34,7 @@ class LoggerTest extends TestCase
|
|||
|
||||
protected function setUp()
|
||||
{
|
||||
$this->tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'log';
|
||||
$this->tmpFile = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'log';
|
||||
$this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -71,13 +71,13 @@ class ExecutableFinder
|
|||
}
|
||||
|
||||
$suffixes = array('');
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$pathExt = getenv('PATHEXT');
|
||||
$suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
|
||||
}
|
||||
foreach ($suffixes as $suffix) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || @is_executable($file))) {
|
||||
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class PhpExecutableFinder
|
|||
$args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
|
||||
|
||||
// PHP_BINARY return the current sapi executable
|
||||
if (PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
|
||||
if (PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
|
||||
return PHP_BINARY.$args;
|
||||
}
|
||||
|
||||
|
@ -65,12 +65,12 @@ class PhpExecutableFinder
|
|||
}
|
||||
}
|
||||
|
||||
if (@is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
|
||||
if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
|
||||
return $php;
|
||||
}
|
||||
|
||||
$dirs = array(PHP_BINDIR);
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$dirs[] = 'C:\xampp\php\\';
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ class PhpExecutableFinder
|
|||
public function findArguments()
|
||||
{
|
||||
$arguments = array();
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$arguments[] = '-qrr';
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class PhpProcess extends Process
|
|||
} else {
|
||||
$php = array_merge(array($php), $executableFinder->findArguments());
|
||||
}
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$file = tempnam(sys_get_temp_dir(), 'dbg');
|
||||
file_put_contents($file, $script);
|
||||
register_shutdown_function('unlink', $file);
|
||||
|
|
|
@ -154,7 +154,7 @@ class Process implements \IteratorAggregate
|
|||
// on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected
|
||||
// @see : https://bugs.php.net/bug.php?id=51800
|
||||
// @see : https://bugs.php.net/bug.php?id=50524
|
||||
if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) {
|
||||
if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
|
||||
$this->cwd = getcwd();
|
||||
}
|
||||
if (null !== $env) {
|
||||
|
@ -163,7 +163,7 @@ class Process implements \IteratorAggregate
|
|||
|
||||
$this->setInput($input);
|
||||
$this->setTimeout($timeout);
|
||||
$this->useFileHandles = '\\' === DIRECTORY_SEPARATOR;
|
||||
$this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
|
||||
$this->pty = false;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ class Process implements \IteratorAggregate
|
|||
if (\is_array($commandline = $this->commandline)) {
|
||||
$commandline = implode(' ', array_map(array($this, 'escapeArgument'), $commandline));
|
||||
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
// exec is mandatory to deal with sending a signal to the process
|
||||
$commandline = 'exec '.$commandline;
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ class Process implements \IteratorAggregate
|
|||
|
||||
$options = array('suppress_errors' => true);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$options['bypass_shell'] = true;
|
||||
$commandline = $this->prepareWindowsCommandLine($commandline, $env);
|
||||
} elseif (!$this->useFileHandles && $this->isSigchildEnabled()) {
|
||||
|
@ -414,8 +414,8 @@ class Process implements \IteratorAggregate
|
|||
|
||||
do {
|
||||
$this->checkTimeout();
|
||||
$running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
$running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
|
||||
$this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
} while ($running);
|
||||
|
||||
while ($this->isRunning()) {
|
||||
|
@ -1009,7 +1009,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
public function setTty($tty)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && $tty) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
|
||||
throw new RuntimeException('TTY mode is not supported on Windows platform.');
|
||||
}
|
||||
|
||||
|
@ -1225,7 +1225,7 @@ class Process implements \IteratorAggregate
|
|||
return $result;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return $result = false;
|
||||
}
|
||||
|
||||
|
@ -1240,7 +1240,7 @@ class Process implements \IteratorAggregate
|
|||
if ($this->input instanceof \Iterator) {
|
||||
$this->input->rewind();
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback);
|
||||
} else {
|
||||
$this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback);
|
||||
|
@ -1298,7 +1298,7 @@ class Process implements \IteratorAggregate
|
|||
$this->processInformation = proc_get_status($this->process);
|
||||
$running = $this->processInformation['running'];
|
||||
|
||||
$this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running);
|
||||
$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
|
||||
|
||||
if ($this->fallbackStatus && $this->isSigchildEnabled()) {
|
||||
$this->processInformation = $this->fallbackStatus + $this->processInformation;
|
||||
|
@ -1460,7 +1460,7 @@ class Process implements \IteratorAggregate
|
|||
return false;
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
|
||||
if ($exitCode && $this->isRunning()) {
|
||||
if ($throwException) {
|
||||
|
@ -1569,7 +1569,7 @@ class Process implements \IteratorAggregate
|
|||
*/
|
||||
private function escapeArgument(string $argument): string
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
return "'".str_replace("'", "'\\''", $argument)."'";
|
||||
}
|
||||
if ('' === $argument = (string) $argument) {
|
||||
|
|
|
@ -83,7 +83,7 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
public function testFindWithOpenBaseDir()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ class ExecutableFinderTest extends TestCase
|
|||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Cannot run test on windows');
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ class ExecutableFinderTest extends TestCase
|
|||
if (ini_get('open_basedir')) {
|
||||
$this->markTestSkipped('Cannot test when open_basedir is set');
|
||||
}
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Can be only tested on windows');
|
||||
}
|
||||
|
||||
|
@ -149,7 +149,7 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
private function assertSamePath($expected, $tested)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->assertEquals(strtolower($expected), strtolower($tested));
|
||||
} else {
|
||||
$this->assertEquals($expected, $tested);
|
||||
|
@ -158,6 +158,6 @@ class ExecutableFinderTest extends TestCase
|
|||
|
||||
private function getPhpBinaryName()
|
||||
{
|
||||
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : '');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class PhpExecutableFinderTest extends TestCase
|
|||
$f = new PhpExecutableFinder();
|
||||
|
||||
$current = PHP_BINARY;
|
||||
$args = 'phpdbg' === PHP_SAPI ? ' -qrr' : '';
|
||||
$args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : '';
|
||||
|
||||
$this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP');
|
||||
$this->assertEquals($current, $f->find(false), '::find() returns the executable PHP');
|
||||
|
@ -40,7 +40,7 @@ class PhpExecutableFinderTest extends TestCase
|
|||
{
|
||||
$f = new PhpExecutableFinder();
|
||||
|
||||
if ('phpdbg' === PHP_SAPI) {
|
||||
if ('phpdbg' === \PHP_SAPI) {
|
||||
$this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments');
|
||||
} else {
|
||||
$this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments');
|
||||
|
|
|
@ -43,6 +43,6 @@ PHP
|
|||
$process->wait();
|
||||
$this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait');
|
||||
|
||||
$this->assertSame(PHP_VERSION.PHP_SAPI, $process->getOutput());
|
||||
$this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ProcessTest extends TestCase
|
|||
public static function setUpBeforeClass()
|
||||
{
|
||||
$phpBin = new PhpExecutableFinder();
|
||||
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === PHP_SAPI ? 'php' : $phpBin->find());
|
||||
self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find());
|
||||
|
||||
ob_start();
|
||||
phpinfo(INFO_GENERAL);
|
||||
|
@ -67,7 +67,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testThatProcessDoesNotThrowWarningDuringRun()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is transient on Windows');
|
||||
}
|
||||
@trigger_error('Test Error', E_USER_NOTICE);
|
||||
|
@ -307,7 +307,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function chainedCommandsOutputProvider()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
return array(
|
||||
array("2 \r\n2\r\n", '&&', '2'),
|
||||
);
|
||||
|
@ -426,7 +426,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testZeroAsOutput()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
// see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line
|
||||
$p = $this->getProcess('echo | set /p dummyName=0');
|
||||
} else {
|
||||
|
@ -439,7 +439,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testExitCodeCommandFailed()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX exit code');
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testTTYCommand()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not have /dev/tty support');
|
||||
}
|
||||
|
||||
|
@ -473,7 +473,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testTTYCommandExitCode()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does have /dev/tty support');
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testTTYInWindowsEnvironment()
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
if ('\\' !== \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('This test is for Windows platform only');
|
||||
}
|
||||
|
||||
|
@ -654,7 +654,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessIsNotSignaled()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
|
@ -665,7 +665,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessWithoutTermSignal()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ class ProcessTest extends TestCase
|
|||
|
||||
public function testProcessIsSignaledIfStopped()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Windows does not support POSIX signals');
|
||||
}
|
||||
|
||||
|
@ -997,7 +997,7 @@ class ProcessTest extends TestCase
|
|||
*/
|
||||
public function testWrongSignal()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('POSIX signals do not work on Windows');
|
||||
}
|
||||
|
||||
|
@ -1152,7 +1152,7 @@ class ProcessTest extends TestCase
|
|||
'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';',
|
||||
);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
// Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650
|
||||
$sizes = array(1, 2, 4, 8);
|
||||
} else {
|
||||
|
@ -1430,7 +1430,7 @@ class ProcessTest extends TestCase
|
|||
{
|
||||
$p = new Process(array('/usr/bin/php'));
|
||||
|
||||
$expected = '\\' === DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
|
||||
$expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'";
|
||||
$this->assertSame($expected, $p->getCommandLine());
|
||||
}
|
||||
|
||||
|
@ -1477,7 +1477,7 @@ EOTXT;
|
|||
public function testEnvArgument()
|
||||
{
|
||||
$env = array('FOO' => 'Foo', 'BAR' => 'Bar');
|
||||
$cmd = '\\' === DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
|
||||
$cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ';
|
||||
$p = Process::fromShellCommandline($cmd, null, $env);
|
||||
$p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ'));
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ class PhpGeneratorDumperTest extends TestCase
|
|||
|
||||
$this->routeCollection = new RouteCollection();
|
||||
$this->generatorDumper = new PhpGeneratorDumper($this->routeCollection);
|
||||
$this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php';
|
||||
$this->largeTestTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php';
|
||||
$this->testTmpFilepath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php';
|
||||
$this->largeTestTmpFilepath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php';
|
||||
@unlink($this->testTmpFilepath);
|
||||
@unlink($this->largeTestTmpFilepath);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ class PhpMatcherDumperTest extends TestCase
|
|||
parent::setUp();
|
||||
|
||||
$this->matcherClass = uniqid('ProjectUrlMatcher');
|
||||
$this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
|
||||
$this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php';
|
||||
}
|
||||
|
||||
protected function tearDown()
|
||||
|
|
|
@ -47,9 +47,9 @@ class CacheLoader extends Loader
|
|||
public function load(TemplateReferenceInterface $template)
|
||||
{
|
||||
$key = hash('sha256', $template->getLogicalName());
|
||||
$dir = $this->dir.DIRECTORY_SEPARATOR.substr($key, 0, 2);
|
||||
$dir = $this->dir.\DIRECTORY_SEPARATOR.substr($key, 0, 2);
|
||||
$file = substr($key, 2).'.tpl';
|
||||
$path = $dir.DIRECTORY_SEPARATOR.$file;
|
||||
$path = $dir.\DIRECTORY_SEPARATOR.$file;
|
||||
|
||||
if (is_file($path)) {
|
||||
if (null !== $this->logger) {
|
||||
|
|
|
@ -29,7 +29,7 @@ class CacheLoaderTest extends TestCase
|
|||
|
||||
public function testLoad()
|
||||
{
|
||||
$dir = sys_get_temp_dir().DIRECTORY_SEPARATOR.mt_rand(111111, 999999);
|
||||
$dir = sys_get_temp_dir().\DIRECTORY_SEPARATOR.mt_rand(111111, 999999);
|
||||
mkdir($dir, 0777, true);
|
||||
|
||||
$loader = new ProjectTemplateLoader($varLoader = new ProjectTemplateLoaderVar(), $dir);
|
||||
|
|
|
@ -297,12 +297,12 @@ class TranslatorTest extends TestCase
|
|||
|
||||
$resources = $translator->getCatalogue('en')->getResources();
|
||||
$this->assertCount(1, $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
|
||||
$resources = $translator->getCatalogue('en_GB')->getResources();
|
||||
$this->assertCount(2, $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources);
|
||||
$this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources);
|
||||
$this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -132,7 +132,7 @@ class XliffUtils
|
|||
}
|
||||
}
|
||||
|
||||
$drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : '';
|
||||
$newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts));
|
||||
|
||||
return str_replace($xmlUri, $newPath, $schemaSource);
|
||||
|
|
|
@ -31,7 +31,7 @@ abstract class FileValidatorTest extends ConstraintValidatorTestCase
|
|||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->path = sys_get_temp_dir().DIRECTORY_SEPARATOR.'FileValidatorTest';
|
||||
$this->path = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'FileValidatorTest';
|
||||
$this->file = fopen($this->path, 'w');
|
||||
fwrite($this->file, ' ', 1);
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ class LinkStub extends ConstStub
|
|||
if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) {
|
||||
$this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1;
|
||||
$this->attr['ellipsis-type'] = 'path';
|
||||
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode(\array_slice(explode(DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
|
||||
} elseif (3 < \count($ellipsis = explode(DIRECTORY_SEPARATOR, $href))) {
|
||||
$this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode(\array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0);
|
||||
} elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) {
|
||||
$this->attr['ellipsis'] = 2 + \strlen(implode(\array_slice($ellipsis, -2)));
|
||||
$this->attr['ellipsis-type'] = 'path';
|
||||
$this->attr['ellipsis-tail'] = 1;
|
||||
|
@ -73,7 +73,7 @@ class LinkStub extends ConstStub
|
|||
$r = new \ReflectionClass($class);
|
||||
$v = \dirname(\dirname($r->getFileName()));
|
||||
if (file_exists($v.'/composer/installed.json')) {
|
||||
self::$vendorRoots[] = $v.DIRECTORY_SEPARATOR;
|
||||
self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,6 @@ class LinkStub extends ConstStub
|
|||
$parent = \dirname($parent);
|
||||
}
|
||||
|
||||
return self::$composerRoots[$dir] = $parent.DIRECTORY_SEPARATOR;
|
||||
return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ class CliDumper extends AbstractDumper
|
|||
{
|
||||
parent::__construct($output, $charset, $flags);
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) {
|
||||
// Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI
|
||||
$this->setStyles(array(
|
||||
'default' => '31',
|
||||
|
@ -417,7 +417,7 @@ class CliDumper extends AbstractDumper
|
|||
|
||||
if (isset($attr['ellipsis'], $attr['ellipsis-type'])) {
|
||||
$prefix = substr($value, 0, -$attr['ellipsis']);
|
||||
if ('cli' === PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
|
||||
if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) {
|
||||
$prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd]));
|
||||
}
|
||||
if (!empty($attr['ellipsis-tail'])) {
|
||||
|
@ -545,7 +545,7 @@ class CliDumper extends AbstractDumper
|
|||
return true;
|
||||
}
|
||||
|
||||
if (DIRECTORY_SEPARATOR === '\\') {
|
||||
if (\DIRECTORY_SEPARATOR === '\\') {
|
||||
return (\function_exists('sapi_windows_vt100_support')
|
||||
&& @sapi_windows_vt100_support($stream))
|
||||
|| false !== getenv('ANSICON')
|
||||
|
@ -582,7 +582,7 @@ class CliDumper extends AbstractDumper
|
|||
|| 'xterm' === getenv('TERM')
|
||||
|| 'Hyper' === getenv('TERM_PROGRAM');
|
||||
|
||||
if (!$result && PHP_VERSION_ID >= 70200) {
|
||||
if (!$result && \PHP_VERSION_ID >= 70200) {
|
||||
$version = sprintf(
|
||||
'%s.%s.%s',
|
||||
PHP_WINDOWS_VERSION_MAJOR,
|
||||
|
|
|
@ -20,7 +20,7 @@ final class CliContextProvider implements ContextProviderInterface
|
|||
{
|
||||
public function getContext(): ?array
|
||||
{
|
||||
if ('cli' !== PHP_SAPI) {
|
||||
if ('cli' !== \PHP_SAPI) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ final class SourceContextProvider implements ContextProviderInterface
|
|||
if (null !== $this->projectDir) {
|
||||
$context['project_dir'] = $this->projectDir;
|
||||
if (0 === strpos($file, $this->projectDir)) {
|
||||
$context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), DIRECTORY_SEPARATOR);
|
||||
$context['file_relative'] = ltrim(substr($file, \strlen($this->projectDir)), \DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@ EODUMP;
|
|||
*/
|
||||
public function testDumpInterval($intervalSpec, $ms, $invert, $expected)
|
||||
{
|
||||
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ EODUMP;
|
|||
*/
|
||||
public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert, $expected)
|
||||
{
|
||||
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ EODUMP;
|
|||
*/
|
||||
public function testCastInterval($intervalSpec, $ms, $invert, $xInterval, $xSeconds)
|
||||
{
|
||||
if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) {
|
||||
$this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.');
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class VarDumper
|
|||
{
|
||||
if (null === self::$handler) {
|
||||
$cloner = new VarCloner();
|
||||
$dumper = \in_array(PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper();
|
||||
$dumper = \in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper();
|
||||
self::$handler = function ($var) use ($cloner, $dumper) {
|
||||
$dumper->dump($cloner->cloneVar($var));
|
||||
};
|
||||
|
|
|
@ -1941,7 +1941,7 @@ YAML;
|
|||
*/
|
||||
public function testParsingNotReadableFilesThrowsException()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue