Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add example of excluded files collected with the Finder #768

Merged
merged 2 commits into from
Nov 13, 2022
Merged
Changes from all 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
11 changes: 11 additions & 0 deletions src/scoper.inc.php.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ use Isolated\Symfony\Component\Finder\Finder;
// to auto-load any code here: it can result in a conflict or even corrupt
// the PHP-Scoper analysis.

// Example of collecting files to include in the scoped build but to not scope
// leveraging the isolated finder.
$excludedFiles = array_map(
static fn (SplFileInfo $fileInfo) => $fileInfo->getPathName(),
iterator_to_array(
Finder::create()->files()->in(__DIR__),
false,
),
);

return [
// The prefix configuration. If a non-null value is used, a random prefix
// will be generated instead.
Expand Down Expand Up @@ -57,6 +67,7 @@ return [
// For more see: https://github.com/humbug/php-scoper/blob/master/docs/configuration.md#patchers
'exclude-files' => [
// 'src/a-whitelisted-file.php',
...$excludedFiles,
],

// When scoping PHP files, there will be scenarios where some of the code being scoped indirectly references the
Expand Down