This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Type hinting for php doc blocks | ||
---|---|---|---|
Product: | php | Reporter: | djungowski <djungowski> |
Component: | Editor | Assignee: | Ondrej Brejla <obrejla> |
Status: | RESOLVED WORKSFORME | ||
Severity: | blocker | CC: | pcdinh |
Priority: | P3 | ||
Version: | 7.3 | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
djungowski
2009-04-30 09:53:28 UTC
It would be cool to see such a thing. As Frameworks like Zend Framework, getting wider to use, this kind of type hintings will be more used. I guess this would be a cool addition to see this :) Sorry this has come to my mind just a bit later I have written the last comment. This might a bit extend to this: I have a function/method such as this: class Foo { public function bar(Test $var) { //Some code here return new Foo(); } } And when I insert the doc block it enters like this: /** * * @param <type> $var * @return <type> */ As I have indicated the return type by calling of a constructor (or new keyword), it might be easy to find out which class this was and insert a block like this: /** * * @param Test $var * @return Foo */ Another thing might be in usage of this: class Foo { public function bar(Test $var) { /** * @var array */ $var2 = $var->getAsArray(); //Some code here return $var2; } } As the type hinting is done via a doc block, it might be not that hard to create a doc block such as: /** * * @param Test $var * @return array */ It might not be required to hint the type of $var2 as I know from another doc block that getAsArray() returns a variable of type array. Sorry if this has gone a bit crazy, I just thought, these might be cool :) reassigning to default owner batch reassigning *** Bug 164221 has been marked as a duplicate of this bug. *** Works properly in 7.2. Hy, sry but i have the same problem @7.3 public function test(){ /** * @var array */ $testArray= array(); return $testArray; } if i gen the doc with /**<tab> over the function, it will be generate follow documantation /** * @return type */ public function test(){ /** * @var array */ $testArray= array(); return $testArray; } There are more things. The phpdoc inside a function is improper. It can't be there. If you want to use some doc to define a type of a variable, use VARDoc, i.e. /* @var $testArray array */ (1 asterisk, @var annotation, variable name and variable type). But in this case it works for me even without any vardoc comment, just with: <?php /**^ function test(){ $testArray= array(); return $testArray; } ?> If I enter on caret (^), then the result is proper. <?php /** * * @return array */ function test(){ $testArray= array(); return $testArray; } ?> So sorry, it has to be an issue on your side. Try fresh reinstal of NB without importing of old settings. Product Version: NetBeans IDE 7.3 (Build 201302132200) Java: 1.6.0_34; Java HotSpot(TM) Client VM 20.9-b04 Runtime: Java(TM) SE Runtime Environment 1.6.0_34-b04 System: Linux version 3.5.0-25-generic running on i386; UTF-8; cs_CZ (nb) |