mirror of
https://github.com/symfony/web-profiler-bundle.git
synced 2026-03-24 00:02:13 +01:00
PHP CS Fixer: enable static_lambda
This commit is contained in:
committed by
Nicolas Grekas
parent
f189d57ab3
commit
d3d029e3f6
@@ -72,7 +72,7 @@ class ProfilerController
|
||||
$page = $request->query->get('page', 'home');
|
||||
$profileType = $request->query->get('type', 'request');
|
||||
|
||||
if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null, null, fn ($profile) => $profileType === $profile['virtual_type']))) {
|
||||
if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null, null, static fn ($profile) => $profileType === $profile['virtual_type']))) {
|
||||
$token = $latest['token'];
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ class ProfilerController
|
||||
'request' => $request,
|
||||
'token' => $token,
|
||||
'profile' => $profile,
|
||||
'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode, fn ($profile) => $profileType === $profile['virtual_type']),
|
||||
'tokens' => $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode, static fn ($profile) => $profileType === $profile['virtual_type']),
|
||||
'ip' => $ip,
|
||||
'method' => $method,
|
||||
'status_code' => $statusCode,
|
||||
@@ -293,7 +293,7 @@ class ProfilerController
|
||||
return new RedirectResponse($this->generator->generate('_profiler', ['token' => $token]), 302, ['Content-Type' => 'text/html']);
|
||||
}
|
||||
|
||||
$tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode, fn ($profile) => $profileType === $profile['virtual_type']);
|
||||
$tokens = $this->profiler->find($ip, $url, $limit, $method, $start, $end, $statusCode, static fn ($profile) => $profileType === $profile['virtual_type']);
|
||||
|
||||
return new RedirectResponse($this->generator->generate('_profiler_search_results', [
|
||||
'token' => $tokens ? $tokens[0]['token'] : 'empty',
|
||||
|
||||
@@ -179,7 +179,7 @@ class ContentSecurityPolicyHandler
|
||||
*/
|
||||
private function generateCspHeader(array $directives): string
|
||||
{
|
||||
return array_reduce(array_keys($directives), fn ($res, $name) => ('' !== $res ? $res.'; ' : '').\sprintf('%s %s', $name, implode(' ', $directives[$name])), '');
|
||||
return array_reduce(array_keys($directives), static fn ($res, $name) => ('' !== $res ? $res.'; ' : '').\sprintf('%s %s', $name, implode(' ', $directives[$name])), '');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
return function (RoutingConfigurator $routes): void {
|
||||
return static function (RoutingConfigurator $routes): void {
|
||||
$routes->add('_profiler_home', '/')
|
||||
->controller('web_profiler.controller.profiler::homeAction')
|
||||
;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
|
||||
return function (RoutingConfigurator $routes): void {
|
||||
return static function (RoutingConfigurator $routes): void {
|
||||
$routes->add('_wdt_stylesheet', '/styles')
|
||||
->controller('web_profiler.controller.profiler::toolbarStylesheetAction')
|
||||
;
|
||||
|
||||
@@ -212,7 +212,7 @@ class ProfilerControllerTest extends WebTestCase
|
||||
$profiler
|
||||
->expects($this->exactly(2))
|
||||
->method('loadProfile')
|
||||
->willReturnCallback(fn ($token) => 'found' == $token ? new Profile($token) : null)
|
||||
->willReturnCallback(static fn ($token) => 'found' == $token ? new Profile($token) : null)
|
||||
;
|
||||
|
||||
$controller = $this->createController($profiler, $twig, $withCsp);
|
||||
@@ -554,7 +554,7 @@ class ProfilerControllerTest extends WebTestCase
|
||||
->with($expectedTemplate);
|
||||
|
||||
$this
|
||||
->createController($profiler, $twig, false, array_map(function (string $collectorName) use ($expectedPanel, $expectedTemplate): array {
|
||||
->createController($profiler, $twig, false, array_map(static function (string $collectorName) use ($expectedPanel, $expectedTemplate): array {
|
||||
if ($collectorName === $expectedPanel) {
|
||||
return [$expectedPanel, $expectedTemplate];
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class RouterControllerTest extends WebTestCase
|
||||
|
||||
$matchedRouteCell = $crawler
|
||||
->filter('#router-logs .status-success td')
|
||||
->reduce(function (Crawler $td) use ($path): bool {
|
||||
->reduce(static function (Crawler $td) use ($path): bool {
|
||||
return $td->text() === $path;
|
||||
});
|
||||
|
||||
|
||||
@@ -411,7 +411,7 @@ class WebDebugToolbarListenerTest extends TestCase
|
||||
|
||||
$request = new Request();
|
||||
$response = new EventStreamResponse(
|
||||
fn () => yield new ServerEvent('some data'),
|
||||
static fn () => yield new ServerEvent('some data'),
|
||||
headers: [
|
||||
'X-Debug-Token' => 'aabbcc',
|
||||
'X-Debug-Token-Link' => 'test://foobar',
|
||||
@@ -448,7 +448,7 @@ class WebDebugToolbarListenerTest extends TestCase
|
||||
|
||||
$request = new Request();
|
||||
$response = new EventStreamResponse(
|
||||
function () {
|
||||
static function () {
|
||||
yield new ServerEvent('some data');
|
||||
throw new \RuntimeException('Something went wrong');
|
||||
},
|
||||
|
||||
@@ -33,6 +33,6 @@ class IconTest extends TestCase
|
||||
|
||||
public static function provideIconFilePaths(): array
|
||||
{
|
||||
return array_map(fn ($filePath) => (array) $filePath, glob(__DIR__.'/../../Resources/views/Icon/*.svg'));
|
||||
return array_map(static fn ($filePath) => (array) $filePath, glob(__DIR__.'/../../Resources/views/Icon/*.svg'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user