Skip to content

Commit 7dc4181

Browse files
minor #48793 Leverage arrow function syntax for closure (tigitz)
This PR was merged into the 6.3 branch. Discussion ---------- Leverage arrow function syntax for closure | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #47658 <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | <!-- required for new features --> Rationale in the RFC [here](https://wiki.php.net/rfc/arrow_functions_v2#introduction) It's also notable that using arrow function syntax rather than the classic one has been enforced in the past by symfony core member: symfony/symfony#48069 (comment) So this PR would be consistent. Commits ------- f5802d3a2a Leverage arrow function syntax for closure
2 parents 63a05f8 + 28c96f6 commit 7dc4181

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

Tests/LinkedInTransportTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ public function testSendWithEmptyArrayResponseThrowsTransportException()
5757
->method('getContent')
5858
->willReturn('[]');
5959

60-
$client = new MockHttpClient(static function () use ($response): ResponseInterface {
61-
return $response;
62-
});
60+
$client = new MockHttpClient(static fn (): ResponseInterface => $response);
6361

6462
$transport = $this->createTransport($client);
6563

@@ -82,9 +80,7 @@ public function testSendWithErrorResponseThrowsTransportException()
8280
->method('getContent')
8381
->willReturn('testErrorCode');
8482

85-
$client = new MockHttpClient(static function () use ($response): ResponseInterface {
86-
return $response;
87-
});
83+
$client = new MockHttpClient(static fn (): ResponseInterface => $response);
8884

8985
$transport = $this->createTransport($client);
9086

@@ -187,9 +183,7 @@ public function testSendWithInvalidOptions()
187183
{
188184
$this->expectException(LogicException::class);
189185

190-
$client = new MockHttpClient(function (string $method, string $url, array $options = []): ResponseInterface {
191-
return $this->createMock(ResponseInterface::class);
192-
});
186+
$client = new MockHttpClient(fn (string $method, string $url, array $options = []): ResponseInterface => $this->createMock(ResponseInterface::class));
193187

194188
$transport = $this->createTransport($client);
195189

0 commit comments

Comments
 (0)