Drop support for PHP 8.3 and lower. The package now declares >=8.4, and CI runs only on 8.4. - composer.json: require php >=8.4. - mago.toml: php-version = "8.4", matching the minimum supported version. - phpstan.neon: phpVersion 80400. - Upgrade phpstan/phpstan to ^2.3: 1.x cannot parse `new Foo()->bar()`, which the 8.4 formatter now emits. - Narrow ArrayGateway::count() to int, matching what the fixture actually returns. - CI: single PHP 8.4 job using the php:8.4-cli container instead of setup-php, which failed with a TLS handshake timeout on the runner. BREAKING CHANGE: PHP 8.4 is now required.
This commit is contained in:
1 parent
a20762a715
commit
807992ecab
15 files changed
+57
-62
No files matched your search
@@ -158,7 +158,7 @@ final class CrudControllerTest extends TestCase
|
||||
|
||||
private function withId(string $method, string $id): Request
|
||||
{
|
||||
return (new JsonRequest(method: $method, path: '/articulos/' . $id))->withAttribute(
|
||||
return new JsonRequest(method: $method, path: '/articulos/' . $id)->withAttribute(
|
||||
'id',
|
||||
$id,
|
||||
);
|
||||
|
||||
@@ -52,7 +52,7 @@ final class JsonRequestTest extends TestCase
|
||||
|
||||
public function testWithAttributeKeepsPreviousAttributes(): void
|
||||
{
|
||||
$request = (new JsonRequest())
|
||||
$request = new JsonRequest()
|
||||
->withAttribute('a', '1')
|
||||
->withAttribute('b', '2');
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testAddsContentType(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(new JsonRequest(), self::ok(...));
|
||||
$response = new ContentNegotiation()->process(new JsonRequest(), self::ok(...));
|
||||
|
||||
self::assertSame(200, $response->status());
|
||||
self::assertSame('application/json; charset=utf-8', $response->headers()['Content-Type']);
|
||||
@@ -27,14 +27,14 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testMissingAcceptHeaderIsAccepted(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(new JsonRequest(), self::ok(...));
|
||||
$response = new ContentNegotiation()->process(new JsonRequest(), self::ok(...));
|
||||
|
||||
self::assertSame(200, $response->status());
|
||||
}
|
||||
|
||||
public function testJsonAcceptIsAccepted(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(
|
||||
$response = new ContentNegotiation()->process(
|
||||
new JsonRequest(headers: ['accept' => 'application/json']),
|
||||
self::ok(...),
|
||||
);
|
||||
@@ -46,7 +46,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
{
|
||||
$accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
|
||||
|
||||
$response = (new ContentNegotiation())->process(
|
||||
$response = new ContentNegotiation()->process(
|
||||
new JsonRequest(headers: ['accept' => $accept]),
|
||||
self::ok(...),
|
||||
);
|
||||
@@ -56,7 +56,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testIncompatibleAcceptIs406(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(
|
||||
$response = new ContentNegotiation()->process(
|
||||
new JsonRequest(headers: ['accept' => 'application/xml']),
|
||||
static function (): Response {
|
||||
self::fail('The handler must not run when the client rejects JSON.');
|
||||
@@ -69,7 +69,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testZeroQualityIsRejected(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(
|
||||
$response = new ContentNegotiation()->process(
|
||||
new JsonRequest(headers: ['accept' => 'application/json;q=0']),
|
||||
static function (): Response {
|
||||
self::fail('A q=0 entry means not acceptable.');
|
||||
@@ -81,7 +81,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testNonZeroQualityIsAccepted(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(
|
||||
$response = new ContentNegotiation()->process(
|
||||
new JsonRequest(headers: ['accept' => 'application/json;q=0.5']),
|
||||
self::ok(...),
|
||||
);
|
||||
@@ -91,7 +91,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testExistingContentTypeIsPreserved(): void
|
||||
{
|
||||
$response = (new ContentNegotiation())->process(
|
||||
$response = new ContentNegotiation()->process(
|
||||
new JsonRequest(),
|
||||
static fn(): Response => new Response(['ok' => true], 200, [
|
||||
'Content-Type' => 'application/problem+json',
|
||||
@@ -103,7 +103,7 @@ final class ContentNegotiationTest extends TestCase
|
||||
|
||||
public function testContentTypeCanBeDisabled(): void
|
||||
{
|
||||
$response = (new ContentNegotiation(addContentType: false))->process(
|
||||
$response = new ContentNegotiation(addContentType: false)->process(
|
||||
new JsonRequest(),
|
||||
self::ok(...),
|
||||
);
|
||||
|
||||
@@ -88,7 +88,7 @@ final class BearerAuthTest extends TestCase
|
||||
|
||||
public function testRouterRejectsBeforeReachingController(): void
|
||||
{
|
||||
$router = (new Router())->withMiddleware(
|
||||
$router = new Router()->withMiddleware(
|
||||
new BearerAuth(static fn(string $token): ?array => null),
|
||||
);
|
||||
$router->get('/x', static fn(): Response => new Response(['leaked' => true]));
|
||||
@@ -101,7 +101,7 @@ final class BearerAuthTest extends TestCase
|
||||
|
||||
public function testRouterAllowsValidToken(): void
|
||||
{
|
||||
$router = (new Router())->withMiddleware(new BearerAuth(static fn(string $token): array => [
|
||||
$router = new Router()->withMiddleware(new BearerAuth(static fn(string $token): array => [
|
||||
'id' => 1,
|
||||
]));
|
||||
$router->get(
|
||||
|
||||
@@ -38,7 +38,7 @@ final class CorsTest extends TestCase
|
||||
|
||||
public function testWildcardOriginIsAddedToResponse(): void
|
||||
{
|
||||
$response = (new Cors())->process(
|
||||
$response = new Cors()->process(
|
||||
new JsonRequest(headers: ['origin' => 'https://app.test']),
|
||||
self::passThrough(...),
|
||||
);
|
||||
|
||||
@@ -89,8 +89,8 @@ final class RateLimitTest extends TestCase
|
||||
public function testBucketsAreSeparatedByClientAddress(): void
|
||||
{
|
||||
$limiter = $this->limiter(1);
|
||||
$first = (new JsonRequest())->withAttribute('client_ip', '10.0.0.1');
|
||||
$second = (new JsonRequest())->withAttribute('client_ip', '10.0.0.2');
|
||||
$first = new JsonRequest()->withAttribute('client_ip', '10.0.0.1');
|
||||
$second = new JsonRequest()->withAttribute('client_ip', '10.0.0.2');
|
||||
|
||||
self::assertSame(200, $limiter->process($first, self::passThrough(...))->status());
|
||||
self::assertSame(200, $limiter->process($second, self::passThrough(...))->status());
|
||||
|
||||
@@ -19,15 +19,12 @@ final class RequireRoleTest extends TestCase
|
||||
|
||||
private static function withUser(mixed $user): Request
|
||||
{
|
||||
return (new JsonRequest())->withAttribute('user', $user);
|
||||
return new JsonRequest()->withAttribute('user', $user);
|
||||
}
|
||||
|
||||
public function testNoIdentityIs401(): void
|
||||
{
|
||||
$response = (new RequireRole(['admin']))->process(
|
||||
new JsonRequest(),
|
||||
self::passThrough(...),
|
||||
);
|
||||
$response = new RequireRole(['admin'])->process(new JsonRequest(), self::passThrough(...));
|
||||
|
||||
self::assertSame(401, $response->status());
|
||||
self::assertStringContainsString(
|
||||
|
||||
Reference in new issue
Block a user