Skip to content

Commit 920cf15

Browse files
committed
Update codestyle based on updated Symfony rules
1 parent e485fde commit 920cf15

33 files changed

+165
-168
lines changed

examples/server/bootstrap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
require_once dirname(__DIR__, 2).'/vendor/autoload.php';
2323

24-
set_exception_handler(function (Throwable $t): never {
24+
set_exception_handler(static function (Throwable $t): never {
2525
logger()->critical('Uncaught exception: '.$t->getMessage(), ['exception' => $t]);
2626

2727
exit(1);

examples/server/client-communication/server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
->setCapabilities(new ServerCapabilities(logging: true, tools: true))
2828
->setDiscovery(__DIR__)
2929
->addTool(
30-
function (RequestContext $context, string $dataset): array {
30+
static function (RequestContext $context, string $dataset): array {
3131
$client = $context->getClientGateway();
3232
$client->log(LoggingLevel::Info, sprintf('Running quality checks on dataset "%s"', $dataset));
3333

examples/server/custom-dependencies/Service/InMemoryTaskRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function addTask(string $userId, string $description): array
5050

5151
public function getTasksForUser(string $userId): array
5252
{
53-
return array_values(array_filter($this->tasks, fn ($task) => $task['userId'] === $userId && !$task['completed']));
53+
return array_values(array_filter($this->tasks, static fn ($task) => $task['userId'] === $userId && !$task['completed']));
5454
}
5555

5656
public function getAllTasks(): array

examples/server/custom-dependencies/Service/SystemStatsService.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function __construct(
2121
public function getSystemStats(): array
2222
{
2323
$allTasks = $this->taskRepository->getAllTasks();
24-
$completed = \count(array_filter($allTasks, fn ($task) => $task['completed']));
24+
$completed = \count(array_filter($allTasks, static fn ($task) => $task['completed']));
2525
$pending = \count($allTasks) - $completed;
2626

2727
return [

examples/server/discovery-userprofile/UserIdCompletionProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ final class UserIdCompletionProvider implements ProviderInterface
1919

2020
public function getCompletions(string $currentValue): array
2121
{
22-
return array_filter(self::AVAILABLE_USER_IDS, fn (string $userId) => str_contains($userId, $currentValue));
22+
return array_filter(self::AVAILABLE_USER_IDS, static fn (string $userId) => str_contains($userId, $currentValue));
2323
}
2424
}

examples/server/discovery-userprofile/server.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
->setSession(new FileSessionStore(__DIR__.'/sessions'))
2424
->setDiscovery(__DIR__)
2525
->addTool(
26-
function (float $a, float $b, string $operation = 'add'): array {
26+
static function (float $a, float $b, string $operation = 'add'): array {
2727
$result = match ($operation) {
2828
'add' => $a + $b,
2929
'subtract' => $a - $b,
@@ -42,7 +42,7 @@ function (float $a, float $b, string $operation = 'add'): array {
4242
description: 'Perform basic math operations (add, subtract, multiply, divide)'
4343
)
4444
->addResource(
45-
function (): array {
45+
static function (): array {
4646
$memoryUsage = memory_get_usage(true);
4747
$memoryPeak = memory_get_peak_usage(true);
4848
$uptime = time() - ($_SERVER['REQUEST_TIME_FLOAT'] ?? time());

examples/server/env-variables/EnvToolHandler.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public function processData(string $input): array
6464
'processed_input_length' => \strlen($input),
6565
'message' => 'Processed in PRODUCTION mode (summary only).',
6666
];
67-
} else {
68-
return [
69-
'mode' => $appMode ?: 'default',
70-
'original_input' => $input,
71-
'message' => 'Processed in default mode (APP_MODE not recognized or not set).',
72-
];
7367
}
68+
69+
return [
70+
'mode' => $appMode ?: 'default',
71+
'original_input' => $input,
72+
'message' => 'Processed in default mode (APP_MODE not recognized or not set).',
73+
];
7474
}
7575
}

examples/server/schema-showcase/SchemaShowcaseElements.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,10 @@ enum: ['sort', 'reverse', 'shuffle', 'deduplicate', 'filter_short', 'filter_long
267267
$processed = array_unique($processed);
268268
break;
269269
case 'filter_short':
270-
$processed = array_filter($processed, fn ($item) => \strlen($item) <= 10);
270+
$processed = array_filter($processed, static fn ($item) => \strlen($item) <= 10);
271271
break;
272272
case 'filter_long':
273-
$processed = array_filter($processed, fn ($item) => \strlen($item) > 10);
273+
$processed = array_filter($processed, static fn ($item) => \strlen($item) > 10);
274274
break;
275275
}
276276

src/Capability/Completion/EnumCompletionProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(string $enumClass)
3333
}
3434

3535
$this->values = array_map(
36-
fn ($case) => isset($case->value) && \is_string($case->value) ? $case->value : $case->name,
36+
static fn ($case) => isset($case->value) && \is_string($case->value) ? $case->value : $case->name,
3737
$enumClass::cases()
3838
);
3939
}
@@ -46,7 +46,7 @@ public function getCompletions(string $currentValue): array
4646

4747
return array_values(array_filter(
4848
$this->values,
49-
fn (string $value) => str_starts_with($value, $currentValue)
49+
static fn (string $value) => str_starts_with($value, $currentValue)
5050
));
5151
}
5252
}

src/Capability/Completion/ListCompletionProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function getCompletions(string $currentValue): array
3232

3333
return array_values(array_filter(
3434
$this->values,
35-
fn (string $value) => str_starts_with($value, $currentValue)
35+
static fn (string $value) => str_starts_with($value, $currentValue)
3636
));
3737
}
3838
}

0 commit comments

Comments
 (0)