8000 PHP CS Fixer: enable `@PHP8x1Migration:risky` by keradus · Pull Request #63198 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
FIX
  • Loading branch information
keradus committed Jan 28, 2026
commit f4c66ccf76585876d751b0a2e071f5cf7de4fc97
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ public function load(mixed $resource, ?string $type = null): mixed
$this->container?->fileExists($path);

// the closure forbids access to the private scope in the included file
$load = \Closure::bind(static fn ($file) => include $file, null, null);
$load = \Closure::bind(static function ($file) use ($loader) {
return include $file;
}, null, null);

$callback = $load($path);

Expand Down Expand Up @@ -99,3 +101,5 @@ private function callConfigurator(callable $callback, DefinitionConfigurator $co
final class ProtectedDefinitionFileLoader extends DefinitionFileLoader
{
}

// @php-cs-fixer-ignore use_arrow_functions to prevent arrow function overriding callback that includes file in limited context, ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9388
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ class_alias(AppReference::class, App::class);
}

// the closure forbids access to the private scope in the included file
$load = \Closure::bind(static fn ($path, $env) => include $path, null, null);
$load = \Closure::bind(static function ($path, $env) use ($container, $loader, $resource, $type) {
return include $path;
}, null, null);

$instanceof = $this->instanceof;
$this->instanceof = [];
Expand Down Expand Up @@ -205,3 +207,5 @@ private function callConfigurator(callable $callback, ContainerConfigurator $con
}
}
}

// @php-cs-fixer-ignore use_arrow_functions to prevent arrow function overriding callback that includes file in limited context, ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9388
6 changes: 5 additions & 1 deletion src/Symfony/Component/Routing/Loader/PhpFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class_alias(RoutesReference::class, Routes::class);

// the closure forbids access to the private scope in the included file
$loader = $this;
$load = \Closure::bind(static fn ($file) => include $file, null, null);
$load = \Closure::bind(static function ($file) use ($loader) {
return include $file;
}, null, null);

if (1 === $result = $load($path)) {
$result = null;
Expand Down Expand Up @@ -81,3 +83,5 @@ protected function callConfigurator(callable $callback, string $path, string $fi
return $collection;
}
}

// @php-cs-fixer-ignore use_arrow_functions to prevent arrow function overriding callback that includes file in limited context, ref https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/9388
Loading
0