mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-05 14:33:49 +09:00
Dependency updates and update version number
This commit is contained in:
24
vendor/symfony/finder/Finder.php
vendored
24
vendor/symfony/finder/Finder.php
vendored
@@ -297,6 +297,10 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Excludes directories.
|
||||
*
|
||||
* Directories passed as argument must be relative to the ones defined with the `in()` method. For example:
|
||||
*
|
||||
* $finder->in(__DIR__)->exclude('ruby');
|
||||
*
|
||||
* @param string|array $dirs A directory path or an array of directories
|
||||
*
|
||||
* @return $this
|
||||
@@ -313,6 +317,8 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Excludes "hidden" directories and files (starting with a dot).
|
||||
*
|
||||
* This option is enabled by default.
|
||||
*
|
||||
* @param bool $ignoreDotFiles Whether to exclude "hidden" files or not
|
||||
*
|
||||
* @return $this
|
||||
@@ -333,6 +339,8 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Forces the finder to ignore version control directories.
|
||||
*
|
||||
* This option is enabled by default.
|
||||
*
|
||||
* @param bool $ignoreVCS Whether to exclude VCS files or not
|
||||
*
|
||||
* @return $this
|
||||
@@ -532,9 +540,9 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
|
||||
foreach ((array) $dirs as $dir) {
|
||||
if (is_dir($dir)) {
|
||||
$resolvedDirs[] = $dir;
|
||||
$resolvedDirs[] = $this->normalizeDir($dir);
|
||||
} elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
|
||||
$resolvedDirs = array_merge($resolvedDirs, $glob);
|
||||
$resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
|
||||
}
|
||||
@@ -720,4 +728,16 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
|
||||
return $iterator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Normalizes given directory names by removing trailing slashes.
|
||||
*
|
||||
* @param string $dir
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function normalizeDir($dir)
|
||||
{
|
||||
return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
|
||||
}
|
||||
}
|
||||
|
||||
7
vendor/symfony/finder/SplFileInfo.php
vendored
7
vendor/symfony/finder/SplFileInfo.php
vendored
@@ -66,12 +66,11 @@ class SplFileInfo extends \SplFileInfo
|
||||
*/
|
||||
public function getContents()
|
||||
{
|
||||
$level = error_reporting(0);
|
||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||
$content = file_get_contents($this->getPathname());
|
||||
error_reporting($level);
|
||||
restore_error_handler();
|
||||
if (false === $content) {
|
||||
$error = error_get_last();
|
||||
throw new \RuntimeException($error['message']);
|
||||
throw new \RuntimeException($error);
|
||||
}
|
||||
|
||||
return $content;
|
||||
|
||||
41
vendor/symfony/finder/Tests/FinderTest.php
vendored
41
vendor/symfony/finder/Tests/FinderTest.php
vendored
@@ -46,6 +46,45 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$this->assertIterator($this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar')), $finder->in(self::$tmpDir)->getIterator());
|
||||
}
|
||||
|
||||
public function testRemoveTrailingSlash()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
$expected = $this->toAbsolute(array('foo/bar.tmp', 'test.php', 'test.py', 'foo bar'));
|
||||
$in = self::$tmpDir.'//';
|
||||
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
}
|
||||
|
||||
public function testSymlinksNotResolved()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('symlinks are not supported on Windows');
|
||||
}
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
symlink($this->toAbsolute('foo'), $this->toAbsolute('baz'));
|
||||
$expected = $this->toAbsolute(array('baz/bar.tmp'));
|
||||
$in = self::$tmpDir.'/baz/';
|
||||
try {
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
unlink($this->toAbsolute('baz'));
|
||||
} catch (\Exception $e) {
|
||||
unlink($this->toAbsolute('baz'));
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
public function testBackPathNotNormalized()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
|
||||
$expected = $this->toAbsolute(array('foo/../foo/bar.tmp'));
|
||||
$in = self::$tmpDir.'/foo/../foo/';
|
||||
$this->assertIterator($expected, $finder->in($in)->files()->getIterator());
|
||||
}
|
||||
|
||||
public function testDepth()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
@@ -261,7 +300,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testInWithGlob()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(array(__DIR__.'/Fixtures/*/B/C', __DIR__.'/Fixtures/*/*/B/C'))->getIterator();
|
||||
$finder->in(array(__DIR__.'/Fixtures/*/B/C/', __DIR__.'/Fixtures/*/*/B/C/'))->getIterator();
|
||||
|
||||
$this->assertIterator($this->toAbsoluteFixtures(array('A/B/C/abc.dat', 'copy/A/B/C/abc.dat.copy')), $finder);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user