Add missing throws annotations #57476
Closed
+57
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds missing
@throwsannotations to methods that throw exceptions but were not properly documented in their docblocks. This improves IDE support, static analysis capabilities, and overall developer experience.Following the pattern established in recent PRs #57451 and #57452, this contribution continues the effort to improve Laravel's documentation and type safety.
Changes Made
1. Config/Repository.php (5 methods)
Added
@throws \InvalidArgumentExceptionto:string()- Throws when config value is not a stringinteger()- Throws when config value is not an integerfloat()- Throws when config value is not a floatboolean()- Throws when config value is not a booleanarray()- Throws when config value is not an array2. Redis/Connections/PacksPhpRedisValues.php (1 method)
Added to
pack()method:@throws \RuntimeException- When required PHP extensions (lzf/zstd) are missing@throws \UnexpectedValueException- When unsupported compression type is used3. Session/SymfonySessionDecorator.php (3 methods)
Added
@throws \BadMethodCallExceptionto:registerBag()- Method not implemented by LaravelgetBag()- Method not implemented by LaravelgetMetadataBag()- Method not implemented by Laravel