Skip to content

Commit

Permalink
fix phpstan errors
Browse files Browse the repository at this point in the history
  • Loading branch information
l0gicgate committed Nov 15, 2020
1 parent 7d1a1e8 commit e26f4a1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Slim/Handlers/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected function determineStatusCode(): int
* as willdurand/negotiation for any other situation.
*
* @param ServerRequestInterface $request
* @return string
* @return string|null
*/
protected function determineContentType(ServerRequestInterface $request): ?string
{
Expand All @@ -231,10 +231,15 @@ protected function determineContentType(ServerRequestInterface $request): ?strin
* when multiple content types are provided via Accept header.
*/
if ($current === 'text/plain' && $count > 1) {
return next($selectedContentTypes);
$next = next($selectedContentTypes);
if (is_string($next)) {
return $next;
}
}

return $current;
if (is_string($current)) {
return $current;
}
}

if (preg_match('/\+(json|xml)/', $acceptHeader, $matches)) {
Expand Down

0 comments on commit e26f4a1

Please sign in to comment.