Skip to content

Conversation

@yousefkadah
Copy link

This PR adds missing @throws annotations 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 \InvalidArgumentException to:

  • string() - Throws when config value is not a string
  • integer() - Throws when config value is not an integer
  • float() - Throws when config value is not a float
  • boolean() - Throws when config value is not a boolean
  • array() - Throws when config value is not an array

2. 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 used

3. Session/SymfonySessionDecorator.php (3 methods)

Added @throws \BadMethodCallException to:

  • registerBag() - Method not implemented by Laravel
  • getBag() - Method not implemented by Laravel
  • getMetadataBag() - Method not implemented by Laravel

yousefkadah and others added 2 commits October 21, 2025 18:20
This commit adds the ConfirmableTrait to config:cache, route:cache,
view:cache, and event:cache commands to prevent accidental cache
regeneration in production environments.

Changes:
- Added ConfirmableTrait to all cache commands
- Added --force option to bypass confirmation prompts
- Converted $name property to $signature to support options
- Added confirmToProceed() check before cache operations

The confirmation prompt only appears when running in production
environment, following the same pattern used in other destructive
commands like key:generate.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This commit adds missing @throws annotations to methods that throw
exceptions but were not properly documented. This improves:
- IDE autocomplete and warnings
- PHPStan/Psalm static analysis
- Developer experience

Changes:
- Config/Repository: Added @throws InvalidArgumentException to string(), integer(), float(), boolean(), and array() methods
- Redis/Connections/PacksPhpRedisValues: Added @throws RuntimeException and UnexpectedValueException to pack() method
- Session/SymfonySessionDecorator: Added @throws BadMethodCallException to registerBag(), getBag(), and getMetadataBag() methods

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@shaedrich
Copy link
Contributor

Your PR includes changes form #57475—I assume, that happened by mistake

@taylorotwell
Copy link
Member

Has other confirmable changes that aren't part of description?

@yousefkadah
Copy link
Author

Has other confirmable changes that aren't part of description?

Sorry, that was a mistake — I was working on two pull requests, and this one accidentally included commits from the previous one: #57475.

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