Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126906 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id 569EF1A00BC for ; Sat, 22 Mar 2025 14:02:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1742651969; bh=4+DIAA2gj7f26lmizsB2g9CohRvVwnLdHtlxdUgc+b0=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=I8pzcBamkoQS0oMBp/1j2/w0l9Nc6JgB0ZV7bknBGWVF7sVt6g7tcW3SCNnDiTCeM jNcBKtI/t88GoJB3NOVd/PiwSBrCbR0BdsyimpLJYUYJM4jUQSqZAS6aJuFx0ahk5h rvizY+dK+e9lj8FxyyYy2h7tlYi55tlAozD//Zvs9y+f0KXPPHVEfWYCiBU3TY7bEy V7HBXs66Bh1Zk591PZEga4EezMN+nzK5pDIsZyovl1eAnW9qMfPWDl1l46zOoDPrg8 1WAnFwf7bL6l8ZdVpV6mdmaYewCGEykZG8HzPYW07YfM0ZLrgHuYqXnmoMzGboZByV iSfe0V/JvczSQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 3FA9D180034 for ; Sat, 22 Mar 2025 13:59:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_05,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from premium76-5.web-hosting.com (premium76-5.web-hosting.com [162.213.255.108]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 22 Mar 2025 13:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pmjones.io; s=default; h=To:References:Message-Id:Content-Transfer-Encoding:Cc:Date: In-Reply-To:From:Subject:Mime-Version:Content-Type:Sender:Reply-To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=Pv8P0h6SLtJLw2/Mx/yl4DwEe2TrPE/pIKf0AdUYQoE=; b=6dKq+joKMZngoszwFJxbrtHQoH hvm9E5Q+KFUYfT32p5kDMF/iC4UvrdVAFqoNPxJDKmKIVAiArbjyc96t/zGAFPN6LCh8gHIB5eHJy yIqy0lQ55tyw0a7CQCJj5sEbW44mpG8iy8W7ERqdErugx4M8ytXflyzO6aCXGNX4OOyMo8JikY0vM FS0DDPYSChvBltFaJS1CVNs7YAWFqhSm+pYI889pu7pZpEzde0SOopthACCZxkQuMzltEbOBmwho8 VlYG4pZZ9epl15NlmyuA6LOtdqFScjFoH3rDmdK5NUgb7Cb+nz8Kd55P5PVnOd07HkyIY4jghAmoq ifFCy9Vw==; Received: from 107-223-28-39.lightspeed.nsvltn.sbcglobal.net ([107.223.28.39]:52327 helo=smtpclient.apple) by premium76.web-hosting.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.1) (envelope-from ) id 1tvzQD-0000000GBs6-3IKC; Sat, 22 Mar 2025 10:01:56 -0400 Content-Type: text/plain; charset=utf-8 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.400.131.1.6\)) Subject: Re: [PHP-DEV] [RFC] [Discussion] Add WHATWG compliant URL parsing API In-Reply-To: <2e95e8fe-7cf0-493f-bd0a-9fff0956baaa@gmail.com> Date: Sat, 22 Mar 2025 09:01:45 -0500 Cc: =?utf-8?B?TcOhdMOpIEtvY3Npcw==?= , PHP Internals List Content-Transfer-Encoding: quoted-printable Message-ID: <778194E9-679B-4178-94F8-052FB2C4DA37@pmjones.io> References: <1BCB4144-231D-45EA-A914-98EE8F0F503A@automattic.com> <8E614C9C-BA85-45D8-9A4E-A30D69981C5D@automattic.com> <9bf11a89-39d9-457b-b0ea-789fd07d7370@gmail.com> <6430b9ed-638d-4247-9fa9-d1a9148c382b@gmail.com> <2e95e8fe-7cf0-493f-bd0a-9fff0956baaa@gmail.com> To: Ignace Nyamagana Butera X-Mailer: Apple Mail (2.3826.400.131.1.6) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - premium76.web-hosting.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pmjones.io X-Get-Message-Sender-Via: premium76.web-hosting.com: authenticated_id: pmjones@pmjones.io X-Authenticated-Sender: premium76.web-hosting.com: pmjones@pmjones.io X-Source: X-Source-Args: X-Source-Dir: X-From-Rewrite: unmodified, already matched From: pmjones@pmjones.io ("Paul M. Jones") Hi Ignace & Mat=C3=A9 & all, > On Mar 19, 2025, at 16:18, Ignace Nyamagana Butera = wrote: >=20 > https://github.com/bakame-php/aide-uri/blob/main/src/Uri.php=20 > While implementing the polyfill I am finding easier DX wise to make = the constructor private and use instead named constructors for = instantiation. I would be in favor of `Uri::parse` and `Uri::tryParse` = like it is done currently with Enum and the `from` and `tryfrom` named = constructors. Hear, hear. Uri-Interop has = discovered two interfaces in existing projects: - one method with a `parseUri(stringStringable $uriString) : = UriComponents` signature to parse a string and create a URI instance; = and, - a separate method with a `newUri(?string $scheme, ?string $username, = ..., ?string $fragment) : UriComponents` signature that creates a URI = instance from the individual components. Neither of them dictates a constructor signature, but having the parser = method separated from the factory method turns out to be quite useful. = Presenting the two options as separate methods would reflect existing = implementations. * * * As a side note, the RFC uses the term `user` for the identifying part of = the user info. It's perfectly reasonable, as `user` is the = most-commonly-used term in existing URI projects. = However, WHATWG-URL consistently calls it `username`, putting the URL = portion of the RFC at odds with the WHATWG-URL spec. Calling it = `username` would be more in line with the spec. That would likely mean = calling it `username` in the URI portion of the RFC as well. = (Uri-Interop reviewers found `username` more suitable as well. = ) -- pmj