Hi Christian Schneider, > > return [success: true, data: $data, cursor: $cursor]; > > // is equivalent to the following, but shorter: > > return ['success' => true, 'data' => $data, 'cursor' => $cursor]; > > Just a little side-note: A while ago I proposed a 2-line-patch to allow :$foo > as a synonym for 'foo' => $foo. > > This allows for > return ['success' => true, :$data, :$cursor]; > which is both shorter and removes repetition while keeping the variable usage > $data and $cursor visible. > > I know that this has been shot down before but I couldn't resist mentioning > it in this context, sorry ;-)
I'd also implemented the same thing at https://github.com/php/php-src/pull/6635 and reverted it - didn't see that when the PR was first created > It had also suggested `:$var` or `=$var` as shorthand for `var: $var`, > but this is going to be left out of this proposal > https://externals.io/message/101698 has mostly negative feedback on a recent > proposal (and there are multiple syntax candidates) That was left out - I expected it would get less votes than just `var: $var` for reasons mentioned in https://externals.io/message/101698 Based on past RFCs I've seen, I'd assume an RFC would fail if most feedback was proposing alternate solutions or arguing against it, like it is here. And voting results for https://wiki.php.net/rfc/bare_name_array_literal were mostly negative. I'd hoped named arguments using the same syntax might raise interest in this, but it doesn't look like it so far. E.g. short functions in https://externals.io/message/113751 had some positive feedback, but still got less than 2/3 votes Thanks, Tyson -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php