Laravel version update
Laravel version update
This commit is contained in:
11
vendor/symfony/finder/CHANGELOG.md
vendored
11
vendor/symfony/finder/CHANGELOG.md
vendored
@@ -1,6 +1,17 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
3.4.0
|
||||
-----
|
||||
|
||||
* deprecated `Symfony\Component\Finder\Iterator\FilterIterator`
|
||||
* added Finder::hasResults() method to check if any results were found
|
||||
|
||||
3.3.0
|
||||
-----
|
||||
|
||||
* added double-star matching to Glob::toRegex()
|
||||
|
||||
3.0.0
|
||||
-----
|
||||
|
||||
|
@@ -64,7 +64,7 @@ class Comparator
|
||||
$operator = '==';
|
||||
}
|
||||
|
||||
if (!in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
|
||||
if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
|
||||
}
|
||||
|
||||
|
@@ -19,8 +19,6 @@ namespace Symfony\Component\Finder\Comparator;
|
||||
class DateComparator extends Comparator
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $test A comparison string
|
||||
*
|
||||
* @throws \InvalidArgumentException If the test is not understood
|
||||
|
@@ -35,9 +35,7 @@ namespace Symfony\Component\Finder\Comparator;
|
||||
class NumberComparator extends Comparator
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $test A comparison string
|
||||
* @param string|int $test A comparison string or an integer
|
||||
*
|
||||
* @throws \InvalidArgumentException If the test is not understood
|
||||
*/
|
||||
|
@@ -13,6 +13,8 @@ namespace Symfony\Component\Finder\Exception;
|
||||
|
||||
/**
|
||||
* @author Jean-François Simon <contact@jfsimon.fr>
|
||||
*
|
||||
* @deprecated since 3.3, to be removed in 4.0.
|
||||
*/
|
||||
interface ExceptionInterface
|
||||
{
|
||||
|
111
vendor/symfony/finder/Finder.php
vendored
111
vendor/symfony/finder/Finder.php
vendored
@@ -61,9 +61,6 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
|
||||
private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
|
||||
@@ -72,7 +69,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Creates a new Finder.
|
||||
*
|
||||
* @return Finder A new Finder instance
|
||||
* @return static
|
||||
*/
|
||||
public static function create()
|
||||
{
|
||||
@@ -82,7 +79,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Restricts the matching to directories only.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*/
|
||||
public function directories()
|
||||
{
|
||||
@@ -94,7 +91,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Restricts the matching to files only.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
@@ -111,9 +108,9 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
* $finder->depth('> 1') // the Finder will start matching at level 1.
|
||||
* $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point.
|
||||
*
|
||||
* @param int $level The depth level expression
|
||||
* @param string|int $level The depth level expression
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see DepthRangeFilterIterator
|
||||
* @see NumberComparator
|
||||
@@ -137,7 +134,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $date A date range string
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see strtotime
|
||||
* @see DateRangeFilterIterator
|
||||
@@ -161,7 +158,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp, a glob, or a string)
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
@@ -177,7 +174,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp, a glob, or a string)
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
@@ -198,7 +195,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $pattern A pattern (string or regexp)
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see FilecontentFilterIterator
|
||||
*/
|
||||
@@ -219,7 +216,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $pattern A pattern (string or regexp)
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see FilecontentFilterIterator
|
||||
*/
|
||||
@@ -242,7 +239,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp or a string)
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
@@ -265,7 +262,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string $pattern A pattern (a regexp or a string)
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see FilenameFilterIterator
|
||||
*/
|
||||
@@ -283,9 +280,9 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
* $finder->size('<= 1Ki');
|
||||
* $finder->size(4);
|
||||
*
|
||||
* @param string $size A size range string
|
||||
* @param string|int $size A size range string or an integer
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SizeRangeFilterIterator
|
||||
* @see NumberComparator
|
||||
@@ -300,9 +297,13 @@ 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 Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see ExcludeDirectoryFilterIterator
|
||||
*/
|
||||
@@ -316,9 +317,11 @@ 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 Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see ExcludeDirectoryFilterIterator
|
||||
*/
|
||||
@@ -336,9 +339,11 @@ 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 Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see ExcludeDirectoryFilterIterator
|
||||
*/
|
||||
@@ -376,9 +381,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @param \Closure $closure An anonymous function
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
@@ -394,7 +397,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
@@ -410,7 +413,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
@@ -428,7 +431,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
@@ -448,7 +451,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
@@ -466,7 +469,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
@@ -483,9 +486,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
* The anonymous function receives a \SplFileInfo and must return false
|
||||
* to remove files.
|
||||
*
|
||||
* @param \Closure $closure An anonymous function
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @see CustomFilterIterator
|
||||
*/
|
||||
@@ -499,7 +500,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
/**
|
||||
* Forces the following of symlinks.
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*/
|
||||
public function followLinks()
|
||||
{
|
||||
@@ -515,7 +516,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param bool $ignore
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*/
|
||||
public function ignoreUnreadableDirs($ignore = true)
|
||||
{
|
||||
@@ -529,7 +530,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param string|array $dirs A directory path or an array of directories
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The current Finder instance
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException if one of the directories does not exist
|
||||
*/
|
||||
@@ -539,9 +540,9 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
|
||||
foreach ((array) $dirs as $dir) {
|
||||
if (is_dir($dir)) {
|
||||
$resolvedDirs[] = $dir;
|
||||
} elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
|
||||
$resolvedDirs = array_merge($resolvedDirs, $glob);
|
||||
$resolvedDirs[] = $this->normalizeDir($dir);
|
||||
} elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
|
||||
$resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
|
||||
}
|
||||
@@ -563,11 +564,11 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*/
|
||||
public function getIterator()
|
||||
{
|
||||
if (0 === count($this->dirs) && 0 === count($this->iterators)) {
|
||||
if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
|
||||
throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
|
||||
}
|
||||
|
||||
if (1 === count($this->dirs) && 0 === count($this->iterators)) {
|
||||
if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
|
||||
return $this->searchInDirectory($this->dirs[0]);
|
||||
}
|
||||
|
||||
@@ -590,9 +591,9 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* @param mixed $iterator
|
||||
*
|
||||
* @return Finder|SplFileInfo[] The finder
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException When the given argument is not iterable.
|
||||
* @throws \InvalidArgumentException when the given argument is not iterable
|
||||
*/
|
||||
public function append($iterator)
|
||||
{
|
||||
@@ -600,7 +601,7 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
$this->iterators[] = $iterator->getIterator();
|
||||
} elseif ($iterator instanceof \Iterator) {
|
||||
$this->iterators[] = $iterator;
|
||||
} elseif ($iterator instanceof \Traversable || is_array($iterator)) {
|
||||
} elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
|
||||
$it = new \ArrayIterator();
|
||||
foreach ($iterator as $file) {
|
||||
$it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
|
||||
@@ -613,6 +614,20 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the any results were found.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasResults()
|
||||
{
|
||||
foreach ($this->getIterator() as $_) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Counts all the results collected by the iterators.
|
||||
*
|
||||
@@ -713,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);
|
||||
}
|
||||
}
|
||||
|
30
vendor/symfony/finder/Glob.php
vendored
30
vendor/symfony/finder/Glob.php
vendored
@@ -51,19 +51,31 @@ class Glob
|
||||
$escaping = false;
|
||||
$inCurlies = 0;
|
||||
$regex = '';
|
||||
$sizeGlob = strlen($glob);
|
||||
$sizeGlob = \strlen($glob);
|
||||
for ($i = 0; $i < $sizeGlob; ++$i) {
|
||||
$car = $glob[$i];
|
||||
if ($firstByte) {
|
||||
if ($strictLeadingDot && '.' !== $car) {
|
||||
$regex .= '(?=[^\.])';
|
||||
}
|
||||
|
||||
$firstByte = false;
|
||||
if ($firstByte && $strictLeadingDot && '.' !== $car) {
|
||||
$regex .= '(?=[^\.])';
|
||||
}
|
||||
|
||||
if ('/' === $car) {
|
||||
$firstByte = true;
|
||||
$firstByte = '/' === $car;
|
||||
|
||||
if ($firstByte && $strictWildcardSlash && isset($glob[$i + 2]) && '**' === $glob[$i + 1].$glob[$i + 2] && (!isset($glob[$i + 3]) || '/' === $glob[$i + 3])) {
|
||||
$car = '[^/]++/';
|
||||
if (!isset($glob[$i + 3])) {
|
||||
$car .= '?';
|
||||
}
|
||||
|
||||
if ($strictLeadingDot) {
|
||||
$car = '(?=[^\.])'.$car;
|
||||
}
|
||||
|
||||
$car = '/(?:'.$car.')*';
|
||||
$i += 2 + isset($glob[$i + 3]);
|
||||
|
||||
if ('/' === $delimiter) {
|
||||
$car = str_replace('/', '\\/', $car);
|
||||
}
|
||||
}
|
||||
|
||||
if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
|
||||
|
@@ -24,8 +24,6 @@ class CustomFilterIterator extends FilterIterator
|
||||
private $filters = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param callable[] $filters An array of PHP callbacks
|
||||
*
|
||||
@@ -34,7 +32,7 @@ class CustomFilterIterator extends FilterIterator
|
||||
public function __construct(\Iterator $iterator, array $filters)
|
||||
{
|
||||
foreach ($filters as $filter) {
|
||||
if (!is_callable($filter)) {
|
||||
if (!\is_callable($filter)) {
|
||||
throw new \InvalidArgumentException('Invalid PHP callback.');
|
||||
}
|
||||
}
|
||||
@@ -53,7 +51,7 @@ class CustomFilterIterator extends FilterIterator
|
||||
$fileinfo = $this->current();
|
||||
|
||||
foreach ($this->filters as $filter) {
|
||||
if (false === call_user_func($filter, $fileinfo)) {
|
||||
if (false === \call_user_func($filter, $fileinfo)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@@ -23,8 +23,6 @@ class DateRangeFilterIterator extends FilterIterator
|
||||
private $comparators = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param DateComparator[] $comparators An array of DateComparator instances
|
||||
*/
|
||||
@@ -44,7 +42,7 @@ class DateRangeFilterIterator extends FilterIterator
|
||||
{
|
||||
$fileinfo = $this->current();
|
||||
|
||||
if (!file_exists($fileinfo->getRealPath())) {
|
||||
if (!file_exists($fileinfo->getPathname())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -21,8 +21,6 @@ class DepthRangeFilterIterator extends FilterIterator
|
||||
private $minDepth = 0;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \RecursiveIteratorIterator $iterator The Iterator to filter
|
||||
* @param int $minDepth The min depth
|
||||
* @param int $maxDepth The max depth
|
||||
|
@@ -24,8 +24,6 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv
|
||||
private $excludedPattern;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param array $directories An array of directories to exclude
|
||||
*/
|
||||
@@ -35,6 +33,7 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv
|
||||
$this->isRecursive = $iterator instanceof \RecursiveIterator;
|
||||
$patterns = array();
|
||||
foreach ($directories as $directory) {
|
||||
$directory = rtrim($directory, '/');
|
||||
if (!$this->isRecursive || false !== strpos($directory, '/')) {
|
||||
$patterns[] = preg_quote($directory, '#');
|
||||
} else {
|
||||
@@ -51,7 +50,7 @@ class ExcludeDirectoryFilterIterator extends FilterIterator implements \Recursiv
|
||||
/**
|
||||
* Filters the iterator values.
|
||||
*
|
||||
* @return bool true if the value should be kept, false otherwise
|
||||
* @return bool True if the value should be kept, false otherwise
|
||||
*/
|
||||
public function accept()
|
||||
{
|
||||
|
@@ -24,8 +24,6 @@ class FileTypeFilterIterator extends FilterIterator
|
||||
private $mode;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param int $mode The mode (self::ONLY_FILES or self::ONLY_DIRECTORIES)
|
||||
*/
|
||||
|
@@ -18,6 +18,8 @@ namespace Symfony\Component\Finder\Iterator;
|
||||
* @see https://bugs.php.net/68557
|
||||
*
|
||||
* @author Alex Bogomazov
|
||||
*
|
||||
* @deprecated since 3.4, to be removed in 4.0.
|
||||
*/
|
||||
abstract class FilterIterator extends \FilterIterator
|
||||
{
|
||||
@@ -29,7 +31,7 @@ abstract class FilterIterator extends \FilterIterator
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
if (PHP_VERSION_ID > 50607 || (PHP_VERSION_ID > 50523 && PHP_VERSION_ID < 50600)) {
|
||||
if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
|
||||
parent::rewind();
|
||||
|
||||
return;
|
||||
|
@@ -22,8 +22,6 @@ abstract class MultiplePcreFilterIterator extends FilterIterator
|
||||
protected $noMatchRegexps = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param array $matchPatterns An array of patterns that need to match
|
||||
* @param array $noMatchPatterns An array of patterns that need to not match
|
||||
|
@@ -28,7 +28,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
|
||||
{
|
||||
$filename = $this->current()->getRelativePathname();
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$filename = str_replace('\\', '/', $filename);
|
||||
}
|
||||
|
||||
|
@@ -37,8 +37,6 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
private $directorySeparator = '/';
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $path
|
||||
* @param int $flags
|
||||
* @param bool $ignoreUnreadableDirs
|
||||
@@ -54,8 +52,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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +117,7 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
}
|
||||
|
||||
// @see https://bugs.php.net/68557
|
||||
if (PHP_VERSION_ID < 50523 || PHP_VERSION_ID >= 50600 && PHP_VERSION_ID < 50607) {
|
||||
if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
|
||||
parent::next();
|
||||
}
|
||||
|
||||
@@ -137,6 +135,11 @@ class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
|
||||
return $this->rewindable;
|
||||
}
|
||||
|
||||
// workaround for an HHVM bug, should be removed when https://github.com/facebook/hhvm/issues/7281 is fixed
|
||||
if ('' === $this->getPath()) {
|
||||
return $this->rewindable = false;
|
||||
}
|
||||
|
||||
if (false !== $stream = @opendir($this->getPath())) {
|
||||
$infos = stream_get_meta_data($stream);
|
||||
closedir($stream);
|
||||
|
@@ -23,8 +23,6 @@ class SizeRangeFilterIterator extends FilterIterator
|
||||
private $comparators = array();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Iterator $iterator The Iterator to filter
|
||||
* @param NumberComparator[] $comparators An array of NumberComparator instances
|
||||
*/
|
||||
|
@@ -28,8 +28,6 @@ class SortableIterator implements \IteratorAggregate
|
||||
private $sort;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param \Traversable $iterator The Iterator to filter
|
||||
* @param int|callable $sort The sort type (SORT_BY_NAME, SORT_BY_TYPE, or a PHP callback)
|
||||
*
|
||||
@@ -41,7 +39,7 @@ class SortableIterator implements \IteratorAggregate
|
||||
|
||||
if (self::SORT_BY_NAME === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
return strcmp($a->getRealpath(), $b->getRealpath());
|
||||
return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_TYPE === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
@@ -51,7 +49,7 @@ class SortableIterator implements \IteratorAggregate
|
||||
return 1;
|
||||
}
|
||||
|
||||
return strcmp($a->getRealpath(), $b->getRealpath());
|
||||
return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
|
||||
$this->sort = function ($a, $b) {
|
||||
@@ -65,7 +63,7 @@ class SortableIterator implements \IteratorAggregate
|
||||
$this->sort = function ($a, $b) {
|
||||
return $a->getMTime() - $b->getMTime();
|
||||
};
|
||||
} elseif (is_callable($sort)) {
|
||||
} elseif (\is_callable($sort)) {
|
||||
$this->sort = $sort;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
|
||||
|
2
vendor/symfony/finder/LICENSE
vendored
2
vendor/symfony/finder/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (c) 2004-2016 Fabien Potencier
|
||||
Copyright (c) 2004-2018 Fabien Potencier
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
9
vendor/symfony/finder/SplFileInfo.php
vendored
9
vendor/symfony/finder/SplFileInfo.php
vendored
@@ -22,8 +22,6 @@ class SplFileInfo extends \SplFileInfo
|
||||
private $relativePathname;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $file The file name
|
||||
* @param string $relativePath The relative path
|
||||
* @param string $relativePathname The relative path name
|
||||
@@ -68,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;
|
||||
|
@@ -11,9 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Comparator;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Finder\Comparator\Comparator;
|
||||
|
||||
class ComparatorTest extends \PHPUnit_Framework_TestCase
|
||||
class ComparatorTest extends TestCase
|
||||
{
|
||||
public function testGetSetOperator()
|
||||
{
|
||||
|
@@ -11,9 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Comparator;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Finder\Comparator\DateComparator;
|
||||
|
||||
class DateComparatorTest extends \PHPUnit_Framework_TestCase
|
||||
class DateComparatorTest extends TestCase
|
||||
{
|
||||
public function testConstructor()
|
||||
{
|
||||
|
@@ -11,9 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Comparator;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Finder\Comparator\NumberComparator;
|
||||
|
||||
class NumberComparatorTest extends \PHPUnit_Framework_TestCase
|
||||
class NumberComparatorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getConstructorTestData
|
||||
|
139
vendor/symfony/finder/Tests/FinderTest.php
vendored
139
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();
|
||||
@@ -226,7 +265,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
public function testFollowLinks()
|
||||
{
|
||||
if ('\\' == DIRECTORY_SEPARATOR) {
|
||||
if ('\\' == \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('symlinks are not supported on Windows');
|
||||
}
|
||||
|
||||
@@ -241,9 +280,9 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator();
|
||||
|
||||
$expected = array(
|
||||
self::$tmpDir.DIRECTORY_SEPARATOR.'test.php',
|
||||
__DIR__.DIRECTORY_SEPARATOR.'FinderTest.php',
|
||||
__DIR__.DIRECTORY_SEPARATOR.'GlobTest.php',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php',
|
||||
__DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php',
|
||||
);
|
||||
|
||||
$this->assertIterator($expected, $iterator);
|
||||
@@ -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);
|
||||
}
|
||||
@@ -312,7 +351,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$a = iterator_to_array($finder->directories()->in(self::$tmpDir));
|
||||
$a = array_values(array_map(function ($a) { return (string) $a; }, $a));
|
||||
$a = array_values(array_map('strval', $a));
|
||||
sort($a);
|
||||
$this->assertEquals($expected, $a, 'implements the \IteratorAggregate interface');
|
||||
}
|
||||
@@ -345,7 +384,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$paths[] = $file->getRelativePathname();
|
||||
}
|
||||
|
||||
$ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar');
|
||||
$ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.\DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar');
|
||||
|
||||
sort($paths);
|
||||
sort($ref);
|
||||
@@ -356,7 +395,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testAppendWithAFinder()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
||||
$finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
|
||||
|
||||
$finder1 = $this->buildFinder();
|
||||
$finder1->directories()->in(self::$tmpDir);
|
||||
@@ -369,7 +408,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testAppendWithAnArray()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
||||
$finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
|
||||
|
||||
$finder->append($this->toAbsolute(array('foo', 'toto')));
|
||||
|
||||
@@ -384,7 +423,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testAppendDoesNotRequireIn()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo');
|
||||
$finder->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo');
|
||||
|
||||
$finder1 = Finder::create()->append($finder);
|
||||
|
||||
@@ -405,7 +444,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
public function testCountFiles()
|
||||
{
|
||||
$files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures');
|
||||
$files = Finder::create()->files()->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures');
|
||||
$i = 0;
|
||||
|
||||
foreach ($files as $file) {
|
||||
@@ -421,7 +460,21 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testCountWithoutIn()
|
||||
{
|
||||
$finder = Finder::create()->files();
|
||||
count($finder);
|
||||
\count($finder);
|
||||
}
|
||||
|
||||
public function testHasResults()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__);
|
||||
$this->assertTrue($finder->hasResults());
|
||||
}
|
||||
|
||||
public function testNoResults()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__)->name('DoesNotExist');
|
||||
$this->assertFalse($finder->hasResults());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -430,7 +483,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testContains($matchPatterns, $noMatchPatterns, $expected)
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
|
||||
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures')
|
||||
->name('*.txt')->sortByName()
|
||||
->contains($matchPatterns)
|
||||
->notContains($noMatchPatterns);
|
||||
@@ -493,15 +546,15 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
{
|
||||
$locations = array(
|
||||
__DIR__.'/Fixtures/one',
|
||||
self::$tmpDir.DIRECTORY_SEPARATOR.'toto',
|
||||
self::$tmpDir.\DIRECTORY_SEPARATOR.'toto',
|
||||
);
|
||||
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in($locations)->depth('< 10')->name('*.neon');
|
||||
|
||||
$expected = array(
|
||||
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon',
|
||||
__DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon',
|
||||
__DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'c.neon',
|
||||
__DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'d.neon',
|
||||
);
|
||||
|
||||
$this->assertIterator($expected, $finder);
|
||||
@@ -522,10 +575,10 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag()
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
|
||||
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s')
|
||||
->path('/^dir/');
|
||||
|
||||
$expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat');
|
||||
$expected = array('r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'bar.dat');
|
||||
$this->assertIterator($this->toAbsoluteFixtures($expected), $finder);
|
||||
}
|
||||
|
||||
@@ -559,7 +612,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
public function testPath($matchPatterns, $noMatchPatterns, array $expected)
|
||||
{
|
||||
$finder = $this->buildFinder();
|
||||
$finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures')
|
||||
$finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures')
|
||||
->path($matchPatterns)
|
||||
->notPath($noMatchPatterns);
|
||||
|
||||
@@ -571,41 +624,41 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
return array(
|
||||
array('', '', array()),
|
||||
array('/^A\/B\/C/', '/C$/',
|
||||
array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'),
|
||||
array('A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat'),
|
||||
),
|
||||
array('/^A\/B/', 'foobar',
|
||||
array(
|
||||
'A'.DIRECTORY_SEPARATOR.'B',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
),
|
||||
),
|
||||
array('A/B/C', 'foobar',
|
||||
array(
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
),
|
||||
),
|
||||
array('A/B', 'foobar',
|
||||
array(
|
||||
//dirs
|
||||
'A'.DIRECTORY_SEPARATOR.'B',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C',
|
||||
//files
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy',
|
||||
'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat',
|
||||
'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat.copy',
|
||||
'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy',
|
||||
),
|
||||
),
|
||||
array('/^with space\//', 'foobar',
|
||||
array(
|
||||
'with space'.DIRECTORY_SEPARATOR.'foo.txt',
|
||||
'with space'.\DIRECTORY_SEPARATOR.'foo.txt',
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -613,7 +666,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
public function testAccessDeniedException()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
@@ -621,7 +674,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$finder->files()->in(self::$tmpDir);
|
||||
|
||||
// make 'foo' directory non-readable
|
||||
$testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
|
||||
$testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo';
|
||||
chmod($testDir, 0333);
|
||||
|
||||
if (false === $couldRead = is_readable($testDir)) {
|
||||
@@ -634,6 +687,10 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, 'PHPUnit_Framework_ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
|
||||
}
|
||||
|
||||
if ($e instanceof \PHPUnit\Framework\ExpectationFailedException) {
|
||||
$this->fail(sprintf("Expected exception:\n%s\nGot:\n%s\nWith comparison failure:\n%s", $expectedExceptionClass, '\PHPUnit\Framework\ExpectationFailedException', $e->getComparisonFailure()->getExpectedAsString()));
|
||||
}
|
||||
|
||||
$this->assertInstanceOf($expectedExceptionClass, $e);
|
||||
}
|
||||
}
|
||||
@@ -649,7 +706,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
|
||||
public function testIgnoredAccessDeniedException()
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('chmod is not supported on Windows');
|
||||
}
|
||||
|
||||
@@ -657,7 +714,7 @@ class FinderTest extends Iterator\RealIteratorTestCase
|
||||
$finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir);
|
||||
|
||||
// make 'foo' directory non-readable
|
||||
$testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo';
|
||||
$testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo';
|
||||
chmod($testDir, 0333);
|
||||
|
||||
if (false === ($couldRead = is_readable($testDir))) {
|
||||
|
0
vendor/symfony/finder/Tests/Fixtures/.dot/a
vendored
Normal file
0
vendor/symfony/finder/Tests/Fixtures/.dot/a
vendored
Normal file
0
vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon
vendored
Normal file
0
vendor/symfony/finder/Tests/Fixtures/.dot/b/c.neon
vendored
Normal file
0
vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon
vendored
Normal file
0
vendor/symfony/finder/Tests/Fixtures/.dot/b/d.neon
vendored
Normal file
1
vendor/symfony/finder/Tests/Fixtures/one/.dot
vendored
Normal file
1
vendor/symfony/finder/Tests/Fixtures/one/.dot
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.dot
|
72
vendor/symfony/finder/Tests/GlobTest.php
vendored
72
vendor/symfony/finder/Tests/GlobTest.php
vendored
@@ -11,9 +11,11 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Finder\Glob;
|
||||
|
||||
class GlobTest extends \PHPUnit_Framework_TestCase
|
||||
class GlobTest extends TestCase
|
||||
{
|
||||
public function testGlobToRegexDelimiters()
|
||||
{
|
||||
@@ -22,4 +24,72 @@ class GlobTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals('^\.[^/]*$', Glob::toRegex('.*', true, true, ''));
|
||||
$this->assertEquals('/^\.[^/]*$/', Glob::toRegex('.*', true, true, '/'));
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarStrictDots()
|
||||
{
|
||||
$finder = new Finder();
|
||||
$finder->ignoreDotFiles(false);
|
||||
$regex = Glob::toRegex('/**/*.neon');
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarNonStrictDots()
|
||||
{
|
||||
$finder = new Finder();
|
||||
$finder->ignoreDotFiles(false);
|
||||
$regex = Glob::toRegex('/**/*.neon', false);
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('.dot/b/c.neon', '.dot/b/d.neon', 'one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarWithoutLeadingSlash()
|
||||
{
|
||||
$finder = new Finder();
|
||||
$finder->ignoreDotFiles(false);
|
||||
$regex = Glob::toRegex('/Fixtures/one/**');
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
}
|
||||
|
||||
public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot()
|
||||
{
|
||||
$finder = new Finder();
|
||||
$finder->ignoreDotFiles(false);
|
||||
$regex = Glob::toRegex('/Fixtures/one/**', false);
|
||||
|
||||
foreach ($finder->in(__DIR__) as $k => $v) {
|
||||
$k = str_replace(\DIRECTORY_SEPARATOR, '/', $k);
|
||||
if (preg_match($regex, substr($k, \strlen(__DIR__)))) {
|
||||
$match[] = substr($k, 10 + \strlen(__DIR__));
|
||||
}
|
||||
}
|
||||
sort($match);
|
||||
|
||||
$this->assertSame(array('one/.dot', 'one/a', 'one/b', 'one/b/c.neon', 'one/b/d.neon'), $match);
|
||||
}
|
||||
}
|
||||
|
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
|
||||
use Symfony\Component\Finder\Comparator\DateComparator;
|
||||
use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
|
||||
|
||||
class DateRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
|
@@ -58,9 +58,23 @@ class ExcludeDirectoryFilterIteratorTest extends RealIteratorTestCase
|
||||
'foo bar',
|
||||
);
|
||||
|
||||
$toto = array(
|
||||
'.bar',
|
||||
'.foo',
|
||||
'.foo/.bar',
|
||||
'.foo/bar',
|
||||
'.git',
|
||||
'test.py',
|
||||
'foo',
|
||||
'foo/bar.tmp',
|
||||
'test.php',
|
||||
'foo bar',
|
||||
);
|
||||
|
||||
return array(
|
||||
array(array('foo'), $this->toAbsolute($foo)),
|
||||
array(array('fo'), $this->toAbsolute($fo)),
|
||||
array(array('toto/'), $this->toAbsolute($toto)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -13,6 +13,8 @@ namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
/**
|
||||
* @author Alex Bogomazov
|
||||
*
|
||||
* @group legacy
|
||||
*/
|
||||
class FilterIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
|
@@ -11,15 +11,17 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
abstract class IteratorTestCase extends TestCase
|
||||
{
|
||||
protected function assertIterator($expected, \Traversable $iterator)
|
||||
{
|
||||
// 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);
|
||||
@@ -50,7 +52,7 @@ abstract class IteratorTestCase extends \PHPUnit_Framework_TestCase
|
||||
|
||||
foreach ($expected as $subarray) {
|
||||
$temp = array();
|
||||
while (count($values) && count($temp) < count($subarray)) {
|
||||
while (\count($values) && \count($temp) < \count($subarray)) {
|
||||
$temp[] = array_shift($values);
|
||||
}
|
||||
sort($temp);
|
||||
|
@@ -13,9 +13,9 @@ namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
class MockSplFileInfo extends \SplFileInfo
|
||||
{
|
||||
const TYPE_DIRECTORY = 1;
|
||||
const TYPE_FILE = 2;
|
||||
const TYPE_UNKNOWN = 3;
|
||||
const TYPE_DIRECTORY = 1;
|
||||
const TYPE_FILE = 2;
|
||||
const TYPE_UNKNOWN = 3;
|
||||
|
||||
private $contents = null;
|
||||
private $mode = null;
|
||||
@@ -25,9 +25,9 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
|
||||
public function __construct($param)
|
||||
{
|
||||
if (is_string($param)) {
|
||||
if (\is_string($param)) {
|
||||
parent::__construct($param);
|
||||
} elseif (is_array($param)) {
|
||||
} elseif (\is_array($param)) {
|
||||
$defaults = array(
|
||||
'name' => 'file.txt',
|
||||
'contents' => null,
|
||||
@@ -92,15 +92,13 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
|
||||
public function setType($type)
|
||||
{
|
||||
if (is_string($type)) {
|
||||
if (\is_string($type)) {
|
||||
switch ($type) {
|
||||
case 'directory':
|
||||
$this->type = self::TYPE_DIRECTORY;
|
||||
case 'd':
|
||||
$this->type = self::TYPE_DIRECTORY;
|
||||
break;
|
||||
case 'file':
|
||||
$this->type = self::TYPE_FILE;
|
||||
case 'f':
|
||||
$this->type = self::TYPE_FILE;
|
||||
break;
|
||||
|
@@ -11,9 +11,10 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Finder\Iterator\MultiplePcreFilterIterator;
|
||||
|
||||
class MultiplePcreFilterIteratorTest extends \PHPUnit_Framework_TestCase
|
||||
class MultiplePcreFilterIteratorTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider getIsRegexFixtures
|
||||
|
@@ -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(
|
||||
@@ -77,7 +77,6 @@ class PathFilterIteratorTest extends IteratorTestCase
|
||||
array($inner, array('copy/A'), array(), array('abc.dat.copy', 'ab.dat.copy', 'a.dat.copy')),
|
||||
array($inner, array('copy/A/B'), array(), array('abc.dat.copy', 'ab.dat.copy')),
|
||||
array($inner, array('copy/A/B/C'), array(), array('abc.dat.copy')),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -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/',
|
||||
@@ -44,7 +44,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);
|
||||
@@ -60,11 +60,20 @@ abstract class RealIteratorTestCase extends IteratorTestCase
|
||||
|
||||
public static function tearDownAfterClass()
|
||||
{
|
||||
foreach (array_reverse(self::$files) as $file) {
|
||||
if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) {
|
||||
@rmdir($file);
|
||||
$paths = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::CHILD_FIRST
|
||||
);
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if ($path->isDir()) {
|
||||
if ($path->isLink()) {
|
||||
@unlink($path);
|
||||
} else {
|
||||
@rmdir($path);
|
||||
}
|
||||
} else {
|
||||
@unlink($file);
|
||||
@unlink($path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -75,24 +84,24 @@ 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)) {
|
||||
if (\is_array($files)) {
|
||||
$f = array();
|
||||
foreach ($files as $file) {
|
||||
if (is_array($file)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
return $f;
|
||||
}
|
||||
|
||||
if (is_string($files)) {
|
||||
return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files);
|
||||
if (\is_string($files)) {
|
||||
return self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $files);
|
||||
}
|
||||
|
||||
return self::$tmpDir;
|
||||
@@ -102,7 +111,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();
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Finder\Tests\Iterator;
|
||||
|
||||
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
|
||||
use Symfony\Component\Finder\Comparator\NumberComparator;
|
||||
use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
|
||||
|
||||
class SizeRangeFilterIteratorTest extends RealIteratorTestCase
|
||||
{
|
||||
|
@@ -30,10 +30,10 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
*/
|
||||
public function testAccept($mode, $expected)
|
||||
{
|
||||
if (!is_callable($mode)) {
|
||||
if (!\is_callable($mode)) {
|
||||
switch ($mode) {
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME :
|
||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||
case SortableIterator::SORT_BY_ACCESSED_TIME:
|
||||
if ('\\' === \DIRECTORY_SEPARATOR) {
|
||||
touch(self::toAbsolute('.git'));
|
||||
} else {
|
||||
file_get_contents(self::toAbsolute('.git'));
|
||||
@@ -41,12 +41,12 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
sleep(1);
|
||||
file_get_contents(self::toAbsolute('.bar'));
|
||||
break;
|
||||
case SortableIterator::SORT_BY_CHANGED_TIME :
|
||||
case SortableIterator::SORT_BY_CHANGED_TIME:
|
||||
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
||||
sleep(1);
|
||||
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
||||
break;
|
||||
case SortableIterator::SORT_BY_MODIFIED_TIME :
|
||||
case SortableIterator::SORT_BY_MODIFIED_TIME:
|
||||
file_put_contents(self::toAbsolute('test.php'), 'foo');
|
||||
sleep(1);
|
||||
file_put_contents(self::toAbsolute('test.py'), 'foo');
|
||||
@@ -58,11 +58,11 @@ class SortableIteratorTest extends RealIteratorTestCase
|
||||
|
||||
$iterator = new SortableIterator($inner, $mode);
|
||||
|
||||
if ($mode === SortableIterator::SORT_BY_ACCESSED_TIME
|
||||
|| $mode === SortableIterator::SORT_BY_CHANGED_TIME
|
||||
|| $mode === SortableIterator::SORT_BY_MODIFIED_TIME
|
||||
if (SortableIterator::SORT_BY_ACCESSED_TIME === $mode
|
||||
|| 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);
|
||||
|
4
vendor/symfony/finder/composer.json
vendored
4
vendor/symfony/finder/composer.json
vendored
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9"
|
||||
"php": "^5.5.9|>=7.0.8"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Finder\\": "" },
|
||||
@@ -27,7 +27,7 @@
|
||||
"minimum-stability": "dev",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.0-dev"
|
||||
"dev-master": "3.4-dev"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
2
vendor/symfony/finder/phpunit.xml.dist
vendored
2
vendor/symfony/finder/phpunit.xml.dist
vendored
@@ -5,6 +5,8 @@
|
||||
backupGlobals="false"
|
||||
colors="true"
|
||||
bootstrap="vendor/autoload.php"
|
||||
failOnRisky="true"
|
||||
failOnWarning="true"
|
||||
>
|
||||
<php>
|
||||
<ini name="error_reporting" value="-1" />
|
||||
|
Reference in New Issue
Block a user