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

2025-02-24 Thread Tim Düsterhus
Hi Am 2025-02-24 15:05, schrieb Hammed Ajao: What's wrong with declaring all the methods as final eg. https://github.com/lnear-dev/ada-url/blob/main/ada_url.stub.php It is not possible to construct a subclass in a generic fashion, because you don't know the constructor’s signature and you als

Re: [PHP-DEV] RFC: Marking return values as important (#[\NoDiscard])

2025-02-24 Thread Volker Dusch
On Wed, Feb 12, 2025 at 10:44 PM Jorg Sowa wrote: > I must agree with Kamil. I don't see practical benefits of this feature > that would surpass the implications it has for the language. We already > have static analysis handling such cases and it can be extended even to > non-pure functions. Mor

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

2025-02-24 Thread Nicolas Grekas
Le lun. 24 févr. 2025 à 14:57, Gina P. Banyard a écrit : > On Monday, 24 February 2025 at 11:08, Nicolas Grekas < > nicolas.grekas+...@gmail.com> wrote: > > I'm seeing a push to make the classes final. Please don't! > This would badly break the open/closed principle to me. > > When shipping a new

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

2025-02-24 Thread Sebastian Bergmann
Am 24.02.2025 um 14:57 schrieb Marco Pivetta: The `DateTimeImmutable` type should've been `final` from the start: it is trivial to declare a userland interface, and then use the `DateTimeImmutable` type as an implementation detail of a userland- provided interface. +1

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

2025-02-24 Thread Hammed Ajao
What's wrong with declaring all the methods as final eg. https://github.com/lnear-dev/ada-url/blob/main/ada_url.stub.php On Mon, Feb 24, 2025, 7:00 a.m. Gina P. Banyard wrote: > On Monday, 24 February 2025 at 11:08, Nicolas Grekas < > nicolas.grekas+...@gmail.com> wrote: > > I'm seeing a push to

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

2025-02-24 Thread Gina P. Banyard
On Monday, 24 February 2025 at 11:08, Nicolas Grekas wrote: > I'm seeing a push to make the classes final. Please don't! > This would badly break the open/closed principle to me. > > When shipping a new class, one ships two things: a behavior and a type. The > behavior is what some want to clos

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

2025-02-24 Thread Marco Pivetta
On Mon, 24 Feb 2025 at 14:45, Nicolas Grekas wrote: > > > Am 2025-02-24 12:08, schrieb Nicolas Grekas: >> > The situation I'm telling about is when one will accept an argument >> > described as >> > function (\Uri\WhatWg\Url $url) >> > >> > If the Url class is final, this signature means only one

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

2025-02-24 Thread Nicolas Grekas
Am 2025-02-24 12:08, schrieb Nicolas Grekas: > > The situation I'm telling about is when one will accept an argument > > described as > > function (\Uri\WhatWg\Url $url) > > > > If the Url class is final, this signature means only one possible > > implementation can ever be passed: the native one.

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

2025-02-24 Thread Tim Düsterhus
Hi Am 2025-02-24 12:08, schrieb Nicolas Grekas: The situation I'm telling about is when one will accept an argument described as function (\Uri\WhatWg\Url $url) If the Url class is final, this signature means only one possible implementation can ever be passed: the native one. Composition canno

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

2025-02-24 Thread Nicolas Grekas
Hi, Thanks for all the efforts making this RFC happen, it'll be a game changer in the domain! I'm seeing a push to make the classes final. Please don't! This would badly break the open/closed principle to me. When shipping a new class, one ships two things: a behavior and a type. The behavior is

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

2025-02-24 Thread Tim Düsterhus
Hi Am 2025-02-24 10:18, schrieb Ignace Nyamagana Butera: 5 - Can the returned array from __debugInfo be used in a "normal" method like `toComponents` naming can be changed/improve to ease migration from parse_url or is this left for userland library ? I would prefer not expose this functional

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

2025-02-24 Thread Tim Düsterhus
Hi Am 2025-02-23 18:57, schrieb Paul M. Jones: In earlier discussions on the [Server-Side Request and Response objects](https://externals.io/message/108436) RFC and the [after-action sumamry](https://externals.io/message/109563), one of the common non-technical objections was that it would bet

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

2025-02-24 Thread Ignace Nyamagana Butera
On 21/02/2025 13:06, Tim Düsterhus wrote: Hi Am 2025-02-16 23:01, schrieb Máté Kocsis: I only harp on the WhatWG spec so much because for many people this will be the only one they are aware of, if they are aware of any spec at all, and this is a sizable vector of attack targeting servers fro

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

2025-02-24 Thread Tim Düsterhus
Hi Am 2025-02-23 18:47, schrieb Juris Evertovskis: As those are URI validation errors, maybe something like `Uri\WhatWg\ValidationError` would be both less clashy and less redundant? I like that suggestion. Best regards Tim Düsterhus

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

2025-02-24 Thread Tim Düsterhus
Hi Am 2025-02-23 18:30, schrieb Gina P. Banyard: 2. I don't really understand how the UninitializedUriException exception can be thrown? Is it somehow possible to create an instance of a URI without initializing it? It's mentioned in the RFC (it was not yet, when I read through the RFC): Th