Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API

From: Date: Mon, 28 Apr 2025 08:42:23 +0000
Subject: Re: [RFC] [Discussion] Add WHATWG compliant URL parsing API
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Mon, Apr 28, 2025 at 9:05 AM ignace nyamagana butera <[email protected]>
wrote:

> Hi Maté,
>
> I found another typo in the RFC examples due to the use of boolean as
> parameters
>
> // The fragment component of Uri\WhatWg\Url can also be taken into account$url = new
> Uri\WhatWg\Url("https://example.com#foo");$url->equals(new
> Uri\WhatWg\Url("https://example.com"), true); //
> false
>
> The $excludeFragment is true by default so in the example it should be
> false instead. Perhaps using an Enum instead would make the
> DX easier than using a boolean ?
> I believe the same issue is in all examples regarding the use of that
> parameter.
>
> Best regards,
> Ignace Nyamagana Butera
>
>
> On Mon, Apr 28, 2025 at 12:35 AM Tim Düsterhus <[email protected]> wrote:
>
>> Hi
>>
>> On 4/27/25 23:47, Máté Kocsis wrote:
>> > […]
>>
>> Thank you. I have just given the RFC another full read (the 2025/04/27
>> 21:44 version) and I do not have any further remarks. I'm happy with
>> everything that is said in the RFC and I'm really looking forward to
>> vote “Yes” :-)
>>
>> Best regards
>> Tim Düsterhus
>>
>
Hi I would propose to use the following Enum in the Uri namespace

 enum UriComparison {

    case IncludeFragment;
    case ExcludeFragment;
}

It is a bit verbose for less error prone and by default the equals
method on both class would use UriComparison::ExcludeFragment PS:
naming can change as long

as the enum reduces the errors.


Thread (152 messages)

« previous php.internals (#127219) next »