Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115861 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 26353 invoked from network); 26 Aug 2021 14:22:59 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 26 Aug 2021 14:22:59 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E508B1804D8 for ; Thu, 26 Aug 2021 07:57:28 -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=-0.6 required=5.0 tests=BAYES_00,BODY_8BITS, 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 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-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 26 Aug 2021 07:57:28 -0700 (PDT) Received: by mail-lf1-f41.google.com with SMTP id i28so7527354lfl.2 for ; Thu, 26 Aug 2021 07:57:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=R5GeQkA+YD/WkZb/h473z/E+scOZCCZkOd7fZsVvFX8=; b=QMU3lfoUID9KnIqmdM1ukGTdd57qB5hy/OjYBN8RULSd8FEE60IzsVnuDHFfMt4MtJ 3NQO5hfn2pWk1WuXbgAAAdSf75VF98gSNT0Bp11CaMPVU7N1rd5IZ+/2F5U5GUrSES2x oWpiw8TaQP86ml1PuYmayGAV94z8xEqM3x0CeJ2iHsHR6kVJw6FqpX+lHFIYLEPyLXnj zJrsBG143gWKZxSY115emw3q+iOmXVQruY0cyAkVF2gu+dTt1feQzFuFMtwcKpnUx523 owMHr73V9TCXxMaAVd1CwbUY4rPzQXBHh85JDdbunODcSl7ICr+jCkIrJMw0OtVGs9WJ XEcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=R5GeQkA+YD/WkZb/h473z/E+scOZCCZkOd7fZsVvFX8=; b=MwNRb/Tv7kwsJaDiyXASFYlBi0uHpBEv1TCCWAKrgKQ1iibxYBIrH5YW5+D93TEwtw xXXUXwJtFP0fibUMSurFafgKGUubRBbitIVYs5pzDdM0s3w0QqL9/PYZKjB3VEHV5sE4 Wqv3O6NxSL4UocT44v1chIC5olM+hl+DACBEC2w1UP9ql+2QhTxDN836GydemJcP9TUt tDTPjELYG/8ACdhCXroynfKVVaJJpHF4O+2kGHiw6SX408RCJFiy/MXxr5XBO0SYepJc qcuD2lsv3auD0KatgSmRhuk0sj1M1TIAjvkIZTxIekvD2tElUda5zPRBuoEGFumIXKGU az/A== X-Gm-Message-State: AOAM533VcF3PIxozruUPg8wT4iuquGKd22b1GyOxypwy+8IkYlI4WdBe wwXChATfROSISbDbm3AfD9r/dPBXqlhGcsu82fNvwrdY3kU= X-Google-Smtp-Source: ABdhPJySvp3DPdem7BpKrRMD6I+tAUHUTEB6Y0fdUQd+WY03uxV9fr0UzqSqA7HGVixrkv46y0GJ2cza77jxp/b1eTc= X-Received: by 2002:a05:6512:1087:: with SMTP id j7mr3029560lfg.638.1629989846901; Thu, 26 Aug 2021 07:57:26 -0700 (PDT) MIME-Version: 1.0 References: <775dc98a-b3c5-d498-71f7-9f19ff891f29@telia.com> In-Reply-To: Date: Thu, 26 Aug 2021 16:57:11 +0200 Message-ID: To: Dan Ackroyd Cc: =?UTF-8?Q?Bj=C3=B6rn_Larsson?= , Philip Hofstetter , php internals Content-Type: multipart/alternative; boundary="000000000000cfe80b05ca779510" Subject: Re: [PHP-DEV] Re: 8.1 / Exception / Property Type / Backwards compatbility From: nikita.ppv@gmail.com (Nikita Popov) --000000000000cfe80b05ca779510 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Aug 26, 2021 at 4:43 PM Dan Ackroyd wrote: > On Thu, 26 Aug 2021 at 12:42, Bj=C3=B6rn Larsson via internals > wrote: > > > > Den 2021-08-10 kl. 11:55, skrev Philip Hofstetter: > > > The following valid <=3D PHP 8.0 code that intends to make the $line > property > > > public is a fatal error in 8.1 > .... > > > > > > For method return types, we have #[ReturnTypeWillChange], but for > property > > > types =F0=9F=A4=B7=E2=80=8D=E2=99=80=EF=B8=8F > > > Hi, > > > > Has this been adressed / solved in some way and does it needs > > to be fixed? > > My understanding is that the two scenarios are not the same and that > there isn't much enthusiasm for 'fixing' it. > > For return types, the #[ReturnTypeWillChange] annotation is a > temporary work-around, and one that would be used by a lot of people. > It would only be used by a library until that library drops support > for older versions of PHP. > > For the exception case, the way that (for legacy reasons) PHP supports > having a public property in a child class that "overwrites" (mostly) > the protected property in the parent class, is a pretty hinkey thing > to do, and so this is likely to only affect a small number of people. > It's not obvious to me how long a bridging annotation would need to > hang around for, and it's really not obvious what the exact details of > how it would work would be. > > I'd suggest using a getter method, which would work on all relevant > versions. > Right. I at least do not plan to address this issue. If you take a protected property and publicly re-export it, then any compatibility issues are on you. If you need to keep doing this for API stability reasons, then the way to do it would be a conditional class declaration. Or to keep the scope smaller, you can conditionally declare a trait with just the property and then use it inside a larger class. Regards, Nikita --000000000000cfe80b05ca779510--