PHP Type Hinting using Netbeans
Approach 1:
Return type declaration:
Approach 2:
Using annotation @var
Approach 3:
Using annotation @return
I preferred approach 2 and 3
For PHP 7.1 support, use nightly build of netbeans from here: http://bits.netbeans.org/download/trunk/nightly/latest/
Return type declaration:
<?php function getUser(): User { //... } $a = getUser(); $a-> // PRESS CTRL-SPACE TO AUTO COMPLETE
Approach 2:
Using annotation @var
<?php function getUser() { //... } /* @var $a User */ $a = getUser(); $a-> // PRESS CTRL-SPACE TO AUTO COMPLETE
Approach 3:
Using annotation @return
<?php /** * @return User */ function getUser() { //... } $a = getUser(); $a-> // PRESS CTRL-SPACE TO AUTO COMPLETE
I preferred approach 2 and 3
For PHP 7.1 support, use nightly build of netbeans from here: http://bits.netbeans.org/download/trunk/nightly/latest/
Comments