Skip to content

Commit

Permalink
Add example of excluded files collected with the Finder (#768)
Browse files Browse the repository at this point in the history
Closes #407
  • Loading branch information
theofidry authored Nov 13, 2022
1 parent 8ba7d27 commit f7c0a26
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit f7c0a26

Please sign in to comment.