Re: [VOTE] Shorter Attribute Syntax Change
| From: | Jakob Givoni | Date: | Wed, 12 Aug 2020 18:03:02 +0000 |
| Subject: | Re: [VOTE] Shorter Attribute Syntax Change | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111494@lists.php.net to get a copy of this message | ||
On Tue, Aug 11, 2020 at 3:03 PM Theodore Brown <theodorejb@outlook.com> wrote:
>
> On Tue, Aug 11, 2020 at 7:26 AM Chris Riley <t.carnage@gmail.com> wrote:
>
> > On Tue, 11 Aug 2020 at 13:21, Derick Rethans <derick@php.net> wrote:
> >
> > > On Tue, 11 Aug 2020, Chris Riley wrote:
> > >
> > > > Quick question.
> > > >
> > > > What is the expected behaviour of:
> > > >
> > > > @[Bar()];
> > > > class Foo {}
> > >
> > > That will error out in PHP 8, with:
> > >
> > > Parse error: syntax error, unexpected token ";" in Standard input code on
> > > line 2
> >
> > Is
> >
> > <?php @[Bar()]; ?>
> >
> > on it's own an error?
>
> Yes. Basically this is an example of valid code in PHP 7 that will
> break if @[] is adopted.
Wow, that was unexpected. By what logic?
Also, how long must I wait before I can put a semicolon after the new
attribute syntax? Is one whitespace enough or do I have to go to a new
line?
To me, suddenly disallowing semicolons at some points between
statements or between a "declaration" and a statement seems to break
PHP logic.
Are there any precedents for this that I've missed?
Best,
Jakob