Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce PHP 8.5 polyfill #498

Draft
wants to merge 1 commit into
base: 1.x
Choose a base branch
from

Conversation

alexandre-daubois
Copy link
Contributor

@alexandre-daubois alexandre-daubois commented Sep 16, 2024

⚠️ This is a first, naive draft of a new always-available ext-uri introduced in PHP 8.5 (or 9.0, whichever comes first). It isn't complete yet.

Follow-up of symfony/symfony#57192 (comment)

I used TDD on this one, using php/php-src#14461 test cases. There's a lot to do still. I'm publishing this PR if one wants to track progress on this, but also to get potential feedback during development. Keep in mind that "everything" is subject to change if you take a look at it 😄

RFC: https://wiki.php.net/rfc/url_parsing_api
Implementation: php/php-src#14461


public function __toString(): string
{

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yet to come 😄

src/Php85/Uri/Rfc3986Uri.php Outdated Show resolved Hide resolved
src/Php85/Php85.php Outdated Show resolved Hide resolved
namespace Uri;

if (\PHP_VERSION_ID < 80500) {
class Rfc3986Uri extends \Symfony\Polyfill\Php85\Uri\Rfc3986Uri
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The classes in core don't have a parent. Shall we alias the class instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see class Rfc3986Uri extends Uri in the RFC. Do I miss your point?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but Symfony\Polyfill\Php85\Uri\Rfc3986Uri does not appear in the original inheritance chain. What is the point of the Symfony namespaced classes anyway? Do we need them?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having all the logic being in internal namespaced classes allows to test the logic of those classes even on versions where the polyfill is not applied because the native class exist. That's why all our polyfill classes have such internal parent class.

src/Php85/Uri/Rfc3986Uri.php Show resolved Hide resolved
@alexandre-daubois
Copy link
Contributor Author

alexandre-daubois commented Sep 17, 2024

Thank you everyone for reviewing this first draft! I applied the requested changes. I'll continue the work soon.

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.

4 participants