Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120573 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 32525 invoked from network); 14 Jun 2023 10:06:14 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 14 Jun 2023 10:06:14 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 883521804F8 for ; Wed, 14 Jun 2023 03:06:12 -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=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS30827 82.113.144.0/20 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Wed, 14 Jun 2023 03:06:11 -0700 (PDT) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 1D77F10C050; Wed, 14 Jun 2023 11:06:11 +0100 (BST) Date: Wed, 14 Jun 2023 11:06:10 +0100 (BST) To: Nicolas Grekas cc: PHP Internals List In-Reply-To: Message-ID: <017db925-da75-8054-7a35-c65457cd03ae@php.net> References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1180006235-1686737171=:36424" Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: derick@php.net (Derick Rethans) --8323329-1180006235-1686737171=:36424 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Tue, 13 Jun 2023, Nicolas Grekas wrote: > > I'm going to nitpick on the newly suggested names and argument order fo= r > > 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 $= end, > > 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 :-) > > >=20 > On my side, I'd very much prefer keeping the constructor of DatePeriod an= d > thus making it non-overloaded with this signature: >=20 > 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|int= =2E Where you trying to suggest to change the current existing __construct()=20 to: public function __construct(DateTimeInterface $start, DateInterval $interva= l, 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) That works for me. cheers, Derick --=20 https://derickrethans.nl | https://xdebug.org | https://dram.io Author of Xdebug. Like it? Consider supporting me: https://xdebug.org/suppo= rt Host of PHP Internals News: https://phpinternals.news mastodon: @derickr@phpc.social @xdebug@phpc.social twitter: @derickr and @xdebug --8323329-1180006235-1686737171=:36424--