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

Update lcobucci/coding-standard requirement from ^4.0 to ^5.0 #48

Merged
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 2 additions & 3 deletions src/ContentTypeMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -18,9 +19,7 @@ final class ContentTypeMiddleware implements MiddlewareInterface
private MiddlewareInterface $negotiator;
private StreamFactoryInterface $streamFactory;

/**
* @var Formatter[]
*/
/** @var Formatter[] */
private array $formatters;

/**
Expand Down
4 changes: 1 addition & 3 deletions src/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

interface Formatter
{
/**
* @throws ContentCouldNotBeFormatted
*/
/** @throws ContentCouldNotBeFormatted */
public function format(UnformattedResponse $response, StreamFactoryInterface $streamFactory): ResponseInterface;
}
5 changes: 2 additions & 3 deletions src/Formatter/JmsSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use JMS\Serializer\SerializerInterface;
use Lcobucci\ContentNegotiation\ContentCouldNotBeFormatted;
use Throwable;

use function sprintf;

final class JmsSerializer extends ContentOnly
Expand All @@ -19,9 +20,7 @@ public function __construct(SerializerInterface $serializer, string $format)
$this->format = $format;
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function formatContent($content, array $attributes = []): string
{
try {
Expand Down
6 changes: 3 additions & 3 deletions src/Formatter/Json.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down
4 changes: 1 addition & 3 deletions src/Formatter/Plates.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions src/Formatter/StringCast.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')) {
Expand Down
4 changes: 1 addition & 3 deletions src/Formatter/Twig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ public function __construct(
$this->attributeName = $attributeName;
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function formatContent($content, array $attributes = []): string
{
try {
Expand Down
52 changes: 13 additions & 39 deletions src/UnformattedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ final class UnformattedResponse implements ResponseInterface
{
private ResponseInterface $decoratedResponse;

/**
* @var mixed
*/
/** @var mixed */
private $unformattedContent;

/**
* @var array<string, mixed>
*/
/** @var array<string, mixed> */
private array $attributes;

/**
Expand All @@ -34,9 +30,7 @@ public function __construct(
$this->attributes = $attributes;
}

/**
* @return mixed
*/
/** @return mixed */
public function getUnformattedContent()
{
return $this->unformattedContent;
Expand All @@ -47,9 +41,7 @@ public function getProtocolVersion(): string
return $this->decoratedResponse->getProtocolVersion();
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function withProtocolVersion($version)
{
return new self(
Expand All @@ -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(
Expand All @@ -103,9 +85,7 @@ public function withHeader($name, $value)
);
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function withAddedHeader($name, $value)
{
return new self(
Expand All @@ -115,9 +95,7 @@ public function withAddedHeader($name, $value)
);
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function withoutHeader($name)
{
return new self(
Expand All @@ -132,9 +110,7 @@ public function getBody(): StreamInterface
return $this->decoratedResponse->getBody();
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function withBody(StreamInterface $body)
{
return new self(
Expand All @@ -149,9 +125,7 @@ public function getStatusCode(): int
return $this->decoratedResponse->getStatusCode();
}

/**
* {@inheritdoc}
*/
/** {@inheritdoc} */
public function withStatus($code, $reasonPhrase = '')
{
return new self(
Expand Down
3 changes: 2 additions & 1 deletion tests/ContentTypeMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;

use function array_map;

/**
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions tests/Formatter/JmsSerializerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
*/
final class JmsSerializerTest extends TestCase
{
/**
* @var SerializerInterface|MockObject
*/
/** @var SerializerInterface&MockObject */
private SerializerInterface $serializer;

/**
Expand Down
2 changes: 2 additions & 0 deletions tests/Formatter/JsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
use Lcobucci\ContentNegotiation\Tests\PersonDto;
use PHPUnit\Framework\TestCase;
use RuntimeException;

use function acos;

use const JSON_UNESCAPED_SLASHES;

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Formatter/NaiveTemplateEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

use Lcobucci\ContentNegotiation\Formatter\ContentOnly;
use SplFileObject;

use function array_keys;
use function array_map;
use function assert;
Expand Down
1 change: 1 addition & 0 deletions tests/Formatter/PlatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Lcobucci\ContentNegotiation\Tests\PersonDto;
use League\Plates\Engine;
use PHPUnit\Framework\TestCase;

use function dirname;

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Formatter/TwigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPUnit\Framework\TestCase;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;

use function dirname;

/**
Expand Down
1 change: 0 additions & 1 deletion tests/PersonDto.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
final class PersonDto
{
public int $id;

public string $name;

public function __construct(int $id, string $name)
Expand Down