[ https://issues.apache.org/jira/browse/NETBEANS-2413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16904702#comment-16904702 ]
Tomáš Procházka commented on NETBEANS-2413: ------------------------------------------- I tried to find where scalar types are lost (because class names work well). In method org.netbeans.modules.php.editor.codegen.CGSInfo.PropertiesVisitor.getFirstTypeFromTag() is in condition "!Type.isPrimitive(type)". If this condition is removed, then scalar types are generated as part of code. I understand, that this condition is necessary for PHP <7, but for PHP >7 scalar types can be used. Similar problem is also for type "array". > 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: 10.0, 11.0 > Reporter: Imb > Priority: Minor > > 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.14#76016) --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org For additional commands, e-mail: commits-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists