Skip to content

Commit 165a990

Browse files
renovate[bot]lcobucci
authored andcommitted
Update PHPStan packages to v2
| datasource | package | from | to | | ---------- | --------------------------------- | ------- | ----- | | packagist | phpstan/phpstan | 1.12.12 | 2.0.3 | | packagist | phpstan/phpstan-deprecation-rules | 1.2.1 | 2.0.1 | | packagist | phpstan/phpstan-phpunit | 1.4.1 | 2.0.1 | | packagist | phpstan/phpstan-strict-rules | 1.6.1 | 2.0.0 |
1 parent 024e964 commit 165a990

File tree

5 files changed

+55
-48
lines changed

5 files changed

+55
-48
lines changed

composer.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
"league/plates": "^3.5.0",
2626
"middlewares/negotiation": "^2.1",
2727
"phpstan/extension-installer": "^1.4.1",
28-
"phpstan/phpstan": "^1.12.4",
29-
"phpstan/phpstan-deprecation-rules": "^1.2.1",
30-
"phpstan/phpstan-phpunit": "^1.4.0",
31-
"phpstan/phpstan-strict-rules": "^1.6.1",
28+
"phpstan/phpstan": "^2.0.0",
29+
"phpstan/phpstan-deprecation-rules": "^2.0.0",
30+
"phpstan/phpstan-phpunit": "^2.0.0",
31+
"phpstan/phpstan-strict-rules": "^2.0.0",
3232
"phpunit/phpunit": "^11.3",
3333
"twig/twig": "^3.14.1"
3434
},

composer.lock

+38-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/ContentTypeMiddlewareTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function processShouldReturnAResponseWithFormattedContentEvenWithoutForci
120120
self::assertJsonStringEqualsJsonString('{"id":1,"name":"Testing"}', (string) $response->getBody());
121121
}
122122

123-
/** @param mixed[] $attributes */
123+
/** @param array<string, mixed> $attributes */
124124
private function createResponse(array $attributes = []): UnformattedResponse
125125
{
126126
return new UnformattedResponse(

tests/Formatter/NaiveTemplateEngine.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public function formatContent(mixed $content, array $attributes = []): string
2525
{
2626
$template = $this->getTemplateContent($attributes);
2727

28+
// @phpstan-ignore argument.type
2829
return $this->render($template, (array) $content);
2930
}
3031

@@ -41,7 +42,7 @@ private function getTemplateContent(array $attributes): string
4142
return $content;
4243
}
4344

44-
/** @param mixed[] $data */
45+
/** @param array<string, mixed> $data */
4546
private function render(string $template, array $data): string
4647
{
4748
$variables = array_map(
@@ -51,6 +52,7 @@ static function (string $attribute): string {
5152
array_keys($data),
5253
);
5354

55+
// @phpstan-ignore argument.type
5456
return trim(str_replace($variables, $data, $template));
5557
}
5658
}

tests/UnformattedResponseTest.php

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Lcobucci\ContentNegotiation\UnformattedResponse;
99
use PHPUnit\Framework\Attributes as PHPUnit;
1010
use PHPUnit\Framework\TestCase;
11+
use Psr\Http\Message\ResponseInterface;
1112

1213
#[PHPUnit\CoversClass(UnformattedResponse::class)]
1314
final class UnformattedResponseTest extends TestCase
@@ -152,13 +153,19 @@ private function assertSetterReturn(string $method, mixed ...$arguments): void
152153
$decoratedResponse = new Response();
153154
$dto = new PersonDto(1, 'Testing');
154155

156+
$expectedDecoratedResponse = $decoratedResponse->$method(...$arguments);
157+
self::assertInstanceOf(ResponseInterface::class, $expectedDecoratedResponse);
158+
155159
$response = new UnformattedResponse($decoratedResponse, $dto, ['test' => 1]);
156160
$expected = new UnformattedResponse(
157-
$decoratedResponse->$method(...$arguments),
161+
$expectedDecoratedResponse,
158162
$dto,
159163
['test' => 1],
160164
);
161165

162-
self::assertEquals($expected, $response->$method(...$arguments));
166+
$givenDecoratedResponse = $response->$method(...$arguments);
167+
168+
self::assertInstanceOf(ResponseInterface::class, $givenDecoratedResponse);
169+
self::assertEquals($expected, $givenDecoratedResponse);
163170
}
164171
}

0 commit comments

Comments
 (0)