Closed dakujem closed 1 month ago
Eh, I'm not sure how to fix the PHPStan issue...
Hi @dakujem
Thanks so much for your work on this! It’s been a while since we’ve seen any updates, so I’m going to close this PR for now just to keep things tidy. No worries though, if you’re able to pick it back up or have new changes, feel free to reopen it or start a new one.
@odan I expected a helping hand with the phpstan issue I mentioned in my previous post (which i no longer see here though) so we could finish and close this PR.
This PR makes it possible to opt-out of URI scheme filtering. This may be used for generic scenarios where the schemes are not know and it is not desirable to limit them.
The filtering is opted out in the
Uri
class by inheriting it and overriding theUri::SUPPORTED_SCHEMES
constant, setting it tonull
:It is then possible to create URIs with any scheme:
To use the new class with
UriFactory
, one has to, again, inherit it, having two options:UriFactory::makeUriObject
methodUriFactory::URI_CLASS
or
Personally, I'm not happy with this inheritance-based approach, it seems to me that the filtering should be opt-in in and a function of the factory, not the Uri object. That would be breaking change. But even it the functionality was moved, the standard port omission would stop working in the Uri object.
I first tried using static variable, that could be manipulated globally, but that approach broke the existing inheritance due to restrictions in PHP.