Formatter Nullable [message #1749528] |
Wed, 07 December 2016 18: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
|
|
|
|
|
Re: Formatter Nullable [message #1749590 is a reply to message #1749579] |
Thu, 08 December 2016 13:08   |
Eclipse User |
|
|
|
Quote:Why is PHP 7.1 not supported?
What do you mean exactly? You can create project that will support PHP 7.1 syntax. Of course you can face bigger or smaller problems (like described problem with formatter) but in general PHP 7.1 is supported.
|
|
|
Re: Formatter Nullable [message #1749604 is a reply to message #1749590] |
Thu, 08 December 2016 14:15   |
Eclipse User |
|
|
|
I can read under the preferences menu
PHP -> Interpreters -> PHP 7.1 (EXPERIMENTAL)
Oops, pdt has not features for create classes, interfaces and traits.
This is a plugin from others.
|
|
|
|
Re: Formatter Nullable [message #1749738 is a reply to message #1749729] |
Sat, 10 December 2016 15:27  |
Eclipse User |
|
|
|
Nice to hear that At the end of December there will be official release of PDT (Eclipse Neon.2). Can you close bugzilla issue with annotation that it works ok with your build?
|
|
|
Powered by
FUDForum. Page generated in 0.05170 seconds