To specify a variable is an array of objects:
$needles = getAllNeedles();
/* @var $needles Needle[] */
$needles[1]->... //codehinting works
This works in Netbeans 7.2 (I'm using it)
Works also with:
$needles = getAllNeedles();
/* @var $needles Needle[] */
foreach ($needles as $needle) {
$needle->... //codehinting works
}
Therefore use of declaration inside the foreach
is not necessary.