diff --git a/.github/workflows/php-tests.yml b/.github/workflows/php-tests.yml index a0cd416..e2ca537 100644 --- a/.github/workflows/php-tests.yml +++ b/.github/workflows/php-tests.yml @@ -63,7 +63,7 @@ jobs: - name: Install dependencies if: needs.changes.outputs.php == 'true' run: | - composer switch l:${{ matrix.laravel }} -- -- --no-interaction --no-progress --ansi + composer switch:l${{ matrix.laravel }} -- -- --no-interaction --no-progress --ansi composer dump-autoload --optimize - name: Execute tests with coverage diff --git a/composer.json b/composer.json index 91b9455..cab82d3 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "spatie/laravel-package-tools": "^1.16" }, "require-dev": { - "brianium/paratest": "^7.0||^7.8", + "brianium/paratest": "^7.0 || ^8.0", "larastan/larastan": "^2.9||^3.0", "laravel/pint": "^1.14", "nunomaduro/collision": "^8.1||^7.10", @@ -35,7 +35,7 @@ "phpstan/extension-installer": "^1.3||^2.0", "phpstan/phpstan-deprecation-rules": "^1.1||^2.0", "phpunit/phpunit": "^10.1||^11.5.3", - "rector/rector": "^2.2", + "rector/rector": "^1.2 || ^2.2", "spatie/laravel-data": "^4.18" }, "autoload": { diff --git a/src/Modules/Relay/Responses/DumpAndDieResponse.php b/src/Modules/Relay/Responses/DumpAndDieResponse.php index b1817bf..1e6fd5e 100644 --- a/src/Modules/Relay/Responses/DumpAndDieResponse.php +++ b/src/Modules/Relay/Responses/DumpAndDieResponse.php @@ -10,22 +10,30 @@ class DumpAndDieResponse extends Response { public const DUMP_AND_DIE_STATUS_CODE = 999; + public function __construct($response) + { + parent::__construct($response); + + $this->preDecodeBody((string) $this->response->getBody()); + } + public function getStatusCode(): int { return self::DUMP_AND_DIE_STATUS_CODE; } - /** - * @return array> - */ - public function json($key = null, $default = null): array + private function preDecodeBody(string $body): void { + // Normally, we would overwrite the `->json` method. But there was a breaking change to the method in L12.48. + // If we overwrite the new `->json` and conform its new signature, we lose support for earlier versions. + // Instead, we need to pre-decode the body so that when calling ->json() it will use the below array. + [ 'source' => $source, 'dumps' => $dumps, - ] = resolve(VarDumpParser::class)->parse($this->response->getBody())->toArray(); + ] = resolve(VarDumpParser::class)->parse($body)->toArray(); - return [ + $this->decoded = [ 'id' => Str::uuid()->toString(), 'timestamp' => now()->format('Y-m-d H:i:s'), 'source' => $source,