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:
https://wiki.php.net/rfc/typed_class_constants?rev=1648644637

The updated RFC looks good, thanks for working on it. You may want to
review the revised version I had worked on for implementation ideas, and
review the previous conversations.

The primary concept missing is declared but unassigned class constants,
which must then be assigned a value in the concrete class. See the section
on my revised version "Inheritance and variance". That'll be a question of
if that can or should be included in this RFC or not. It provides the most
value, allowing for inheritance from a parent class to ensure the value is
set and typed in the concrete class.

- Mark Niebergall


On Tue, Jan 31, 2023 at 5:55 PM Ondřej Mirtes <ond...@mirtes.cz> wrote:

> 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 <kocsismat...@gmail.com> 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 implementation (namely,
> with
> > the parser)
> > so the RFC was stuck.
> >
> > A few weeks ago, I reached out to Benas whether he intended to resurrect
> > the proposal, but
> > due to time constraints, he couldn't, and was OK with me continuing it.
> > With some help from
> > Bob Weinand, I managed to overcome the implementation difficulties, and
> > adapted it
> > to the newly added type-related features.
> >
> > Please find the updated RFC here:
> > https://wiki.php.net/rfc/typed_class_constants.
> >
> > Regards,
> > Máté
> >
> --
>
> Ondřej Mirtes
>

Reply via email to