Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:120581 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 96284 invoked from network); 15 Jun 2023 03:29:46 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 15 Jun 2023 03:29:46 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9318C180340 for ; Wed, 14 Jun 2023 20:29:45 -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,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-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 ; Wed, 14 Jun 2023 20:29:45 -0700 (PDT) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-30fb7be435dso3669354f8f.1 for ; Wed, 14 Jun 2023 20:29:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=datadoghq.com; s=google; t=1686799784; x=1689391784; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sMFTgEYp2AxVqgVqpYhkIonmW/YorimlawfYnfxXcEY=; b=eqXBLj/o0nSuQ+a7IS74RSthg09FDKtcYnKOtZ/y+4vGbOawSFC0C5lpsXTNTfUla+ F+18EPoRzhAWVJ4bDtyM7ko3OOdvegMmDbDzGTWISJt6hWxM7aYMdxHrKfbDGEfJ3ncE LEKhcZrX8PNbkGJtGiv6FEuWuD3XKF16X5ZII= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686799784; x=1689391784; h=content-transfer-encoding:cc: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=sMFTgEYp2AxVqgVqpYhkIonmW/YorimlawfYnfxXcEY=; b=dXZZ/zF0nrEGBG3RNv/NFMYTfAHA2YMV3aNKJp6B1ZXgwVaYk7r0uw301NRUSWYBIc M6rQPSf0OVYk4reVFXK66Yog9K6kvkTfZ5b7h7nCt7xM/d0r1DRX8llEUDrum9XCHFFm Dx3rfbH9q49ZbPg8BNJnF8brrCdG8UFb3FSk6vaEZfZTAJfWR3fYgnt9Qwb3EupdwLnL 8rvxDXnK9TmUx2ewnJ8kVsVjq86aZz9WBae3tEC7n3oyvefBYRfX56kT/Ywjh3mu8tQv WqN7gx7viV0dGdwYKMxdTh9O/ZFpRTwxfJEFrQ5M6K7lggmSTk+iWzbGPjhYkEbHBFbj fakA== X-Gm-Message-State: AC+VfDwOxEQ7FbrRGyH6lnIpenpSmTsz2UrzzYROcgsXqsTdaNBnaXoZ y/7/XhYyvqlvA6xxOOqEiGrysiSTK13/3qG5qX6zfA== X-Google-Smtp-Source: ACHHUZ711XSRZDrQqNYP0UladQJZTYBW5Yg3cTn2Xk2Ea4RyZv4XtraOIKecXU6Mvw/T6AVNQBoqNUSwlNyM7F5rNhA= X-Received: by 2002:a5d:5584:0:b0:30f:c576:633b with SMTP id i4-20020a5d5584000000b0030fc576633bmr6499516wrv.66.1686799783767; Wed, 14 Jun 2023 20:29:43 -0700 (PDT) MIME-Version: 1.0 References: <017db925-da75-8054-7a35-c65457cd03ae@php.net> In-Reply-To: <017db925-da75-8054-7a35-c65457cd03ae@php.net> Reply-To: Levi Morrison Date: Wed, 14 Jun 2023 21:29:32 -0600 Message-ID: To: Derick Rethans Cc: Nicolas Grekas , PHP Internals List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] [RFC] [Discussion] Deprecate functions with overloaded signatures From: internals@lists.php.net ("Levi Morrison via internals") On Wed, Jun 14, 2023 at 4:06=E2=80=AFAM Derick Rethans wro= te: > > On Tue, 13 Jun 2023, Nicolas Grekas wrote: > > > > 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. This specific case is not that problematic. Since things need untangling anyway, I would feel free to improve it if something is done, but it's not much of a problem. The problem is when there's a wildly different signature, or if args change the return type structure, etc. So in this case, the problem is really: public function __construct(string $isostr, int $options =3D 0) {} Which can't really be unified with the others very well.