@@ -197,14 +197,31 @@ Restrict files by name with the
197
197
198
198
$finder->files()->name('*.php');
199
199
200
- The ``name() `` method accepts globs, strings, or regexes::
200
+ The ``name() `` method accepts globs, strings, regexes or an array of globs, strings or regexes::
201
201
202
202
$finder->files()->name('/\.php$/');
203
203
204
+ Multiple files names can be defined by chaining calls or using an array as parameter::
205
+
206
+ $finder->files()->name('*.php')->name('*.twig');
207
+
208
+ // same as above
209
+ $finder->files()->name(array('*.php', '*.twig'));
210
+
204
211
The ``notName() `` method excludes files matching a pattern::
205
212
206
213
$finder->files()->notName('*.rb');
207
214
215
+ Multiple files names can be excluded by chaining calls or using an array as parameter::
216
+
217
+ $finder->files()->notName('*.rb')->notName('*.py');
218
+
219
+ // same as above
220
+ $finder->files()->notName(array('*.rb', '*.py'));
221
+
222
+ .. versionadded :: 4.2
223
+ Passing an array as parameter for method ``name() `` and ``notName() `` was introduced in Symfony 4.2
224
+
208
225
File Contents
209
226
~~~~~~~~~~~~~
210
227
@@ -234,11 +251,21 @@ Restrict files and directories by path with the
234
251
235
252
On all platforms slash (i.e. ``/ ``) should be used as the directory separator.
236
253
237
- The ``path() `` method accepts a string or a regular expression::
254
+ The ``path() `` method accepts a string, a regular expression or an array of strings or regulars expressions ::
238
255
239
256
$finder->path('foo/bar');
240
257
$finder->path('/^foo\/bar/');
241
258
259
+ Multiple paths can be defined by chaining calls or using an array as parameter::
260
+
261
+ $finder->path('data')->path('foo/bar');
262
+
263
+ // same as above
264
+ $finder->path(array('data', 'foo/bar'));
265
+
266
+ .. versionadded :: 4.2
267
+ Passing an array as parameter for method ``path() `` and ``notPath() `` was introduced in Symfony 4.2
268
+
242
269
Internally, strings are converted into regular expressions by escaping slashes
243
270
and adding delimiters:
244
271
@@ -251,6 +278,16 @@ The :method:`Symfony\\Component\\Finder\\Finder::notPath` method excludes files
251
278
252
279
$finder->notPath('other/dir');
253
280
281
+ Multiple paths can be excluded by chaining calls or using an array as parameter::
282
+
283
+ $finder->notPath('first/dir')->notPath('other/dir');
284
+
285
+ // same as above
286
+ $finder->notPath(array('first/dir', 'other/dir'));
287
+
288
+ .. versionadded :: 4.2
289
+ Passing an array as method parameter was introduced in Symfony 4.2
290
+
254
291
File Size
255
292
~~~~~~~~~
256
293
@@ -259,10 +296,16 @@ Restrict files by size with the
259
296
260
297
$finder->files()->size('< 1.5K');
261
298
262
- Restrict by a size range by chaining calls::
299
+ Restrict by a size range by chaining calls or using an array as argument ::
263
300
264
301
$finder->files()->size('>= 1K')->size('<= 2K');
265
302
303
+ // same as above
304
+ $finder->files()->size(array('>= 1K', '<= 2K'));
305
+
306
+ .. versionadded :: 4.2
307
+ Passing an array as method parameter was introduced in Symfony 4.2
308
+
266
309
The comparison operator can be any of the following: ``> ``, ``>= ``, ``< ``, ``<= ``,
267
310
``== ``, ``!= ``.
268
311
@@ -278,6 +321,16 @@ Restrict files by last modified dates with the
278
321
279
322
$finder->date('since yesterday');
280
323
324
+ Restrict by a date range by chaining calls or using an array as argument::
325
+
326
+ $finder->date('>= 2018-01-01')->size('<= 2018-12-31');
327
+
328
+ // same as above
329
+ $finder->date(array('>= 2018-01-01', '<= 2018-12-31'));
330
+
331
+ .. versionadded :: 4.2
332
+ Passing an array as method parameter was introduced in Symfony 4.2
333
+
281
334
The comparison operator can be any of the following: ``> ``, ``>= ``, ``< ``, ``<= ``,
282
335
``== ``. You can also use ``since `` or ``after `` as an alias for ``> ``, and
283
336
``until `` or ``before `` as an alias for ``< ``.
@@ -293,6 +346,16 @@ traversing with :method:`Symfony\\Component\\Finder\\Finder::depth`::
293
346
$finder->depth('== 0');
294
347
$finder->depth('< 3');
295
348
349
+ Restrict by a depth range by chaining calls or using an array as argument::
350
+
351
+ $finder->depth('> 2')->depth('< 5');
352
+
353
+ // same as above
354
+ $finder->depth(array('> 2', '< 5'));
355
+
356
+ .. versionadded :: 4.2
357
+ Passing an array as method parameter was introduced in Symfony 4.2
358
+
296
359
Custom Filtering
297
360
~~~~~~~~~~~~~~~~
298
361
0 commit comments