We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8648d0f commit 677f541Copy full SHA for 677f541
packages/guides/src/Files.php
@@ -33,17 +33,18 @@ final class Files implements IteratorAggregate, Countable
33
34
public function add(string $filename): void
35
{
36
- if (in_array($filename, $this->files, true)) {
+ if (array_key_exists($filename, $this->files)) {
37
return;
38
}
39
40
- $this->files[] = $filename;
41
- sort($this->files, SORT_NATURAL | SORT_FLAG_CASE);
+ $this->files[$filename] = $filename;
42
43
44
/** @return Iterator<string> */
45
public function getIterator(): Iterator
46
+ sort($this->files, SORT_NATURAL | SORT_FLAG_CASE);
47
+
48
return new ArrayIterator($this->files);
49
50
0 commit comments