Skip to content

Commit 0712726

Browse files
committed
Apply PHP 7.4 syntax
Signed-off-by: Abdul Malik Ikhsan <[email protected]>
1 parent a06ec97 commit 0712726

File tree

5 files changed

+13
-21
lines changed

5 files changed

+13
-21
lines changed

src/Controller.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ class Controller extends AbstractActionController
1717
/** @var ServerUrl */
1818
protected $serverUrlViewHelper;
1919

20-
/** @var BasePath|null */
21-
private $basePath;
20+
private ?BasePath $basePath;
2221

2322
public function __construct(ApiFactory $apiFactory, ServerUrl $serverUrlViewHelper, ?BasePath $basePath = null)
2423
{

src/View/AgAcceptHeaders.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ public function __invoke(Service $service)
2424
}
2525

2626
$view = $this->getView();
27-
$types = array_map(function ($type) use ($view) {
28-
return sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type));
29-
}, $requestAcceptTypes);
27+
$types = array_map(static fn($type) =>
28+
sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type)), $requestAcceptTypes);
3029
return implode("\n", $types);
3130
}
3231
}

src/View/AgContentTypeHeaders.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ public function __invoke(Service $service)
2424
}
2525

2626
$view = $this->getView();
27-
$types = array_map(function ($type) use ($view) {
28-
return sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type));
29-
}, $requestContentTypes);
27+
$types = array_map(static fn($type) =>
28+
sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type)), $requestContentTypes);
3029
return implode("\n", $types);
3130
}
3231
}

src/View/AgStatusCodes.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,11 @@ class AgStatusCodes extends AbstractHelper
1515
public function __invoke(Operation $operation)
1616
{
1717
$view = $this->getView();
18-
$statusCodes = array_map(function ($status) use ($view) {
19-
return sprintf(
20-
'<li class="list-group-item"><strong>%s:</strong> %s</li>',
21-
$view->escapeHtml($status['code']),
22-
$view->escapeHtml($status['message'])
23-
);
24-
}, $operation->getResponseStatusCodes());
18+
$statusCodes = array_map(static fn($status) => sprintf(
19+
'<li class="list-group-item"><strong>%s:</strong> %s</li>',
20+
$view->escapeHtml($status['code']),
21+
$view->escapeHtml($status['message'])
22+
), $operation->getResponseStatusCodes());
2523

2624
return sprintf("<ul class=\"list-group\">\n%s\n</ul>\n", implode("\n", $statusCodes));
2725
}

test/ControllerTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616

1717
class ControllerTest extends TestCase
1818
{
19-
/** @var MvcEvent */
20-
private $event;
19+
private MvcEvent $event;
2120

22-
/** @var ServerUrl */
23-
private $serverUrl;
21+
private ServerUrl $serverUrl;
2422

25-
/** @var BasePath */
26-
private $basePath;
23+
private BasePath $basePath;
2724

2825
/** @var ApiFactory|PHPUnit_Framework_MockObject_MockObject */
2926
private $apiFactory;

0 commit comments

Comments
 (0)