Formatter Nullable [message #1749528] |
Wed, 07 December 2016 13:49  |
Eclipse User |
|
|
|
Hey guys,
I hope anyone read this posts.
I can not post a bug on github. I can not post a bug on https://bugs.eclipse.org/bugs/enter_bug.cgi?product=pdt
I create a class with one method. The method has PHP 7.1 nullable return type.
PHP Class before formatter:
<?php
class Test
{
public function get(string $name, int $index): ?array
{
}
}
When I format this class (CONTROL + STRG + F) remove the question mark.
<?php
class Test
{
public function get(string $name, int $index): array
{
}
}
I found on github this lines in:
File: org.eclipse.php.formatter.core.CodeFormatterVisitor
Method: visit()
Line start: 3409
[code]
...
if (functionDeclaration.getReturnType() != null) {
appendToBuffer(COLON);
insertSpace();
handleChars(lastPosition, functionDeclaration.getReturnType().getStart());
functionDeclaration.getReturnType().accept(this);
lastPosition = functionDeclaration.getReturnType().getEnd();
}
...
[/code>
i can check of PHP 7.1 and with
functionDeclaration.getReturnType().isNullable()
Please update this.
Very thx
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03616 seconds