Re: Short class syntax and inner classes
| From: | Rob Landers | Date: | Fri, 07 Feb 2025 15:42:29 +0000 |
| Subject: | Re: Short class syntax and inner classes | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126336@lists.php.net to get a copy of this message | ||
On Fri, Feb 7, 2025, at 16:05, Tim Düsterhus wrote:
> Hi
>
> Am 2025-02-07 15:23, schrieb Rob Landers:
> > Instantiation is done by static access: new Outer::Inner(1), which is
> > currently a syntax error.
>
> How would I access static members on an inner class without having
> ambiguity?
Outer::Inner::Const already is valid syntax.
I can actually answer this one. The name of an inner class must not conflict with either a const or
a method in the outer class because this is also currently valid syntax new
(Outer::Inner::Const) where it resolves to a string of an existing class or new
(Outer::Inner::Method()) where it returns a string to an existing class.
— Rob