Skip to content

[13.x] Add missing @throws \JsonException annotations#60514

Merged
taylorotwell merged 1 commit into
laravel:13.xfrom
dfinchenko:add-missing-throws-jsonexception
Jun 15, 2026
Merged

[13.x] Add missing @throws \JsonException annotations#60514
taylorotwell merged 1 commit into
laravel:13.xfrom
dfinchenko:add-missing-throws-jsonexception

Conversation

@dfinchenko

Copy link
Copy Markdown
Contributor

Adds @throws \JsonException to the methods that call json_encode()/ json_decode() with a hardcoded JSON_THROW_ON_ERROR flag and let the exception propagate (i.e. it is not caught and rethrown as something else):

  • Support\Composer::modify()
  • Queue\Events\JobQueueing::payload()
  • Queue\Events\JobQueued::payload()
  • Foundation\Cloud::configureManagedQueues()
  • Foundation\Cloud\FailedJobProvider::find()
  • Foundation\Cloud\Events::format()
  • Testing\TestResponse::assertSessionHasNoErrors()

Methods that catch JsonException internally and rethrow it (e.g. Model::toJson(), JsonResource::toJson()) are intentionally left untouched, as are the Http\Client\Response JSON helpers where the throw flag is opt-in rather than hardcoded. Docblock-only, no behavior change.

@taylorotwell taylorotwell merged commit a6ce2a7 into laravel:13.x Jun 15, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants