1 | <?php |
||
5 | trait FilesTrait |
||
6 | { |
||
7 | /** |
||
8 | * Iterates files |
||
9 | * (internally uses \GlobIterator). |
||
10 | * |
||
11 | * <code> |
||
12 | * $files = p->files('/tmp/*.txt'); |
||
13 | * foreach ($files as $f) { |
||
14 | * echo $f .PHP_EOL; |
||
15 | * } |
||
16 | * </code> |
||
17 | * |
||
18 | * Use true to get a SplFileInfo object for each file: |
||
19 | * <code> |
||
20 | * $files = p->files('/tmp/*.txt'); |
||
21 | * </code> |
||
22 | * |
||
23 | * You can also pass any GlobIterator or FilesystemIterator flag |
||
24 | * |
||
25 | * <code> |
||
26 | * $files = p->files('/tmp/*.txt', \FilesystemIterator::FOLLOW_SYMLINKS); |
||
27 | * </code> |
||
28 | * |
||
29 | * You are incoraged to download and use Symfony Finder for any advanced need: |
||
30 | * |
||
31 | * <code> |
||
32 | * $finder = new Finder(); |
||
33 | * $iterator = $finder |
||
34 | * ->files() |
||
35 | * ->name('*.php') |
||
36 | * ->depth(0) |
||
37 | * ->size('>= 1K') |
||
38 | * ->in(__DIR__); |
||
39 | * |
||
40 | * // then you can use your new iterator with pipes :) |
||
41 | * p($iterator)->each(function () { |
||
42 | * //... do stuff |
||
43 | * }); |
||
44 | * |
||
45 | * </code> |
||
46 | * |
||
47 | * @param string $path any file wildcard (ie:/tmp/*.txt). Use the full path! |
||
48 | * @param int $flags any GlobIterator or FilesystemIterator flag |
||
49 | * |
||
50 | * @return \Pipes\Pipe |
||
51 | */ |
||
52 | public function files($path, $flags = \GlobIterator::CURRENT_AS_PATHNAME) |
||
60 | } |
||
61 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.