4 ms·
Both the LogicException and the RuntimeException branches seem kind of pointless... They all describe exceptions that happen with values at runtime and I expect
by sadgit 11y ago
Both the LogicException and the RuntimeException branches seem kind of pointless... They all describe exceptions that happen with values at runtime and I expect I'd have trouble picking one in a given circumstance. Mostly I see it leading to a lot of inconsistent uses in practice. At least 4 of them would be legitimate choices for a string thats too short, for example.
Ah, PHP.
- debacle 11y agoThe logic behind the difference is in the fact that PHP doesn't have assertions - the naming is based on the root cause, not when the occur. A RuntimeException is something like "Database connection failed." A LogicException is an implementation issue (e.g. usually requires a code change to fix).