Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120564 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 59510 invoked from network); 13 Jun 2023 16:00:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 13 Jun 2023 16:00:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 60FB61804F5 for ; Tue, 13 Jun 2023 09:00:01 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Tue, 13 Jun 2023 09:00:01 -0700 (PDT) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f8c5d0b216so9207675e9.1 for ; Tue, 13 Jun 2023 09:00:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686672000; x=1689264000; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=3NzWu2ePe76HVCZ4zpTiIEaqOxbCQJ5tMpHI5v5Uw/A=; b=A70WZHs1OWDWsTNLd3wxuJ0KDlpiH+gsiFzLVKDEM84+9n9Id73I3rt1aQ+BpQmmik E/0WZzmeL1Bsj0JI2OrGB/kuYbMCnktbXYzUUe5rAeDHL+mK1nmcKxbZOTrbuyXTznjZ 3IxEbNY/mwnxNFpApIECkYmDf/h0jxXGF7QcMOKb/8Ap/8aQkrdPNQz/tUJObjOtvGix 1oBVBoz+ZSi7VtOQQkqtUVxIk8KRTwcSvBbF/LCwKkehUqii7ihqaIie2vh246MswCfS fazg6AXLvH6iokvEORDKEcFjdIu5B4ljPdso9UUXnyho98OTpzpnTpNAlgZx7mr3+b3G /AyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686672000; x=1689264000; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3NzWu2ePe76HVCZ4zpTiIEaqOxbCQJ5tMpHI5v5Uw/A=; b=cn7ptotMbR+Sz2msY28VlemwBLKodgqeDtiKGvCLkoD4e2W2upjPSgkRNAool/k3B9 8yjwBJPs4k88so4MTTVNnt0jzk7S/Q2H22VIv6teA6YAaaqMMJzQQ+KKRXm5TKGeGKCY tZSJe8626oB62wxCYiXWbO+UODLbVkAp9ZxYdtS4wbxgLps7TD5zggPTHjKS1HihHUM9 PItyMY8ln+eKu7rMvj/iyudpxULxYMxWwR8t2+LcYXgyCLMsor0IBuWDwUOraq2wZqd8 LBeTIgcqRALWZWItJXYAEojbjNq0EiLrsj+HNIIyi0aG2h79OgCFK+DFtCuA2r0yNOTs FF6A== X-Gm-Message-State: AC+VfDzCsqi9aPycSVr3fgStQnwg+1IFy845rXwjSlJ+Eh+qVlXXHvVI /kpNEYfCXUbAaWKlAJs/CGIbN8eh1PFgoANCbEZtLZFTzwu0mg== X-Google-Smtp-Source: ACHHUZ6Vxgete/BJPN3aXHxB3yFJYyYeu1Af1nzO3gD5FyyYC879/lgWJHDDdDu5U4ziHhB2QnUWwWQQR+q17yvI/Dg= X-Received: by 2002:adf:fc86:0:b0:30f:bcb1:f9d6 with SMTP id g6-20020adffc86000000b0030fbcb1f9d6mr6040961wrr.25.1686671999470; Tue, 13 Jun 2023 08:59:59 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 13 Jun 2023 17:59:47 +0200 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000618f2b05fe04ed51" Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000618f2b05fe04ed51 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > > As you have possibly already experienced, overloaded signatures cause > > various smaller and bigger issues, while the concept is not natively > > supported by PHP. That's why I drafted an RFC which intends to phase > > out the majority of overloaded function/method signatures and also > > forbid the introduction of such functions in the future: > > https://wiki.php.net/rfc/deprecate_functions_with_overloaded_signatures > > I'm going to nitpick on the newly suggested names and argument order for > the > DatePeriod factory methods =E2=80=94 althoughI do agree that they need to= get > created: > > createFromInterval(DateTimeInterface $start, DateInterval $interval, > DateTimeInterface $end, int $options =3D 0) > =E2=86=92 createWithRange(DateTimeInterface $begin, DateTimeInterface $en= d, > DateTimeInterface $int, int $options =3D 0) > > createFromRecurrences(DateTimeInterface $start, DateInterval $interval, > int $recurrences, int $options =3D 0) > =E2=86=92 createWithRecurrences(DateInterval $begin, int $recurrences, > DateInterval $interval, int $options =3D 0) > > We also should fix the argument names. Either $start/$finish, or > $begin/$end. I > prefer the latter. > > createFromIso8601(string $specification, int $options =3D 0) > -> createFromISO8601String > > I am open to bike shedding about this :-) > On my side, I'd very much prefer keeping the constructor of DatePeriod and thus making it non-overloaded with this signature: public function __construct(DateTimeInterface $start, DateInterval $interval, DateTimeInterface|int $end, int $options =3D 0) {} That'd help a lot with the migration/BC path and this signature also just makes sense. Unrelated: I don't think adding "ReflectionMethod::createFromMethodName" is useful. Using explode is just fine for those that need this style. And since this is the recommended migration path, better not give a reason to change twice the code. I like everything else in the RFC. I'm going to go with the "short path" of deprecating things because the migration paths look smooth enough, thanks for taking the time to explain them all (I just have a concern with the DatePeriod migration path, which would be fixed with my suggestion bove.) Thanks! Nicolas --000000000000618f2b05fe04ed51--