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: [email protected]
For additional commands, e-mail: [email protected]

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

Reply via email to