Update codestyle based on updated Symfony rules (#229)

This commit is contained in:
Christopher Hertel 2026-02-01 11:54:31 +01:00 • committed by GitHub
commit c081b90d74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 165 additions and 168 deletions

View file

@ -21,7 +21,7 @@ use Psr\Log\LoggerInterface;
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
set_exception_handler(function (Throwable $t): never {
set_exception_handler(static function (Throwable $t): never {
logger()->critical('Uncaught exception: '.$t->getMessage(), ['exception' => $t]);
exit(1);

View file

@ -27,7 +27,7 @@ $server = Server::builder()
->setCapabilities(new ServerCapabilities(logging: true, tools: true))
->setDiscovery(__DIR__)
->addTool(
function (RequestContext $context, string $dataset): array {
static function (RequestContext $context, string $dataset): array {
$client = $context->getClientGateway();
$client->log(LoggingLevel::Info, sprintf('Running quality checks on dataset "%s"', $dataset));

View file

@ -50,7 +50,7 @@ final class InMemoryTaskRepository implements TaskRepositoryInterface
public function getTasksForUser(string $userId): array
{
return array_values(array_filter($this->tasks, fn ($task) => $task['userId'] === $userId && !$task['completed']));
return array_values(array_filter($this->tasks, static fn ($task) => $task['userId'] === $userId && !$task['completed']));
}
public function getAllTasks(): array

View file

@ -21,7 +21,7 @@ final class SystemStatsService implements StatsServiceInterface
public function getSystemStats(): array
{
$allTasks = $this->taskRepository->getAllTasks();
$completed = \count(array_filter($allTasks, fn ($task) => $task['completed']));
$completed = \count(array_filter($allTasks, static fn ($task) => $task['completed']));
$pending = \count($allTasks) - $completed;
return [

View file

@ -19,6 +19,6 @@ final class UserIdCompletionProvider implements ProviderInterface
public function getCompletions(string $currentValue): array
{
return array_filter(self::AVAILABLE_USER_IDS, fn (string $userId) => str_contains($userId, $currentValue));
return array_filter(self::AVAILABLE_USER_IDS, static fn (string $userId) => str_contains($userId, $currentValue));
}
}

View file

@ -23,7 +23,7 @@ $server = Server::builder()
->setSession(new FileSessionStore(__DIR__.'/sessions'))
->setDiscovery(__DIR__)
->addTool(
function (float $a, float $b, string $operation = 'add'): array {
static function (float $a, float $b, string $operation = 'add'): array {
$result = match ($operation) {
'add' => $a + $b,
'subtract' => $a - $b,
@ -42,7 +42,7 @@ $server = Server::builder()
description: 'Perform basic math operations (add, subtract, multiply, divide)'
)
->addResource(
function (): array {
static function (): array {
$memoryUsage = memory_get_usage(true);
$memoryPeak = memory_get_peak_usage(true);
$uptime = time() - ($_SERVER['REQUEST_TIME_FLOAT'] ?? time());

View file

@ -64,12 +64,12 @@ final class EnvToolHandler
'processed_input_length' => \strlen($input),
'message' => 'Processed in PRODUCTION mode (summary only).',
];
} else {
return [
'mode' => $appMode ?: 'default',
'original_input' => $input,
'message' => 'Processed in default mode (APP_MODE not recognized or not set).',
];
}
return [
'mode' => $appMode ?: 'default',
'original_input' => $input,
'message' => 'Processed in default mode (APP_MODE not recognized or not set).',
];
}
}

View file

@ -267,10 +267,10 @@ final class SchemaShowcaseElements
$processed = array_unique($processed);
break;
case 'filter_short':
$processed = array_filter($processed, fn ($item) => \strlen($item) <= 10);
$processed = array_filter($processed, static fn ($item) => \strlen($item) <= 10);
break;
case 'filter_long':
$processed = array_filter($processed, fn ($item) => \strlen($item) > 10);
$processed = array_filter($processed, static fn ($item) => \strlen($item) > 10);
break;
}