Skip to content

Commit

Permalink
Apply PHP 7.4 syntax
Browse files Browse the repository at this point in the history
Signed-off-by: Abdul Malik Ikhsan <[email protected]>
  • Loading branch information
samsonasik committed Jan 19, 2022
1 parent a06ec97 commit 0712726
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class Controller extends AbstractActionController
/** @var ServerUrl */
protected $serverUrlViewHelper;

/** @var BasePath|null */
private $basePath;
private ?BasePath $basePath;

public function __construct(ApiFactory $apiFactory, ServerUrl $serverUrlViewHelper, ?BasePath $basePath = null)
{
Expand Down
5 changes: 2 additions & 3 deletions src/View/AgAcceptHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ public function __invoke(Service $service)
}

$view = $this->getView();
$types = array_map(function ($type) use ($view) {
return sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type));
}, $requestAcceptTypes);
$types = array_map(static fn($type) =>
sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type)), $requestAcceptTypes);
return implode("\n", $types);
}
}
5 changes: 2 additions & 3 deletions src/View/AgContentTypeHeaders.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ public function __invoke(Service $service)
}

$view = $this->getView();
$types = array_map(function ($type) use ($view) {
return sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type));
}, $requestContentTypes);
$types = array_map(static fn($type) =>
sprintf('<div class="list-group-item">%s</div>', $view->escapeHtml($type)), $requestContentTypes);
return implode("\n", $types);
}
}
12 changes: 5 additions & 7 deletions src/View/AgStatusCodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ class AgStatusCodes extends AbstractHelper
public function __invoke(Operation $operation)
{
$view = $this->getView();
$statusCodes = array_map(function ($status) use ($view) {
return sprintf(
'<li class="list-group-item"><strong>%s:</strong> %s</li>',
$view->escapeHtml($status['code']),
$view->escapeHtml($status['message'])
);
}, $operation->getResponseStatusCodes());
$statusCodes = array_map(static fn($status) => sprintf(
'<li class="list-group-item"><strong>%s:</strong> %s</li>',
$view->escapeHtml($status['code']),
$view->escapeHtml($status['message'])
), $operation->getResponseStatusCodes());

return sprintf("<ul class=\"list-group\">\n%s\n</ul>\n", implode("\n", $statusCodes));
}
Expand Down
9 changes: 3 additions & 6 deletions test/ControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,11 @@

class ControllerTest extends TestCase
{
/** @var MvcEvent */
private $event;
private MvcEvent $event;

/** @var ServerUrl */
private $serverUrl;
private ServerUrl $serverUrl;

/** @var BasePath */
private $basePath;
private BasePath $basePath;

/** @var ApiFactory|PHPUnit_Framework_MockObject_MockObject */
private $apiFactory;
Expand Down

0 comments on commit 0712726

Please sign in to comment.