Update codestyle based on updated Symfony rules (#229)
This commit is contained in:
parent
e485fde727
commit
c081b90d74
8 changed files with 165 additions and 168 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 [
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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).',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue