Skip to content

Commit

Permalink
Remove always true/false occurrences
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-daubois committed Oct 23, 2024
1 parent b98a9af commit 6de263e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Finder.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,24 +699,20 @@ public function getIterator(): \Iterator
* The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array.
*
* @return $this
*
* @throws \InvalidArgumentException when the given argument is not iterable
*/
public function append(iterable $iterator): static
{
if ($iterator instanceof \IteratorAggregate) {
$this->iterators[] = $iterator->getIterator();
} elseif ($iterator instanceof \Iterator) {
$this->iterators[] = $iterator;
} elseif (is_iterable($iterator)) {
} else {
$it = new \ArrayIterator();
foreach ($iterator as $file) {
$file = $file instanceof \SplFileInfo ? $file : new \SplFileInfo($file);
$it[$file->getPathname()] = $file;
}
$this->iterators[] = $it;
} else {
throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
}

return $this;
Expand Down

0 comments on commit 6de263e

Please sign in to comment.