PHP Type Hinting using Netbeans

Approach 1:
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

Popular posts from this blog

Optimize SSD on Linux

Manually clean up zimbra zmcat/zmcpustat exploit

Ports to allow for whatsapp call