On Wed, Aug 12, 2020 at 9:08 PM Rowan Tommins <rowan.coll...@gmail.com> wrote: > > On 12 August 2020 19:03:02 BST, Jakob Givoni <ja...@givoni.dk> wrote: > >> > 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. > > > It's not that the semicolon is forbidden as such, it's that the code is > interpreted completely differently. > > Imagine if we had no "private" keyword, and then added it; this would > previously have been valid (a statement followed by a declaration): > > private; function foo () {}
Ok, that's starting to make sense. Having seen so many attribute examples lately I started to get the impression that you could basically insert them anywhere (like comments) - even if it didn't technically make any sense... Reading the original RFC again I understand that an attribute MUST be directly followed by a function, class, interface, traits, class constant, class property, class method, function/method parameter, a docblock or another attribute. I hope I didn't forget anything... Sorry, I'm just a sucker for details and accuracy :-) Thanks, Jakob -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php