Re: Class name resolution for \array::class

From: Date: Mon, 01 Oct 2018 12:27:06 +0000
Subject: Re: Class name resolution for \array::class
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-103295@lists.php.net to get a copy of this message
They are still not classes On Mon, 1 Oct 2018, 14:24 Marcos Passos, <marcospassos.com@gmail.com> wrote: > Rowan, thank you for sharing your thoughts. > > You can also see it as a language construct that expects a type at the > left-hand side of the name resolution operator. In that sense, primitive > types are perfectly valid. > > Regards, > Marcos > > Em seg, 1 de out de 2018 às 05:45, Rowan Collins <rowan.collins@gmail.com> > escreveu: > > > On Mon, 1 Oct 2018 at 00:30, Marcos Passos <marcospassos.com@gmail.com> > > wrote: > > > >> Currently, class name resolution supports all types except an array. > >> https://3v4l.org/OXFMW > >> > > > > It seems to me that the bug is allowing an expression like "int::class" > to > > resolve, when "int" is no longer a legal class name. > > > > I suspect the reason "array::class" doesn't work is that it was already a > > reserved word in PHP 5, whereas other types were legal class names. In > PHP > > 5, "int::class" can plausibly resolve to the name of an actual class, but > > in PHP 7, it can't, but clearly this part of the grammar wasn't updated > to > > reflect that. > > > > The parser is being too forgiving here, I think, and should complain if > > the word before :: is not a valid class name. > > > > Regards, > > -- > > Rowan Collins > > [IMSoP] > > >

« previous php.internals (#103295) next »