plugin-php
plugin-php copied to clipboard
`{` and `}` for variable property
Prettier 1.14.3
PHP Plugin 0.8.0
Input:
$var = $this->{$key};
$var = $this->value->{$method}();
Output:
$var = $this->$key;
$var = $this->value->$method();
Expected behavior:
Need vote
:+1: for $this->{$key}
:heart: for $this->$key
I found what laravel, symfony and a lot of other projects use { and }, looks it is popular.
One note - we should respect { and } in source code, because it can be break php5 code http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.variable-handling.indirect.
My 2c: It's not often that I write code like this - usually it's a typo or copy/paste error, so adding curly braces would make it more explicit and obvious what is happening.