Skip to content

Commit 04bb1fa

Browse files
committed
docs: note orRedirect catch-type change in UPGRADING, add exception rule of thumb
orRedirect() is the only throw whose catch type changed in 3.0.0 (RuntimeException to CallerException), so UPGRADING's silent-changes list gets one bullet with the working catches. ai-reference now states the exception model in one line: RuntimeException from orThrow() is the only type to catch in normal operation, everything else means code to fix.
1 parent 83488f4 commit 04bb1fa

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎UPGRADING.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ Full lists of what changed per release: [CHANGELOG.md](CHANGELOG.md).
7777
> exit codes now see the failure
7878
> - `pregReplace()` with an invalid pattern throws an exception naming your
7979
> file and line (was a PHP warning and a null result)
80+
> - `orRedirect()` with headers already sent throws CallerException (an
81+
> InvalidArgumentException subclass) instead of RuntimeException - the only
82+
> exception whose catch type changed in this release. A specific
83+
> `catch (RuntimeException)` around it no longer matches; `catch (Exception)`
84+
> and `catch (Throwable)` work in both versions
8085
> - Constructor and `new()` no longer accept a `$properties` array (carried
8186
> an internal flag; nothing outside the class used it)
8287

‎docs/ai-reference.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,9 @@ print_r($str); // shows rawData (original value) + one-time help() hint
293293
braces in a string (`$str->trim`, `"$str->trim()"`). Page continues;
294294
expression yields an empty SmartString.
295295

296+
Rule of thumb: RuntimeException (from `orThrow()`) is the only type to catch
297+
in normal operation - everything else means code to fix.
298+
296299
## Gotchas Quick Reference
297300

298301
- Wrapping output in `htmlspecialchars()` double-encodes (`'` in

0 commit comments

Comments
 (0)