Skip to content

Commit

Permalink
Fix global function scoping
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonmccreary committed Jun 14, 2024
1 parent fdf9f19 commit 0bda7ea
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scoper.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@
declare(strict_types=1);

return [
'expose-global-functions' => false,
// 'exclude-functions' => ['app'],
'expose-global-functions' => true,
'patchers' => [
function (string $filePath, string $prefix, string $content): string {
// Remove from any `app` path strings
if (\str_contains($content, $prefix . '\\app')) {
$content = \preg_replace(
'/' . $prefix . '[\\\\]+app' . '/',
'/' . $prefix . '\\\\+app' . '/',
'app',
$content
);
}

// Remove from any common class references within Tasks
if (\str_starts_with($filePath, 'src/Tasks/')) {
$content = \str_replace(
$prefix . '\\\\Illuminate\\\\',
Expand Down Expand Up @@ -48,6 +49,6 @@ function (string $filePath, string $prefix, string $content): string {
'vendor/symfony/polyfill-intl-grapheme/bootstrap.php',
],
'exclude-namespaces' => [
'Symfony\Polyfill\*',
'Symfony\\Polyfill\\*',
],
];

0 comments on commit 0bda7ea

Please sign in to comment.