To get PHP 5.4 features available in the existing project go to Project Properties -> Sources -> PHP Version and select PHP 5.4. When creating a new project using New Project Wizard select PHP version from the drop-down menu on the second screen Name and Location.
You can find more on array dereferencing in RFC on PHP Wiki. 
class MyCollection
{
    public function doSomething()
    {
        
    }
}
class ArrayDereferencing
{
    /**
     *
     * @var MyCollection[]
     */
    private $myCollection = array();
    /**
     *
     * @return MyCollection[]
     */
    public function getCollection()
    {
        return $this->myCollection;
    }
    public function getElementAndDoSomething($index)
    {
        return $this->getCollection()[$index]->doSomething();
    }
}
Code completion in the NetBeans PHP Editor:
Ondrej Brejla in the article PHP 5.4 Support: Array Dereferencing on Oracle blog called user to test new PHP 5.4 features and file (component PHP, subcomponent Editor) any issues found.
 
 
No comments:
Post a Comment