Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alexandru Pătrănescu
On Tue, Jun 25, 2024 at 1:00 AM Alex Wells wrote: > > a static class member can never implement an interface's contract > Well, PHP is a weird one here compared to other languages Interfaces can contain contracts for static methods and they are checked just like usual non-static methods. Exampl

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Stephen Reay
> On 25 Jun 2024, at 09:22, Mike Schinkel wrote: > >> On Jun 24, 2024, at 3:53 AM, Ayesh Karunaratne > > wrote: >> - Why is it a class-level flag and not an attribute (similar to the >> `#[Override]` attribute in PHP 8.3) ? > > From my perspective that would create much

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Mike Schinkel
> On Jun 24, 2024, at 3:53 AM, Ayesh Karunaratne wrote: > - Why is it a class-level flag and not an attribute (similar to the > `#[Override]` attribute in PHP 8.3) ? From my perspective that would create much confusion among every PHP developer who has not committed to memory when to use `static

Re: [PHP-DEV] Re: [RFC] [Vote] #[\Deprecated] attribute

2024-06-24 Thread Matthew Weier O'Phinney
On Mon, Jun 24, 2024, 7:35 PM Stephen Reay wrote: > > Sent from my iPhone > > On 24 Jun 2024, at 23:43, Matthew Weier O'Phinney < > mweierophin...@gmail.com> wrote: > >  > > > On Mon, Jun 24, 2024 at 10:08 AM Nicolas Grekas < > nicolas.grekas+...@gmail.com> wrote: > >> >> >> Le mer. 5 juin 2024

Re: [PHP-DEV] Re: [RFC] [Vote] #[\Deprecated] attribute

2024-06-24 Thread Stephen Reay
Sent from my iPhoneOn 24 Jun 2024, at 23:43, Matthew Weier O'Phinney wrote:On Mon, Jun 24, 2024 at 10:08 AM Nicolas Grekas wrote:Le mer. 5 juin 2024 à 10:18, Benjamin Außenhofer a écrit :On Wed, May 22, 2024 at 9:22 AM Benjamin Außenhofer

[PHP-DEV] Add $this return type

2024-06-24 Thread radar3301
I'm looking for initial feedback on the following proposal. Often, we have the following (fluent interface) setter method: public function setName(?string $name): static { $this->name = $name; return $this; } I propose to add "$this" as a return type, ie: public function setName(?strin

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alex Wells
On Tue, Jun 25, 2024 at 1:56 AM Bilge wrote: > Hi Alex, > > If you wish to implement data objects, what part of the current proposal > precludes you from doing so? > > None, but they both try to solve the same problem, so it's highly unlikely that data objects would ever be considered if this RF

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-24 Thread Larry Garfield
On Thu, Jun 20, 2024, at 5:38 PM, Larry Garfield wrote: > To that end, we're looking for *very high level* feedback on this RFC: > > https://wiki.php.net/rfc/pattern-matching Hi folks. Thank you to those who have offered feedback so far. Based on the discussion, here's what we're thinking of d

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-24 Thread Ilija Tovilo
On Mon, Jun 24, 2024 at 9:54 PM Robert Landers wrote: > > > The first means b is an optional key, but if it’s there, can only be a > > string. The second says b is a required key, but it may be a string or > > null. If there were a binding involved, that determines the type of the > > binding i

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
On 24/06/2024 22:56, Alex Wells wrote: Hey Bilge, I'm not usually a resident of these discussions, but it seems like this RFC is heading into a wrong direction. Let me explain: as it currently stands, static properties and methods live separately from instance properties and methods. That mea

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alex Wells
Hey Bilge, I'm not usually a resident of these discussions, but it seems like this RFC is heading into a wrong direction. Let me explain: as it currently stands, static properties and methods live separately from instance properties and methods. That means a couple of limitations, namely: a static

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-24 Thread Chuck Adams
> On Jun 24, 2024, at 1:53 PM, Robert Landers wrote: > > $arr = ['a' => 'a string']; > $arr is ['a' => string, ?'b' => $value, ...]; > > This syntax implies that a non-existent key is a special case, and if > it passes as-is, it will be. If there is a binding and the key is > missing, what happens

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Robert Landers
On Mon, Jun 24, 2024 at 10:22 PM Bilge wrote: > > On 24/06/2024 09:27, Claude Pache wrote: > > Hi, > > Hi Claude! I really appreciate your feedback. Everything you highlighted is > an important point that will be included in the RFC! > > A general remark: I appreciate that a static class does not

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
Hi again Jordi, On 24/06/2024 21:21, Bilge wrote: Hi Jordi, On 24/06/2024 13:22, Jordi Boggiano wrote: On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
Hi Jordi, On 24/06/2024 13:22, Jordi Boggiano wrote: On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good if it mentions that creating dynamic properties i.

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
On 24/06/2024 09:27, Claude Pache wrote: Hi, Hi Claude! I really appreciate your feedback. Everything you highlighted is an important point that will be included in the RFC! A general remark: I appreciate that a static class does not impose arbitrary restrictions (like: implicitly `final`) on

Re: [PHP-DEV] [RFC] [discussion] Correctly name the rounding mode and make it an Enum

2024-06-24 Thread Jordan LeDoux
On Wed, Jun 19, 2024 at 12:16 PM Claude Pache wrote: > > Second, “TowardsPositiveInfinity” is just a mouthful synonym for “Up”. You > could just name it: > > Round::Up > > At this point, you may invoke either Hamming or Levenshtein and compare it > negatively with `Round::HalfUp`. Yes there is a

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-24 Thread Robert Landers
On Mon, Jun 24, 2024 at 7:28 PM Chuck Adams wrote: > > > > On Jun 24, 2024, at 3:31 AM, Robert Landers > > wrote: > > > > > > There's no need to use `?` to check for existence on a key, so this: > > > > $arr is ['a' => string, ?'b' => string, ...]; > > > > should be this: > > > > $arr is ['a' =>

[PHP-DEV] Re: [RFC] [Vote] New ext-dom features in PHP 8.4

2024-06-24 Thread Niels Dossche
On 10/06/2024 20:10, Niels Dossche wrote: > Hi internals > > I'm opening the vote of my RFC "New ext-dom features in PHP 8.4". > RFC link: https://wiki.php.net/rfc/dom_additions_84 > Voting runs until 24th of June 21:00 GMT+2. > > Kind regards > Niels Hi internals The RFC was accepted with 25 y

Re: [PHP-DEV] Re: [RFC] [Vote] #[\Deprecated] attribute

2024-06-24 Thread Matthew Weier O'Phinney
On Mon, Jun 24, 2024 at 10:08 AM Nicolas Grekas < nicolas.grekas+...@gmail.com> wrote: > > > Le mer. 5 juin 2024 à 10:18, Benjamin Außenhofer a > écrit : > >> >> >> On Wed, May 22, 2024 at 9:22 AM Benjamin Außenhofer >> wrote: >> >>> The vote for the RFC #[\Deprecated] attribute is now open: >>>

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-24 Thread Chuck Adams
> On Jun 24, 2024, at 3:31 AM, Robert Landers wrote: > > > There's no need to use `?` to check for existence on a key, so this: > > $arr is ['a' => string, ?'b' => string, ...]; > > should be this: > > $arr is ['a' => string, 'b' => ?string, ...]; > > because $arr['non-existent-key'] is NU

Re: [PHP-DEV] Re: [RFC] [Vote] #[\Deprecated] attribute

2024-06-24 Thread Nicolas Grekas
Le mer. 5 juin 2024 à 10:18, Benjamin Außenhofer a écrit : > > > On Wed, May 22, 2024 at 9:22 AM Benjamin Außenhofer > wrote: > >> The vote for the RFC #[\Deprecated] attribute is now open: >> >> https://wiki.php.net/rfc/deprecated_attribute >> >> Voting will close on Wednesday 5th June, 08:00 G

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Jordi Boggiano
On 2024-06-24 01:10, Bilge wrote: I am pleased to present my first RFC: Static class . Just one point of feedback: for clarity I think it would be good if it mentions that creating dynamic properties i.e. $this->dynamicProp = 'bar' would also throw at ru

Re: [PHP-DEV] [Early Feedback] Pattern matching

2024-06-24 Thread Robert Landers
On Mon, Jun 24, 2024 at 7:04 AM Hendra Gunawan wrote: > > I agree that this proposal should be proposed as a whole. If we break > it down into smaller parts, there is a chance some features will not > pass. This is exactly my concern and I fear we will be dealing with the repercussions of a non-w

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Andreas Hennings
> I am pleased to present my first RFC: Static class To recap my opinion from the other thread: I generally support the idea to have a label to slap on all-static classes, to make that contract more explicit. The goal is not to promote a specific use of the language, but to add clarity to what alr

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Claude Pache
> Le 24 juin 2024 à 01:10, Bilge a écrit : > > Hi Internals! > > I am pleased to present my first RFC: Static class > . > > This work is based on the previous discussion thread on this list of the same > name, and hopefully captured all the relevant de

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Bilge
On 24/06/2024 07:59, Alexandru Pătrănescu wrote: On Mon, Jun 24, 2024, 02:15 Bilge wrote: Hi Internals! I am pleased to present my first RFC: Static class . Hi! and good luck with the RFC. Hi Alex, and thanks for your excellent feedback!

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Ayesh Karunaratne
> > This work is based on the previous discussion thread on this list of the > same name, and hopefully captured all the relevant details, > notwithstanding anything unanticipated that may present itself during > the implementation. Let me know if you feel anything important has been > missed. I am

Re: [PHP-DEV] [RFC] Static class

2024-06-24 Thread Alexandru Pătrănescu
On Mon, Jun 24, 2024, 02:15 Bilge wrote: > Hi Internals! > > I am pleased to present my first RFC: Static class > . > > Hi! and good luck with the RFC. While I don't use static classes, I can see how this can be used by others. I worked in big projects tha