Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply PHP 7.4 syntax #30

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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