From 68938586e567603ea47e08846b8bcaf09e42afd2 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2020 16:01:25 +0000 Subject: [PATCH] Update lcobucci/coding-standard requirement from ^4.0 to ^5.0 Updates the requirements on [lcobucci/coding-standard](https://github.com/lcobucci/coding-standard) to permit the latest version. - [Release notes](https://github.com/lcobucci/coding-standard/releases) - [Commits](https://github.com/lcobucci/coding-standard/compare/4.0.0...5.0.0) Signed-off-by: dependabot-preview[bot] --- composer.json | 2 +- src/ContentTypeMiddleware.php | 5 +-- src/Formatter.php | 4 +- src/Formatter/JmsSerializer.php | 5 +-- src/Formatter/Json.php | 6 +-- src/Formatter/Plates.php | 4 +- src/Formatter/StringCast.php | 5 +-- src/Formatter/Twig.php | 4 +- src/UnformattedResponse.php | 52 +++++++------------------ tests/ContentTypeMiddlewareTest.php | 3 +- tests/Formatter/JmsSerializerTest.php | 4 +- tests/Formatter/JsonTest.php | 2 + tests/Formatter/NaiveTemplateEngine.php | 1 + tests/Formatter/PlatesTest.php | 1 + tests/Formatter/TwigTest.php | 1 + tests/PersonDto.php | 1 - 16 files changed, 34 insertions(+), 66 deletions(-) diff --git a/composer.json b/composer.json index 0d4a11ed..72ecad0b 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,7 @@ "infection/infection": "^0.16", "jms/serializer": "^3.8", "laminas/laminas-diactoros": "^2.3", - "lcobucci/coding-standard": "^4.0", + "lcobucci/coding-standard": "^5.0", "league/plates": "^3.3", "middlewares/negotiation": "^2.0", "phpstan/extension-installer": "^1.0", diff --git a/src/ContentTypeMiddleware.php b/src/ContentTypeMiddleware.php index 96a90473..3f69ff0c 100644 --- a/src/ContentTypeMiddleware.php +++ b/src/ContentTypeMiddleware.php @@ -10,6 +10,7 @@ use Psr\Http\Message\StreamFactoryInterface; use Psr\Http\Server\MiddlewareInterface; use Psr\Http\Server\RequestHandlerInterface; + use function strpos; use function substr; @@ -18,9 +19,7 @@ final class ContentTypeMiddleware implements MiddlewareInterface private MiddlewareInterface $negotiator; private StreamFactoryInterface $streamFactory; - /** - * @var Formatter[] - */ + /** @var Formatter[] */ private array $formatters; /** diff --git a/src/Formatter.php b/src/Formatter.php index ad1afce5..b754e998 100644 --- a/src/Formatter.php +++ b/src/Formatter.php @@ -8,8 +8,6 @@ interface Formatter { - /** - * @throws ContentCouldNotBeFormatted - */ + /** @throws ContentCouldNotBeFormatted */ public function format(UnformattedResponse $response, StreamFactoryInterface $streamFactory): ResponseInterface; } diff --git a/src/Formatter/JmsSerializer.php b/src/Formatter/JmsSerializer.php index fb14ef0c..79fc58bb 100644 --- a/src/Formatter/JmsSerializer.php +++ b/src/Formatter/JmsSerializer.php @@ -6,6 +6,7 @@ use JMS\Serializer\SerializerInterface; use Lcobucci\ContentNegotiation\ContentCouldNotBeFormatted; use Throwable; + use function sprintf; final class JmsSerializer extends ContentOnly @@ -19,9 +20,7 @@ public function __construct(SerializerInterface $serializer, string $format) $this->format = $format; } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function formatContent($content, array $attributes = []): string { try { diff --git a/src/Formatter/Json.php b/src/Formatter/Json.php index 5c1c657e..8475f22f 100644 --- a/src/Formatter/Json.php +++ b/src/Formatter/Json.php @@ -5,8 +5,10 @@ use Lcobucci\ContentNegotiation\ContentCouldNotBeFormatted; use Throwable; + use function json_encode; use function sprintf; + use const JSON_HEX_AMP; use const JSON_HEX_APOS; use const JSON_HEX_QUOT; @@ -25,9 +27,7 @@ public function __construct(int $flags = self::DEFAULT_FLAGS) $this->flags = $flags; } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function formatContent($content, array $attributes = []): string { try { diff --git a/src/Formatter/Plates.php b/src/Formatter/Plates.php index 2f852830..408a05b6 100644 --- a/src/Formatter/Plates.php +++ b/src/Formatter/Plates.php @@ -20,9 +20,7 @@ public function __construct(Engine $engine, string $attributeName = self::DEFAUL $this->attributeName = $attributeName; } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function formatContent($content, array $attributes = []): string { try { diff --git a/src/Formatter/StringCast.php b/src/Formatter/StringCast.php index f0d2bc7f..e6baec29 100644 --- a/src/Formatter/StringCast.php +++ b/src/Formatter/StringCast.php @@ -4,14 +4,13 @@ namespace Lcobucci\ContentNegotiation\Formatter; use Lcobucci\ContentNegotiation\ContentCouldNotBeFormatted; + use function is_object; use function method_exists; final class StringCast extends ContentOnly { - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function formatContent($content, array $attributes = []): string { if (is_object($content) && ! method_exists($content, '__toString')) { diff --git a/src/Formatter/Twig.php b/src/Formatter/Twig.php index 9f28f80e..08bc5b74 100644 --- a/src/Formatter/Twig.php +++ b/src/Formatter/Twig.php @@ -22,9 +22,7 @@ public function __construct( $this->attributeName = $attributeName; } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function formatContent($content, array $attributes = []): string { try { diff --git a/src/UnformattedResponse.php b/src/UnformattedResponse.php index 7b4b1b2b..9d26c6c6 100644 --- a/src/UnformattedResponse.php +++ b/src/UnformattedResponse.php @@ -10,14 +10,10 @@ final class UnformattedResponse implements ResponseInterface { private ResponseInterface $decoratedResponse; - /** - * @var mixed - */ + /** @var mixed */ private $unformattedContent; - /** - * @var array - */ + /** @var array */ private array $attributes; /** @@ -34,9 +30,7 @@ public function __construct( $this->attributes = $attributes; } - /** - * @return mixed - */ + /** @return mixed */ public function getUnformattedContent() { return $this->unformattedContent; @@ -47,9 +41,7 @@ public function getProtocolVersion(): string return $this->decoratedResponse->getProtocolVersion(); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function withProtocolVersion($version) { return new self( @@ -59,41 +51,31 @@ public function withProtocolVersion($version) ); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function getHeaders(): array { return $this->decoratedResponse->getHeaders(); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function hasHeader($name): bool { return $this->decoratedResponse->hasHeader($name); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function getHeader($name) { return $this->decoratedResponse->getHeader($name); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function getHeaderLine($name): string { return $this->decoratedResponse->getHeaderLine($name); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function withHeader($name, $value) { return new self( @@ -103,9 +85,7 @@ public function withHeader($name, $value) ); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function withAddedHeader($name, $value) { return new self( @@ -115,9 +95,7 @@ public function withAddedHeader($name, $value) ); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function withoutHeader($name) { return new self( @@ -132,9 +110,7 @@ public function getBody(): StreamInterface return $this->decoratedResponse->getBody(); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function withBody(StreamInterface $body) { return new self( @@ -149,9 +125,7 @@ public function getStatusCode(): int return $this->decoratedResponse->getStatusCode(); } - /** - * {@inheritdoc} - */ + /** {@inheritdoc} */ public function withStatus($code, $reasonPhrase = '') { return new self( diff --git a/tests/ContentTypeMiddlewareTest.php b/tests/ContentTypeMiddlewareTest.php index 030632ff..49f7ad76 100644 --- a/tests/ContentTypeMiddlewareTest.php +++ b/tests/ContentTypeMiddlewareTest.php @@ -16,6 +16,7 @@ use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Server\RequestHandlerInterface; + use function array_map; /** @@ -183,7 +184,7 @@ private function createResponse(array $attributes = []): UnformattedResponse private function createRequestHandler(ResponseInterface $response): RequestHandlerInterface { - return new class($response) implements RequestHandlerInterface + return new class ($response) implements RequestHandlerInterface { private ResponseInterface $response; diff --git a/tests/Formatter/JmsSerializerTest.php b/tests/Formatter/JmsSerializerTest.php index aa18b663..e68f937e 100644 --- a/tests/Formatter/JmsSerializerTest.php +++ b/tests/Formatter/JmsSerializerTest.php @@ -15,9 +15,7 @@ */ final class JmsSerializerTest extends TestCase { - /** - * @var SerializerInterface|MockObject - */ + /** @var SerializerInterface&MockObject */ private SerializerInterface $serializer; /** diff --git a/tests/Formatter/JsonTest.php b/tests/Formatter/JsonTest.php index 6ae06d28..8aa2e0cd 100644 --- a/tests/Formatter/JsonTest.php +++ b/tests/Formatter/JsonTest.php @@ -9,7 +9,9 @@ use Lcobucci\ContentNegotiation\Tests\PersonDto; use PHPUnit\Framework\TestCase; use RuntimeException; + use function acos; + use const JSON_UNESCAPED_SLASHES; /** diff --git a/tests/Formatter/NaiveTemplateEngine.php b/tests/Formatter/NaiveTemplateEngine.php index 56504d72..59720a9d 100644 --- a/tests/Formatter/NaiveTemplateEngine.php +++ b/tests/Formatter/NaiveTemplateEngine.php @@ -5,6 +5,7 @@ use Lcobucci\ContentNegotiation\Formatter\ContentOnly; use SplFileObject; + use function array_keys; use function array_map; use function assert; diff --git a/tests/Formatter/PlatesTest.php b/tests/Formatter/PlatesTest.php index 52a16ef1..6ebc7b22 100644 --- a/tests/Formatter/PlatesTest.php +++ b/tests/Formatter/PlatesTest.php @@ -8,6 +8,7 @@ use Lcobucci\ContentNegotiation\Tests\PersonDto; use League\Plates\Engine; use PHPUnit\Framework\TestCase; + use function dirname; /** diff --git a/tests/Formatter/TwigTest.php b/tests/Formatter/TwigTest.php index d1fda680..a4c6b02a 100644 --- a/tests/Formatter/TwigTest.php +++ b/tests/Formatter/TwigTest.php @@ -9,6 +9,7 @@ use PHPUnit\Framework\TestCase; use Twig\Environment; use Twig\Loader\FilesystemLoader; + use function dirname; /** diff --git a/tests/PersonDto.php b/tests/PersonDto.php index 9a3c2b96..d3810d80 100644 --- a/tests/PersonDto.php +++ b/tests/PersonDto.php @@ -6,7 +6,6 @@ final class PersonDto { public int $id; - public string $name; public function __construct(int $id, string $name)