0

is it possible to get code hinting if you have a parameter of array of objects.

This works:

/**
 * @return MyObject[]
 */
public function moo() {
   return array(new MyObject(), new MyObject());
}

public function bla() {
  foreach ($this->moo() as $obj) {
     $obj->IGetCodeHintingHere(); 
  }
}

Is the same way possible with @param like @return? For example like this:

/**
 * @param $MyObject[]
 */
public function bla(array $aaa) {
  foreach ($aaa as $a) {
     $a->IWantGetCodeHintingHereToo(); 
  }
}
OOPDeveloper89
  • 207
  • 5
  • 18

1 Answers1

0

Possible duplicate of:

PHPDoc type hinting for array of objects?

and

How can I specify array of objects in PhpDoc

To give you an answer, you can see and try if your IDE supports this doc syntax:

/**
 * @param $aaa MyObject[]
 */
public function bla(array $aaa) {
  foreach ($aaa as $a) {
     $a->IWantGetCodeHintingHereToo(); 
  }
}

Good luck and have fun!

Community
  • 1
  • 1
Scriptlabs
  • 498
  • 3
  • 16