Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Finder] Show how to clone the finder to reuse its configuration#21375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
OskarStark merged 1 commit intosymfony:6.4fromjaviereguiluz:fix_21343
Sep 15, 2025
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletionscomponents/finder.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -43,9 +43,23 @@ The ``$file`` variable is an instance of

.. warning::

The ``Finder`` object doesn't reset its internal state automatically.
This means that you need to create a new instance if you do not want
to get mixed results.
The ``Finder`` object is stateful. Any method call will change all its
instances. If you need to perform several searches, create multiple instances
of ``Finder`` or clone it after setting the common configuration::

$finder = new Finder();
// first, configure the common options for the following searches
$finder->files()->in('./templates');

// then, clone the finder to create a new instance before searching for files
foreach ((clone $finder)->name('partial_*') as $file) {
echo('Processing partials config: ' . $file->getRelativePathname());
}

// without cloning, the previous ->name() call would affect this search
foreach ((clone $finder)->name('partial_*')->name('plugin_*') as $file) {
echo('Processing plugin config: ' . $file->getRelativePathname());
}

Searching for Files and Directories
-----------------------------------
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp