From 52140652ed31cee3dabd0c481b5577201fa769b4 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Wed, 2 Sep 2020 18:06:40 +0200 Subject: [PATCH] Enable "native_constant_invocation" CS rule --- Finder.php | 6 +++--- Iterator/DepthRangeFilterIterator.php | 4 ++-- Tests/Iterator/DepthRangeFilterIteratorTest.php | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Finder.php b/Finder.php index 33a76cc9..3e8a9483 100644 --- a/Finder.php +++ b/Finder.php @@ -541,7 +541,7 @@ public function in($dirs) foreach ((array) $dirs as $dir) { if (is_dir($dir)) { $resolvedDirs[] = $this->normalizeDir($dir); - } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR | GLOB_NOSORT)) { + } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? \GLOB_BRACE : 0) | \GLOB_ONLYDIR | \GLOB_NOSORT)) { sort($glob); $resolvedDirs = array_merge($resolvedDirs, array_map([$this, 'normalizeDir'], $glob)); } else { @@ -658,7 +658,7 @@ private function searchInDirectory($dir) } $minDepth = 0; - $maxDepth = PHP_INT_MAX; + $maxDepth = \PHP_INT_MAX; foreach ($this->depths as $comparator) { switch ($comparator->getOperator()) { @@ -693,7 +693,7 @@ private function searchInDirectory($dir) $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST); - if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) { + if ($minDepth > 0 || $maxDepth < \PHP_INT_MAX) { $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth); } diff --git a/Iterator/DepthRangeFilterIterator.php b/Iterator/DepthRangeFilterIterator.php index ce9d3aa7..d9bbeb48 100644 --- a/Iterator/DepthRangeFilterIterator.php +++ b/Iterator/DepthRangeFilterIterator.php @@ -25,10 +25,10 @@ class DepthRangeFilterIterator extends FilterIterator * @param int $minDepth The min depth * @param int $maxDepth The max depth */ - public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX) + public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = \PHP_INT_MAX) { $this->minDepth = $minDepth; - $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth); + $iterator->setMaxDepth(\PHP_INT_MAX === $maxDepth ? -1 : $maxDepth); parent::__construct($iterator); } diff --git a/Tests/Iterator/DepthRangeFilterIteratorTest.php b/Tests/Iterator/DepthRangeFilterIteratorTest.php index dab9723d..5ef2ed41 100644 --- a/Tests/Iterator/DepthRangeFilterIteratorTest.php +++ b/Tests/Iterator/DepthRangeFilterIteratorTest.php @@ -75,8 +75,8 @@ public function getAcceptData() return [ [0, 0, $this->toAbsolute($lessThan1)], [0, 1, $this->toAbsolute($lessThanOrEqualTo1)], - [2, PHP_INT_MAX, []], - [1, PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)], + [2, \PHP_INT_MAX, []], + [1, \PHP_INT_MAX, $this->toAbsolute($graterThanOrEqualTo1)], [1, 1, $this->toAbsolute($equalTo1)], ]; }