Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120622 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98297 invoked from network); 19 Jun 2023 20:12:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 19 Jun 2023 20:12:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 10ED918053F for ; Mon, 19 Jun 2023 13:12:21 -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-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Mon, 19 Jun 2023 13:12:20 -0700 (PDT) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-3f97e08b012so19175885e9.3 for ; Mon, 19 Jun 2023 13:12:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687205539; x=1689797539; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=+Lv0OImlwbkdwfVkFVsqIK5HJCedzqrnVUTzPdTa/20=; b=O/HV4/9J7b/PZi7VE+1FxGZa2sygm7Af8sZYWmWguBPziZ+DrbdTr1xsPpoqcVYG0B zcD/2zUeHz0kxZ5s8Bpic3PnJPxmE0MyvccIm5qLQszcUq5ywqbfAsLRLs4JpMcmFPzn OkJE6gQTdI1RceOZQfrWXVPzXkP9Bo50vbN4r3EXHiLwzkmVzHPrs3/r3G2fxwBSy3Xz u6I1o1oDi+oYm4IX5aOaYMRDG0pRXt5zsIB7KU585GmFTxbRGbl1pW/j87M9gGssi/Ez gDmB0dBoRxIykjJhsGUxmd+859cpWjLfZLWh1ujntrknixw3YxrjQyVLHT12KFGTnnUf vhTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687205539; x=1689797539; 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=+Lv0OImlwbkdwfVkFVsqIK5HJCedzqrnVUTzPdTa/20=; b=UZ8vM+AySCZXi38Xzq8zhOMHWoD6No1tHfIayMRuCkbbckjHxdeP5L4KZDa9lmKVkE DXyLwssM2FPlsj/a3JelLQ7wn7TPfQufSvGH55PzdxjLmozxok7Ql6hXeVXqJHr5ayVL hti1wRjBzCm0r65xq5cffGaH3fEjwHbwezOPNUSeEc5TxffuZHwPu9NV8dFHleFSHBW7 e7UQ30xVT5IT8BIDaUHeAxG03hbVGslJJN2HRW0O6PManSlWShou2k8PE8RaoGYGVmfs sSYPC/JsdAOTiovmvkRLPEcJ2uVE0gUoQTWAKV99NoPxsx6FQZAk947keS/WU5AfbG1e 4ECA== X-Gm-Message-State: AC+VfDyyWhQfKpnuEGzTG6QRVEblRDqTNxmUAwzvCiDZ620d3HeApxm2 O5lsxuUIU4mq3pl43o0j/kzTOa0Cy8vs7Hq9r8pvYtZFXhY8wg== X-Google-Smtp-Source: ACHHUZ7I7PCRJAKFfgFHh7//mkxnTMML9uknKBHEopFACkfMp5L1+odhQitJrmN/jGZ41e8fsWNaUuiAH3KcmIMvtdk= X-Received: by 2002:a7b:c846:0:b0:3f7:3991:e12e with SMTP id c6-20020a7bc846000000b003f73991e12emr8889791wml.1.1687205538550; Mon, 19 Jun 2023 13:12:18 -0700 (PDT) MIME-Version: 1.0 References: <017db925-da75-8054-7a35-c65457cd03ae@php.net> In-Reply-To: <017db925-da75-8054-7a35-c65457cd03ae@php.net> Date: Mon, 19 Jun 2023 22:12:07 +0200 Message-ID: To: PHP Internals List Content-Type: multipart/alternative; boundary="000000000000c9d6d605fe812675" Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000c9d6d605fe812675 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > > > 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 nee= d to get > > > created: > > > > > > createFromInterval(DateTimeInterface $start, DateInterval $interval, > > > DateTimeInterface $end, int $options =3D 0) > > > =E2=86=92 createWithRange(DateTimeInterface $begin, DateTimeInterface= $end, > > > DateTimeInterface $int, int $options =3D 0) > > > > > > createFromRecurrences(DateTimeInterface $start, DateInterval $interva= l, > > > 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 still has an overloaded third argument =E2=80=94 DateTimeInterface|i= nt. > Where you trying to suggest to change the current existing __construct() > to: > > public function __construct(DateTimeInterface $start, DateInterval > $interval, DateTimeInterface $end, int $options =3D 0) > > and then add these two new factory methods? > > createFromRecurrences(DateTimeInterface $start, DateInterval $interval, > int $recurrences, int $options =3D 0) > > createFromISO8601String(string $specification, int $options =3D 0) > I really meant DateTimeInterface|int, not an overloaded signature but a union type. My concern is about providing the best path forward. Both deprecating and providing the alternative in the same version creates a lot of friction for end users. After a quick chat with Mate, I think we should do this union type *in addition* to adding the new static constructors. Then, later on, if future us think it's worth it, we might want to consider deprecating passing an integer. This would provide a path for BC/FC I would fully support. Nicolas --000000000000c9d6d605fe812675--