Skip to content

Commit 16c166c

Browse files
authored
refactor: move to first class callable (#94)
Matches rector 2.2.4
1 parent 2323869 commit 16c166c

File tree

6 files changed

+6
-7
lines changed

6 files changed

+6
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"orchestra/testbench": "^8.36.0|^9.15.0|^10.6.0",
3636
"pestphp/pest": "^2.36.0|^3.8.4|^4.1.0",
3737
"phpstan/phpstan": "^2.1.27",
38-
"rector/rector": "^2.1.7"
38+
"rector/rector": "^2.2.4"
3939
},
4040
"autoload": {
4141
"psr-4": {

rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
codingStyle: true,
2222
typeDeclarations: true,
2323
earlyReturn: true,
24-
strictBooleans: true,
2524
)->withPhpSets(php81: true);

src/Server.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public function start(): void
144144
{
145145
$this->boot();
146146

147-
$this->transport->onReceive(fn (string $message) => $this->handle($message));
147+
$this->transport->onReceive($this->handle(...));
148148
}
149149

150150
protected function boot(): void

src/Server/Middleware/ReorderJsonAccept.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function handle(Request $request, Closure $next): Response
1919
{
2020
$accept = $request->header('Accept');
2121
if (is_string($accept) && str_contains($accept, ',')) {
22-
$accept = array_map('trim', explode(',', $accept));
22+
$accept = array_map(trim(...), explode(',', $accept));
2323
}
2424

2525
if (! is_array($accept)) {

src/Server/Tool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function toArray(): array
6363
'title' => $this->title(),
6464
'description' => $this->description(),
6565
'inputSchema' => JsonSchema::object(
66-
fn (JsonSchema $schema): array => $this->schema($schema),
66+
$this->schema(...),
6767
)->toArray(),
6868
'annotations' => $annotations === [] ? (object) [] : $annotations,
6969
];

tests/Unit/Server/Middleware/ReorderJsonAcceptTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
$middleware->handle($request, fn ($req): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response => response('test'));
5757

5858
$accept = $request->header('Accept');
59-
$parts = array_map('trim', explode(',', $accept));
59+
$parts = array_map(trim(...), explode(',', $accept));
6060

6161
expect($parts)->toMatchArray(['application/json', 'text/html', 'application/vnd.api+json', 'text/plain'])
6262
->and(count($parts))->toBe(4);
@@ -71,7 +71,7 @@
7171
$middleware->handle($request, fn ($req): \Illuminate\Contracts\Routing\ResponseFactory|\Illuminate\Http\Response => response('test'));
7272

7373
$accept = $request->header('Accept');
74-
$parts = array_map('trim', explode(',', $accept));
74+
$parts = array_map(trim(...), explode(',', $accept));
7575

7676
expect($parts[0])->toBe('application/json;q=0.8');
7777
});

0 commit comments

Comments
 (0)