Skip to content

Commit

Permalink
Fix code style to make phpcs and phpstan happy
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Jun 25, 2020
1 parent 8ae16b7 commit a14fcec
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/BodyOnlyFormatter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Lcobucci\ContentNegotiation;
Expand All @@ -18,5 +17,8 @@ public function format(UnformattedResponse $response, StreamFactoryInterface $st
return $response->withBody($this->formatBody($response, $streamFactory));
}

abstract protected function formatBody(UnformattedResponse $response, StreamFactoryInterface $streamFactory): StreamInterface;
abstract protected function formatBody(
UnformattedResponse $response,
StreamFactoryInterface $streamFactory
): StreamInterface;
}
5 changes: 4 additions & 1 deletion src/ContentFormatter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Lcobucci\ContentNegotiation;
Expand All @@ -16,5 +15,9 @@ protected function formatBody(UnformattedResponse $response, StreamFactoryInterf
);
}

/**
* @param mixed $content
* @param mixed[] $attributes
*/
abstract protected function formatContent($content, array $attributes = []): string;
}
2 changes: 1 addition & 1 deletion src/ContentTypeMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private function extractContentType(string $contentType): string

private function getNotAcceptableFormatter(): Formatter
{
if (empty($this->formatters[self::NOT_ACCEPTABLE])) {
if (! isset($this->formatters[self::NOT_ACCEPTABLE])) {
$this->formatters[self::NOT_ACCEPTABLE] = new NotAcceptableFormatter();
}

Expand Down
1 change: 0 additions & 1 deletion src/NotAcceptableFormatter.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

declare(strict_types=1);

namespace Lcobucci\ContentNegotiation;
Expand Down
3 changes: 2 additions & 1 deletion tests/Formatter/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public function constructorShouldAllowTheConfigurationOfEncodingFlags(): void
{
self::assertSame(
'["<foo>","\'bar\'","\"baz\"","&blong&","\u00e9","http://"]',
(new Json(JSON_UNESCAPED_SLASHES))->formatContent(['<foo>', "'bar'", '"baz"', '&blong&', "\xc3\xa9", 'http://'])
(new Json(JSON_UNESCAPED_SLASHES))
->formatContent(['<foo>', "'bar'", '"baz"', '&blong&', "\xc3\xa9", 'http://'])
);
}

Expand Down

0 comments on commit a14fcec

Please sign in to comment.