Skip to content

Commit 1d5b3bf

Browse files
Merge branch '2.8' into 3.4
* 2.8: Fix Clidumper tests Enable the fixer enforcing fully-qualified calls for compiler-optimized functions Apply fixers Disable the native_constant_invocation fixer until it can be scoped Update the list of excluded files for the CS fixer
2 parents 8dab220 + f3312e7 commit 1d5b3bf

File tree

4 files changed

+29
-29
lines changed

4 files changed

+29
-29
lines changed

Filesystem.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
4444
throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
4545
}
4646

47-
$this->mkdir(dirname($targetFile));
47+
$this->mkdir(\dirname($targetFile));
4848

4949
$doCopy = true;
5050
if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
@@ -121,7 +121,7 @@ public function exists($files)
121121
$maxPathLength = PHP_MAXPATHLEN - 2;
122122

123123
foreach ($this->toIterable($files) as $file) {
124-
if (strlen($file) > $maxPathLength) {
124+
if (\strlen($file) > $maxPathLength) {
125125
throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
126126
}
127127

@@ -163,7 +163,7 @@ public function remove($files)
163163
{
164164
if ($files instanceof \Traversable) {
165165
$files = iterator_to_array($files, false);
166-
} elseif (!is_array($files)) {
166+
} elseif (!\is_array($files)) {
167167
$files = array($files);
168168
}
169169
$files = array_reverse($files);
@@ -222,7 +222,7 @@ public function chown($files, $user, $recursive = false)
222222
if ($recursive && is_dir($file) && !is_link($file)) {
223223
$this->chown(new \FilesystemIterator($file), $user, true);
224224
}
225-
if (is_link($file) && function_exists('lchown')) {
225+
if (is_link($file) && \function_exists('lchown')) {
226226
if (true !== @lchown($file, $user)) {
227227
throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
228228
}
@@ -249,8 +249,8 @@ public function chgrp($files, $group, $recursive = false)
249249
if ($recursive && is_dir($file) && !is_link($file)) {
250250
$this->chgrp(new \FilesystemIterator($file), $group, true);
251251
}
252-
if (is_link($file) && function_exists('lchgrp')) {
253-
if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) {
252+
if (is_link($file) && \function_exists('lchgrp')) {
253+
if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
254254
throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
255255
}
256256
} else {
@@ -303,7 +303,7 @@ private function isReadable($filename)
303303
{
304304
$maxPathLength = PHP_MAXPATHLEN - 2;
305305

306-
if (strlen($filename) > $maxPathLength) {
306+
if (\strlen($filename) > $maxPathLength) {
307307
throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
308308
}
309309

@@ -332,7 +332,7 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false)
332332
}
333333
}
334334

335-
$this->mkdir(dirname($targetDir));
335+
$this->mkdir(\dirname($targetDir));
336336

337337
if (is_link($targetDir)) {
338338
if (readlink($targetDir) === $originDir) {
@@ -456,7 +456,7 @@ public function makePathRelative($endPath, $startPath)
456456
}
457457

458458
$stripDriveLetter = function ($path) {
459-
if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
459+
if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
460460
return substr($path, 2);
461461
}
462462

@@ -474,7 +474,7 @@ public function makePathRelative($endPath, $startPath)
474474
$result = array();
475475

476476
foreach ($pathSegments as $segment) {
477-
if ('..' === $segment && ($absolute || count($result))) {
477+
if ('..' === $segment && ($absolute || \count($result))) {
478478
array_pop($result);
479479
} elseif ('.' !== $segment) {
480480
$result[] = $segment;
@@ -494,16 +494,16 @@ public function makePathRelative($endPath, $startPath)
494494
}
495495

496496
// Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels)
497-
if (1 === count($startPathArr) && '' === $startPathArr[0]) {
497+
if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
498498
$depth = 0;
499499
} else {
500-
$depth = count($startPathArr) - $index;
500+
$depth = \count($startPathArr) - $index;
501501
}
502502

503503
// Repeated "../" for each level need to reach the common path
504504
$traverser = str_repeat('../', $depth);
505505

506-
$endPathRemainder = implode('/', array_slice($endPathArr, $index));
506+
$endPathRemainder = implode('/', \array_slice($endPathArr, $index));
507507

508508
// Construct $endPath from traversing to the common path, then to the remaining $endPath
509509
$relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
@@ -534,7 +534,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
534534
{
535535
$targetDir = rtrim($targetDir, '/\\');
536536
$originDir = rtrim($originDir, '/\\');
537-
$originDirLen = strlen($originDir);
537+
$originDirLen = \strlen($originDir);
538538

539539
// Iterate in destination folder to remove obsolete entries
540540
if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
@@ -543,7 +543,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
543543
$flags = \FilesystemIterator::SKIP_DOTS;
544544
$deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
545545
}
546-
$targetDirLen = strlen($targetDir);
546+
$targetDirLen = \strlen($targetDir);
547547
foreach ($deleteIterator as $file) {
548548
$origin = $originDir.substr($file->getPathname(), $targetDirLen);
549549
if (!$this->exists($origin)) {
@@ -601,7 +601,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o
601601
public function isAbsolutePath($file)
602602
{
603603
return strspn($file, '/\\', 0, 1)
604-
|| (strlen($file) > 3 && ctype_alpha($file[0])
604+
|| (\strlen($file) > 3 && ctype_alpha($file[0])
605605
&& ':' === $file[1]
606606
&& strspn($file, '/\\', 2, 1)
607607
)
@@ -671,7 +671,7 @@ public function tempnam($dir, $prefix)
671671
*/
672672
public function dumpFile($filename, $content)
673673
{
674-
$dir = dirname($filename);
674+
$dir = \dirname($filename);
675675

676676
if (!is_dir($dir)) {
677677
$this->mkdir($dir);
@@ -704,7 +704,7 @@ public function dumpFile($filename, $content)
704704
*/
705705
public function appendToFile($filename, $content)
706706
{
707-
$dir = dirname($filename);
707+
$dir = \dirname($filename);
708708

709709
if (!is_dir($dir)) {
710710
$this->mkdir($dir);
@@ -726,7 +726,7 @@ public function appendToFile($filename, $content)
726726
*/
727727
private function toIterable($files)
728728
{
729-
return is_array($files) || $files instanceof \Traversable ? $files : array($files);
729+
return \is_array($files) || $files instanceof \Traversable ? $files : array($files);
730730
}
731731

732732
/**
@@ -740,7 +740,7 @@ private function getSchemeAndHierarchy($filename)
740740
{
741741
$components = explode('://', $filename, 2);
742742

743-
return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
743+
return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
744744
}
745745

746746
private static function box($func)

Tests/FilesystemTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ public function testFilesExistsFails()
383383
$oldPath = getcwd();
384384
mkdir($basePath);
385385
chdir($basePath);
386-
$file = str_repeat('T', $maxPathLength - strlen($basePath) + 1);
386+
$file = str_repeat('T', $maxPathLength - \strlen($basePath) + 1);
387387
$path = $basePath.$file;
388388
exec('TYPE NUL >>'.$file); // equivalent of touch, we can not use the php touch() here because it suffers from the same limitation
389389
$this->longPathNamesWindows[] = $path; // save this so we can clean up later
@@ -449,7 +449,7 @@ public function testChmodWithWrongModLeavesPreviousPermissionsUntouched()
449449
{
450450
$this->markAsSkippedIfChmodIsMissing();
451451

452-
if (defined('HHVM_VERSION')) {
452+
if (\defined('HHVM_VERSION')) {
453453
$this->markTestSkipped('chmod() changes permissions even when passing invalid modes on HHVM');
454454
}
455455

@@ -1496,7 +1496,7 @@ public function testDumpFileOverwritesAnExistingFile()
14961496

14971497
public function testDumpFileWithFileScheme()
14981498
{
1499-
if (defined('HHVM_VERSION')) {
1499+
if (\defined('HHVM_VERSION')) {
15001500
$this->markTestSkipped('HHVM does not handle the file:// scheme correctly');
15011501
}
15021502

@@ -1546,7 +1546,7 @@ public function testAppendToFile()
15461546

15471547
public function testAppendToFileWithScheme()
15481548
{
1549-
if (defined('HHVM_VERSION')) {
1549+
if (\defined('HHVM_VERSION')) {
15501550
$this->markTestSkipped('HHVM does not handle the file:// scheme correctly');
15511551
}
15521552

Tests/FilesystemTestCase.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function setUpBeforeClass()
4848
$targetFile = tempnam(sys_get_temp_dir(), 'li');
4949
if (true !== @link($originFile, $targetFile)) {
5050
$report = error_get_last();
51-
if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
51+
if (\is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
5252
self::$linkOnWindows = false;
5353
}
5454
} else {
@@ -60,7 +60,7 @@ public static function setUpBeforeClass()
6060
$targetDir = tempnam(sys_get_temp_dir(), 'sl');
6161
if (true !== @symlink($originDir, $targetDir)) {
6262
$report = error_get_last();
63-
if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
63+
if (\is_array($report) && false !== strpos($report['message'], 'error code(1314)')) {
6464
self::$symlinkOnWindows = false;
6565
}
6666
} else {
@@ -129,7 +129,7 @@ protected function getFileGroup($filepath)
129129

130130
protected function markAsSkippedIfLinkIsMissing()
131131
{
132-
if (!function_exists('link')) {
132+
if (!\function_exists('link')) {
133133
$this->markTestSkipped('link is not supported');
134134
}
135135

@@ -159,7 +159,7 @@ protected function markAsSkippedIfChmodIsMissing()
159159

160160
protected function markAsSkippedIfPosixIsMissing()
161161
{
162-
if (!function_exists('posix_isatty')) {
162+
if (!\function_exists('posix_isatty')) {
163163
$this->markTestSkipped('Function posix_isatty is required.');
164164
}
165165
}

Tests/LockHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testErrorHandlingInLockIfLockPathBecomesUnwritable()
7979
$fs->remove($lockPath);
8080
}
8181

82-
$this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', get_class($e)));
82+
$this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', \get_class($e)));
8383
$this->assertNull($wrongMessage, sprintf('Expected exception message to contain "Permission denied", got "%s" instead.', $wrongMessage));
8484
}
8585

0 commit comments

Comments
 (0)