upgrade to laravel 7 and set branch to v2
This commit is contained in:
Vendored
+5
@@ -1,6 +1,11 @@
|
||||
CHANGELOG
|
||||
=========
|
||||
|
||||
5.0.0
|
||||
-----
|
||||
|
||||
* added `$useNaturalSort` argument to `Finder::sortByName()`
|
||||
|
||||
4.3.0
|
||||
-----
|
||||
|
||||
|
||||
+3
-10
@@ -31,12 +31,7 @@ class Comparator
|
||||
return $this->target;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the target value.
|
||||
*
|
||||
* @param string $target The target value
|
||||
*/
|
||||
public function setTarget($target)
|
||||
public function setTarget(string $target)
|
||||
{
|
||||
$this->target = $target;
|
||||
}
|
||||
@@ -54,13 +49,11 @@ class Comparator
|
||||
/**
|
||||
* Sets the comparison operator.
|
||||
*
|
||||
* @param string $operator A valid operator
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setOperator($operator)
|
||||
public function setOperator(string $operator)
|
||||
{
|
||||
if (!$operator) {
|
||||
if ('' === $operator) {
|
||||
$operator = '==';
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
-21
@@ -336,13 +336,11 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This option is enabled by default.
|
||||
*
|
||||
* @param bool $ignoreDotFiles Whether to exclude "hidden" files or not
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see ExcludeDirectoryFilterIterator
|
||||
*/
|
||||
public function ignoreDotFiles($ignoreDotFiles)
|
||||
public function ignoreDotFiles(bool $ignoreDotFiles)
|
||||
{
|
||||
if ($ignoreDotFiles) {
|
||||
$this->ignore |= static::IGNORE_DOT_FILES;
|
||||
@@ -358,13 +356,11 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This option is enabled by default.
|
||||
*
|
||||
* @param bool $ignoreVCS Whether to exclude VCS files or not
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see ExcludeDirectoryFilterIterator
|
||||
*/
|
||||
public function ignoreVCS($ignoreVCS)
|
||||
public function ignoreVCS(bool $ignoreVCS)
|
||||
{
|
||||
if ($ignoreVCS) {
|
||||
$this->ignore |= static::IGNORE_VCS_FILES;
|
||||
@@ -432,19 +428,12 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* This can be slow as all the matching files and directories must be retrieved for comparison.
|
||||
*
|
||||
* @param bool $useNaturalSort Whether to use natural sort or not, disabled by default
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @see SortableIterator
|
||||
*/
|
||||
public function sortByName(/* bool $useNaturalSort = false */)
|
||||
public function sortByName(bool $useNaturalSort = false)
|
||||
{
|
||||
if (\func_num_args() < 1 && __CLASS__ !== static::class && __CLASS__ !== (new \ReflectionMethod($this, __FUNCTION__))->getDeclaringClass()->getName() && !$this instanceof \PHPUnit\Framework\MockObject\MockObject && !$this instanceof \Prophecy\Prophecy\ProphecySubjectInterface && !$this instanceof \Mockery\MockInterface) {
|
||||
@trigger_error(sprintf('The "%s()" method will have a new "bool $useNaturalSort = false" argument in version 5.0, not defining it is deprecated since Symfony 4.2.', __METHOD__), \E_USER_DEPRECATED);
|
||||
}
|
||||
$useNaturalSort = 0 < \func_num_args() && func_get_arg(0);
|
||||
|
||||
$this->sort = $useNaturalSort ? Iterator\SortableIterator::SORT_BY_NAME_NATURAL : Iterator\SortableIterator::SORT_BY_NAME;
|
||||
|
||||
return $this;
|
||||
@@ -568,13 +557,11 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* By default, scanning unreadable directories content throws an AccessDeniedException.
|
||||
*
|
||||
* @param bool $ignore
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function ignoreUnreadableDirs($ignore = true)
|
||||
public function ignoreUnreadableDirs(bool $ignore = true)
|
||||
{
|
||||
$this->ignoreUnreadableDirs = (bool) $ignore;
|
||||
$this->ignoreUnreadableDirs = $ignore;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -644,13 +631,11 @@ class Finder implements \IteratorAggregate, \Countable
|
||||
*
|
||||
* The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array.
|
||||
*
|
||||
* @param iterable $iterator
|
||||
*
|
||||
* @return $this
|
||||
*
|
||||
* @throws \InvalidArgumentException when the given argument is not iterable
|
||||
*/
|
||||
public function append($iterator)
|
||||
public function append(iterable $iterator)
|
||||
{
|
||||
if ($iterator instanceof \IteratorAggregate) {
|
||||
$this->iterators[] = $iterator->getIterator();
|
||||
|
||||
Vendored
+2
-7
@@ -38,14 +38,9 @@ class Glob
|
||||
/**
|
||||
* Returns a regexp which is the equivalent of the glob pattern.
|
||||
*
|
||||
* @param string $glob The glob pattern
|
||||
* @param bool $strictLeadingDot
|
||||
* @param bool $strictWildcardSlash
|
||||
* @param string $delimiter Optional delimiter
|
||||
*
|
||||
* @return string regex The regexp
|
||||
* @return string
|
||||
*/
|
||||
public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
|
||||
public static function toRegex(string $glob, bool $strictLeadingDot = true, bool $strictWildcardSlash = true, string $delimiter = '#')
|
||||
{
|
||||
$firstByte = true;
|
||||
$escaping = false;
|
||||
|
||||
@@ -51,7 +51,7 @@ class FilecontentFilterIterator extends MultiplePcreFilterIterator
|
||||
*
|
||||
* @return string regexp corresponding to a given string or regexp
|
||||
*/
|
||||
protected function toRegex($str)
|
||||
protected function toRegex(string $str)
|
||||
{
|
||||
return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class FilenameFilterIterator extends MultiplePcreFilterIterator
|
||||
*
|
||||
* @return string regexp corresponding to a given glob or regexp
|
||||
*/
|
||||
protected function toRegex($str)
|
||||
protected function toRegex(string $str)
|
||||
{
|
||||
return $this->isRegex($str) ? $str : Glob::toRegex($str);
|
||||
}
|
||||
|
||||
@@ -23,8 +23,8 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @param string[] $matchPatterns An array of patterns that need to match
|
||||
* @param string[] $noMatchPatterns An array of patterns that need to not match
|
||||
*/
|
||||
public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
|
||||
{
|
||||
@@ -46,11 +46,9 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
|
||||
* Such case can be handled by child classes before calling the method if they want to
|
||||
* apply a different behavior.
|
||||
*
|
||||
* @param string $string The string to be matched against filters
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isAccepted($string)
|
||||
protected function isAccepted(string $string)
|
||||
{
|
||||
// should at least not match one rule to exclude
|
||||
foreach ($this->noMatchRegexps as $regex) {
|
||||
@@ -77,11 +75,9 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
|
||||
/**
|
||||
* Checks whether the string is a regex.
|
||||
*
|
||||
* @param string $str
|
||||
*
|
||||
* @return bool Whether the given string is a regex
|
||||
* @return bool
|
||||
*/
|
||||
protected function isRegex($str)
|
||||
protected function isRegex(string $str)
|
||||
{
|
||||
if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
|
||||
$start = substr($m[1], 0, 1);
|
||||
@@ -104,9 +100,7 @@ abstract class MultiplePcreFilterIterator extends \FilterIterator
|
||||
/**
|
||||
* Converts string into regexp.
|
||||
*
|
||||
* @param string $str Pattern
|
||||
*
|
||||
* @return string regexp corresponding to a given string
|
||||
* @return string
|
||||
*/
|
||||
abstract protected function toRegex($str);
|
||||
abstract protected function toRegex(string $str);
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ class PathFilterIterator extends MultiplePcreFilterIterator
|
||||
*
|
||||
* @return string regexp corresponding to a given string or regexp
|
||||
*/
|
||||
protected function toRegex($str)
|
||||
protected function toRegex(string $str)
|
||||
{
|
||||
return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
|
||||
}
|
||||
|
||||
+7
-7
@@ -41,15 +41,15 @@ class SortableIterator implements \IteratorAggregate
|
||||
$order = $reverseOrder ? -1 : 1;
|
||||
|
||||
if (self::SORT_BY_NAME === $sort) {
|
||||
$this->sort = static function ($a, $b) use ($order) {
|
||||
$this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
|
||||
return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_NAME_NATURAL === $sort) {
|
||||
$this->sort = static function ($a, $b) use ($order) {
|
||||
$this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
|
||||
return $order * strnatcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_TYPE === $sort) {
|
||||
$this->sort = static function ($a, $b) use ($order) {
|
||||
$this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
|
||||
if ($a->isDir() && $b->isFile()) {
|
||||
return -$order;
|
||||
} elseif ($a->isFile() && $b->isDir()) {
|
||||
@@ -59,21 +59,21 @@ class SortableIterator implements \IteratorAggregate
|
||||
return $order * strcmp($a->getRealPath() ?: $a->getPathname(), $b->getRealPath() ?: $b->getPathname());
|
||||
};
|
||||
} elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
|
||||
$this->sort = static function ($a, $b) use ($order) {
|
||||
$this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
|
||||
return $order * ($a->getATime() - $b->getATime());
|
||||
};
|
||||
} elseif (self::SORT_BY_CHANGED_TIME === $sort) {
|
||||
$this->sort = static function ($a, $b) use ($order) {
|
||||
$this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
|
||||
return $order * ($a->getCTime() - $b->getCTime());
|
||||
};
|
||||
} elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
|
||||
$this->sort = static function ($a, $b) use ($order) {
|
||||
$this->sort = static function (\SplFileInfo $a, \SplFileInfo $b) use ($order) {
|
||||
return $order * ($a->getMTime() - $b->getMTime());
|
||||
};
|
||||
} elseif (self::SORT_BY_NONE === $sort) {
|
||||
$this->sort = $order;
|
||||
} elseif (\is_callable($sort)) {
|
||||
$this->sort = $reverseOrder ? static function ($a, $b) use ($sort) { return -$sort($a, $b); } : $sort;
|
||||
$this->sort = $reverseOrder ? static function (\SplFileInfo $a, \SplFileInfo $b) use ($sort) { return -$sort($a, $b); } : $sort;
|
||||
} else {
|
||||
throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=7.1.3"
|
||||
"php": ">=7.2.5"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": { "Symfony\\Component\\Finder\\": "" },
|
||||
|
||||
Reference in New Issue
Block a user