Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » PHP Development Tools (PDT) » Formatter Nullable(Formatter remove Nullable)
Formatter Nullable [message #1749528] Wed, 07 December 2016 18:49 Go to next message
Rene Dziuba is currently offline Rene DziubaFriend
Messages: 4
Registered: December 2016
Junior Member
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 #1749536 is a reply to message #1749528] Wed, 07 December 2016 21:12 Go to previous messageGo to next message
Derek Toolan is currently offline Derek ToolanFriend
Messages: 23
Registered: May 2016
Junior Member
"I can not post a bug on https://bugs.eclipse.org/bugs/enter_bug.cgi?product=pdt":

Can you please send an email to webmaster at eclipse dot org requesting Bugzilla permissions.
Re: Formatter Nullable [message #1749579 is a reply to message #1749536] Thu, 08 December 2016 10:12 Go to previous messageGo to next message
Rene Dziuba is currently offline Rene DziubaFriend
Messages: 4
Registered: December 2016
Junior Member
Thx for answer.

I have send this the webmaster.
PHP 7.1 is since 1 week out.

Why is PHP 7.1 not supported?
I see the changes on github before 4 months ago.
Re: Formatter Nullable [message #1749590 is a reply to message #1749579] Thu, 08 December 2016 13:08 Go to previous messageGo to next message
Michal Niewrzal is currently offline Michal NiewrzalFriend
Messages: 50
Registered: July 2009
Member
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 Go to previous messageGo to next message
Rene Dziuba is currently offline Rene DziubaFriend
Messages: 4
Registered: December 2016
Junior Member
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. Embarrassed
Re: Formatter Nullable [message #1749729 is a reply to message #1749604] Sat, 10 December 2016 11:36 Go to previous messageGo to next message
Rene Dziuba is currently offline Rene DziubaFriend
Messages: 4
Registered: December 2016
Junior Member
The formattter works fine with the last-nightly-build.

Very thx for our hard work and a nice weekend.

LG Rene
Re: Formatter Nullable [message #1749738 is a reply to message #1749729] Sat, 10 December 2016 15:27 Go to previous message
Michal Niewrzal is currently offline Michal NiewrzalFriend
Messages: 50
Registered: July 2009
Member
Nice to hear that Smile 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?
Previous Topic:Turning PDT to a language server API?
Next Topic:Support for HHVM (specifically remote debugging with Xdebug)
Goto Forum:
  


Current Time: Sat Nov 09 03:05:27 GMT 2024

Powered by FUDForum. Page generated in 0.02842 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top