hydephp / develop

The HydePHP Source Code Monorepo
https://hydephp.com
MIT License
13 stars 6 forks source link

[2.x] Revert to throwing an exception when trying to get non-configured base URL #1890

Closed caendesilva closed 2 months ago

caendesilva commented 2 months ago

Reverts the unreleased behaviour where this returns null. Returning null for a fault path means the developer needs to check for null types, but that solves the problem. If the developer cares about site URLs they need to set the site URL, and having a null that can silently be ignored is unintuitive. If the user tries to get a base URL and one is not set, that's a bug, and throwing an exception alerts them of it. It is not justified to have the custom exception for this, so that is still removed, and we now throw a BadMethodCallException instead. This essentially reverts most of https://github.com/hydephp/develop/pull/1760. See tie in with https://github.com/hydephp/develop/commit/e9778a968ef746ecf6f8a58b40e7e431f590e3a5