You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by "Ádám Turcsán (JIRA)" <ji...@apache.org> on 2018/11/13 17:55:00 UTC

[jira] [Commented] (NETBEANS-53) PHP7.1 Setter/Getter code generation static types

    [ https://issues.apache.org/jira/browse/NETBEANS-53?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16685539#comment-16685539 ] 

Ádám Turcsán commented on NETBEANS-53:
--------------------------------------

Of course.

 

The case that when I have a class like this:
{code}
<?php

class Testtest
{
    /**
     * @var int
     */
    private $intProp;

    /**
     * @var string
     */
    private $stringProp;

    /**
     * @var bool
     */
    private $booleanProp;
}
{code}
It generates getters/setters without proper typehints but methods like these:
{code}
    public function getIntProp()
    {
        return $this->intProp;
    }

    public function getStringProp()
    {
        return $this->stringProp;
    }

    public function getBooleanProp()
    {
        return $this->booleanProp;
    }

    public function setIntProp($intProp)
    {
        $this->intProp = $intProp;
    }

    public function setStringProp($stringProp)
    {
        $this->stringProp = $stringProp;
    }

    public function setBooleanProp($booleanProp)
    {
        $this->booleanProp = $booleanProp;
    }
{code}
My expectation would be methods like these:
{code}
        public function getIntProp(): int
    {
        return $this->intProp;
    }

    public function getStringProp(): string
    {
        return $this->stringProp;
    }

    public function getBooleanProp(): bool
    {
        return $this->booleanProp;
    }

    public function setIntProp(int $intProp)
    {
        $this->intProp = $intProp;
    }

    public function setStringProp(string $stringProp)
    {
        $this->stringProp = $stringProp;
    }

    public function setBooleanProp(bool $booleanProp)
    {
        $this->booleanProp = $booleanProp;
    }
{code}
 

As strange as it may seem nullable types work well, only these three have this little hiatus (or only these have come to my attention).

> PHP7.1 Setter/Getter code generation static types
> -------------------------------------------------
>
>                 Key: NETBEANS-53
>                 URL: https://issues.apache.org/jira/browse/NETBEANS-53
>             Project: NetBeans
>          Issue Type: Improvement
>          Components: php - Editor
>            Reporter: Ádám Turcsán
>            Priority: Major
>
> The Insert code... / Setters/getters... functionality works great and uses the docblock typehints as well but with static types (int, string) it generates the setters and getter without argument types or return types.
> It would be great if it could work with static types as well.



--
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