Skip to content

Comments

[12.x] Add missing @throws annotations to validation rules and JsonResponse#58697

Merged
taylorotwell merged 3 commits intolaravel:12.xfrom
QDenka:add-missing-throws-annotations
Feb 9, 2026
Merged

[12.x] Add missing @throws annotations to validation rules and JsonResponse#58697
taylorotwell merged 3 commits intolaravel:12.xfrom
QDenka:add-missing-throws-annotations

Conversation

@QDenka
Copy link
Contributor

@QDenka QDenka commented Feb 8, 2026

This PR adds missing @throws \InvalidArgumentException annotations to methods that throw but don't document it:

  • Email::defaults() — throws when callback is not callable or instance of static
  • Password::defaults() — same pattern
  • File::defaults() — same pattern
  • File::toKilobytes() — throws on invalid file size suffix
  • RequiredIf::__construct() — throws when condition is not callable or boolean
  • JsonResponse::setData() — throws on JSON encoding error

These annotations improve IDE support and static analysis by making the exception contracts explicit.

QDenka and others added 2 commits February 8, 2026 20:44
Co-authored-by: Sebastian Hädrich <11225821+shaedrich@users.noreply.github.com>
@taylorotwell taylorotwell merged commit eaf2492 into laravel:12.x Feb 9, 2026
70 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.

3 participants