You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Imb (JIRA)" <ji...@apache.org> on 2019/04/14 12:40:00 UTC

[jira] [Created] (NETBEANS-2413) Type declarations not included when using Insert Code > Getter and Setter

Imb created NETBEANS-2413:
-----------------------------

             Summary: Type declarations not included when using Insert Code > Getter and Setter
                 Key: NETBEANS-2413
                 URL: https://issues.apache.org/jira/browse/NETBEANS-2413
             Project: NetBeans
          Issue Type: Bug
          Components: php - Editor
    Affects Versions: 11.0, 10.0
            Reporter: Imb


Say you have this class

class Foo
{
    /**
     * foo
     *
     * @var string
     */
    private $foo;
}

then you use Menu > Source > Insert Code > Getter and Setter, the generated code won't include "string" as type declaration. E.g.,

public function getFoo(): int
{
    return $this->foo;
}

public function setFoo($foo)
{
    $this->foo = $foo;
    return $this;
}

However, if you leave the default type hint in the comment (which is literally "type"), e.g..,

class Foo
{
    /**
     * foo
     *
     * @var type
     */
    private $foo;
}

the code generated will be as expected:

public function getFoo(): string
{
    return $this->foo;
}

public function setFoo(string $foo)
{
    $this->foo = $foo;
    return $this;
}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists