Function name after newline not classified correctly
Opened this issue · 1 comments
roblourens commented
<?php
$x = new class {
public function
test(string $hi): string {
return $hi;
}
};
?>
<div class="xyz"></div>
- Check scopes at
test
, see that it's a function callmeta.function-call.php
. This newline is allowed
<?php
$x = new class {
public function test(string $hi): string {
return $hi;
}
};
?>
<div class="xyz"></div>
- Now it's a function in a class body
entity.name.function.php
meta.function.php
meta.class.body.php
Not a problem normally but I think it is the root cause behind an issue like microsoft/vscode#124381 where unexpected syntax in the first context causes more problems
KapitanOczywisty commented
This is very strange formatting, and I'm not sure if we should even fix this. We are supporting PSR format and this should be used. We're unable to make TM based syntax 100% accurate and we need to draw a line somewhere.
For the records code responsible for this:
language-php/grammars/php.cson
Lines 639 to 648 in be4396c