@@ -49,9 +49,8 @@ class Finder implements \IteratorAggregate, \Countable
49
49
/**
50
50
* Begins search for files matching mask and all directories.
51
51
* @param string|string[] $masks
52
- * @return static
53
52
*/
54
- public static function find (...$ masks ): self
53
+ public static function find (...$ masks ): static
55
54
{
56
55
$ masks = $ masks && is_array ($ masks [0 ]) ? $ masks [0 ] : $ masks ;
57
56
return (new static )->select ($ masks , 'isDir ' )->select ($ masks , 'isFile ' );
@@ -61,9 +60,8 @@ public static function find(...$masks): self
61
60
/**
62
61
* Begins search for files matching mask.
63
62
* @param string|string[] $masks
64
- * @return static
65
63
*/
66
- public static function findFiles (...$ masks ): self
64
+ public static function findFiles (...$ masks ): static
67
65
{
68
66
$ masks = $ masks && is_array ($ masks [0 ]) ? $ masks [0 ] : $ masks ;
69
67
return (new static )->select ($ masks , 'isFile ' );
@@ -73,9 +71,8 @@ public static function findFiles(...$masks): self
73
71
/**
74
72
* Begins search for directories matching mask.
75
73
* @param string|string[] $masks
76
- * @return static
77
74
*/
78
- public static function findDirectories (...$ masks ): self
75
+ public static function findDirectories (...$ masks ): static
79
76
{
80
77
$ masks = $ masks && is_array ($ masks [0 ]) ? $ masks [0 ] : $ masks ;
81
78
return (new static )->select ($ masks , 'isDir ' );
@@ -84,9 +81,8 @@ public static function findDirectories(...$masks): self
84
81
85
82
/**
86
83
* Creates filtering group by mask & type selector.
87
- * @return static
88
84
*/
89
- private function select (array $ masks , string $ type ): self
85
+ private function select (array $ masks , string $ type ): static
90
86
{
91
87
$ this ->cursor = &$ this ->groups [];
92
88
$ pattern = self ::buildPattern ($ masks );
@@ -100,9 +96,8 @@ private function select(array $masks, string $type): self
100
96
/**
101
97
* Searches in the given folder(s).
102
98
* @param string|string[] $paths
103
- * @return static
104
99
*/
105
- public function in (...$ paths ): self
100
+ public function in (...$ paths ): static
106
101
{
107
102
$ this ->maxDepth = 0 ;
108
103
return $ this ->from (...$ paths );
@@ -112,9 +107,8 @@ public function in(...$paths): self
112
107
/**
113
108
* Searches recursively from the given folder(s).
114
109
* @param string|string[] $paths
115
- * @return static
116
110
*/
117
- public function from (...$ paths ): self
111
+ public function from (...$ paths ): static
118
112
{
119
113
if ($ this ->paths ) {
120
114
throw new Nette \InvalidStateException ('Directory to search has already been specified. ' );
@@ -127,9 +121,8 @@ public function from(...$paths): self
127
121
128
122
/**
129
123
* Shows folder content prior to the folder.
130
- * @return static
131
124
*/
132
- public function childFirst (): self
125
+ public function childFirst (): static
133
126
{
134
127
$ this ->order = RecursiveIteratorIterator::CHILD_FIRST ;
135
128
return $ this ;
@@ -248,9 +241,8 @@ private function buildIterator(string $path): \Iterator
248
241
* Restricts the search using mask.
249
242
* Excludes directories from recursive traversing.
250
243
* @param string|string[] $masks
251
- * @return static
252
244
*/
253
- public function exclude (...$ masks ): self
245
+ public function exclude (...$ masks ): static
254
246
{
255
247
$ masks = $ masks && is_array ($ masks [0 ]) ? $ masks [0 ] : $ masks ;
256
248
$ pattern = self ::buildPattern ($ masks );
@@ -264,9 +256,8 @@ public function exclude(...$masks): self
264
256
/**
265
257
* Restricts the search using callback.
266
258
* @param callable $callback function (RecursiveDirectoryIterator $file): bool
267
- * @return static
268
259
*/
269
- public function filter (callable $ callback ): self
260
+ public function filter (callable $ callback ): static
270
261
{
271
262
$ this ->cursor [] = $ callback ;
272
263
return $ this ;
@@ -275,9 +266,8 @@ public function filter(callable $callback): self
275
266
276
267
/**
277
268
* Limits recursion level.
278
- * @return static
279
269
*/
280
- public function limitDepth (int $ depth ): self
270
+ public function limitDepth (int $ depth ): static
281
271
{
282
272
$ this ->maxDepth = $ depth ;
283
273
return $ this ;
@@ -287,9 +277,8 @@ public function limitDepth(int $depth): self
287
277
/**
288
278
* Restricts the search by size.
289
279
* @param string $operator "[operator] [size] [unit]" example: >=10kB
290
- * @return static
291
280
*/
292
- public function size (string $ operator , int $ size = null ): self
281
+ public function size (string $ operator , int $ size = null ): static
293
282
{
294
283
if (func_num_args () === 1 ) { // in $operator is predicate
295
284
if (!preg_match ('#^(?:([=<>!]=?|<>)\s*)?((?:\d*\.)?\d+)\s*(K|M|G|)B?$#Di ' , $ operator , $ matches )) {
@@ -307,10 +296,8 @@ public function size(string $operator, int $size = null): self
307
296
/**
308
297
* Restricts the search by modified time.
309
298
* @param string $operator "[operator] [date]" example: >1978-01-23
310
- * @param string|int|\DateTimeInterface $date
311
- * @return static
312
299
*/
313
- public function date (string $ operator , $ date = null ): self
300
+ public function date (string $ operator , string | int | \ DateTimeInterface $ date = null ): static
314
301
{
315
302
if (func_num_args () === 1 ) { // in $operator is predicate
316
303
if (!preg_match ('#^(?:([=<>!]=?|<>)\s*)?(.+)$#Di ' , $ operator , $ matches )) {
0 commit comments