Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-27 Thread Máté Kocsis
Hi Claude, > Although they are not explicitly mentioned, I assume that typed constants > are also available on traits? > Yes, sure! I've just clarified the RFC by mentioning this fact as well as adding an example. Regards, Máté

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-26 Thread Claude Pache
> Le 23 févr. 2023 à 16:51, Máté Kocsis a écrit : > > As the RFC text is now finalized, I intend to start the vote on Monday. > > Regards, > Máté Hi Máté, I’ve just read the new version of the RFC. It seems ok to me. Just a small remark: Although they are not explicitly mentioned, I

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-23 Thread Máté Kocsis
Hey Claude, Sorry for my last response, I didn't understand you indeed... Enums really do support self/static types. So I've just updated the implementation + removed the restrictions in question from the RFC + added a future scope section containing some information about the existing

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-21 Thread Máté Kocsis
Hi Claude, No, I didn't misunderstand you, I just didn't specify my answer enough: Enums can be assigned to their own class constants because of their special behavior, namely that enum cases are evaluated and then instantiated right away, during the compilation of the enum case. This is easily

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-17 Thread Claude Pache
Hi Máté, I think you didn’t understand me, so I’ll restate: > To be exact, defining class constants with the class itself as value is > already impossible: https://3v4l.org/J7C30 No, for some specific sort of class, namely for enum, it is absolutely possible to define a constant with an

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-17 Thread Máté Kocsis
Hi Claude, The RFC states that it is technically not possible to have a constant of > effective type `static` or `self`. While this is probably correct for > regular classes, this is not true for enums. The following code ostensibly > works (https://3v4l.org/84W92): > To be exact, defining class

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-06 Thread Mark Niebergall
Dan, On Sat, Feb 4, 2023 at 8:34 AM Dan Ackroyd wrote: > Hi Mark, > > On Sat, 4 Feb 2023 at 00:22, Mark Niebergall > wrote: > > > > This is also a bigger policy question for other seemingly-abandoned > > RFCs. If it is agreed that a new RFC should be created in this scenario, > > I've added

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-06 Thread Mark Niebergall
Benas, On Sun, Feb 5, 2023 at 9:29 AM Benas IML wrote: > [copy of the email that I have accidentally sent to Mark individually] > > Hey, > > As much as I appreciate your enthusiasm and ideas, adding your name on > my original RFC and editing its contents without my approval is not > acceptable.

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-05 Thread Benas IML
[copy of the email that I have accidentally sent to Mark individually] Hey, As much as I appreciate your enthusiasm and ideas, adding your name on my original RFC and editing its contents without my approval is not acceptable. Especially considering that contents of the RFCs are a direct

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-04 Thread Dan Ackroyd
Hi Mark, On Sat, 4 Feb 2023 at 00:22, Mark Niebergall wrote: > > This is also a bigger policy question for other seemingly-abandoned > RFCs. If it is agreed that a new RFC should be created in this scenario, I've added some notes on the page https://wiki.php.net/rfc/howto I had some words

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-03 Thread Mark Niebergall
Máté, Benas, Internals, On Fri, Feb 3, 2023 at 7:34 AM Máté Kocsis wrote: > Hi Alexandru, Mark, > > > > 1. Why is object type not supported? I can't see a real reason and also > > there is no explanation why. > > > > Sorry for this, mentioning object as unsupported was an artifact from the >

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-03 Thread Claude Pache
> Le 31 janv. 2023 à 22:01, Máté Kocsis a écrit : > > > Please find the updated RFC here: > https://wiki.php.net/rfc/typed_class_constants. > > Regards, > Máté Hi, The RFC states that it is technically not possible to have a constant of effective type `static` or `self`. While this is

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-03 Thread Flávio Heleno
On Fri, Feb 3, 2023 at 11:34 AM Máté Kocsis wrote: > Hi Alexandru, Mark, > > > > 1. Why is object type not supported? I can't see a real reason and also > > there is no explanation why. > > > > Sorry for this, mentioning object as unsupported was an artifact from the > original version of the

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-02-03 Thread Máté Kocsis
Hi Alexandru, Mark, > 1. Why is object type not supported? I can't see a real reason and also > there is no explanation why. > Sorry for this, mentioning object as unsupported was an artifact from the original version of the RFC which was created back then when constants couldn't be objects.

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-01-31 Thread Alexandru Pătrănescu
On Tue, Jan 31, 2023 at 11:01 PM Máté Kocsis wrote: > Hi Everyone, > > A few years ago, Benas Seliuginas announced the "Typed constants" RFC ( > https://externals.io/message/110755) which apparently had a > positive reception overall. > Unfortunately, there were some issues with the

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-01-31 Thread Mark Niebergall
I initiated a conversation about the typed constants RFC back in March 2022: https://externals.io/message/117406 I had updated the RFC page, but it looks like the changes were reverted in December 2022. The updated version I was working on was:

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-01-31 Thread Ondřej Mirtes
I fully support this RFC. PHPStan added support for PHPDoc types in class constants some time ago - it’s useful to rely on the same constant type even in subclasses when accessing them via static:: or $object::. On Tue 31. 1. 2023 at 22:01, Máté Kocsis wrote: > Hi Everyone, > > A few years ago,

Re: [PHP-DEV] [RFC] [Discussion] Typed class constants

2023-01-31 Thread Larry Garfield
On Tue, Jan 31, 2023, at 3:01 PM, Máté Kocsis wrote: > Hi Everyone, > > A few years ago, Benas Seliuginas announced the "Typed constants" RFC ( > https://externals.io/message/110755) which apparently had a > positive reception overall. > Unfortunately, there were some issues with the

[PHP-DEV] [RFC] [Discussion] Typed class constants

2023-01-31 Thread Máté Kocsis
Hi Everyone, A few years ago, Benas Seliuginas announced the "Typed constants" RFC ( https://externals.io/message/110755) which apparently had a positive reception overall. Unfortunately, there were some issues with the implementation (namely, with the parser) so the RFC was stuck. A few weeks