1

Is there an opportunity, that will allow it to declare a variable in php as a specific object, so that IDEs like Netbeans can detect that Object and suggest me the possible methods and variable in that class?

What I know, is that it works with function like this example:

public static function add(\Event $element) { //The $element variable is now declared, that it have to be an Event object } 

In the theory, my question looks like this:

\Event $events = EventContainer::getAll(); 

But unfortunately that wouldn't work.

2

1 Answer 1

3

In eclipse I usually use this pattern:

class Foo { /** * @var $barArray \Baz\Bar[] */ protected $barArray; /** * @var $bar \Baz\Bar */ protected $bar /** * @return \Baz\Bar */ public function getBar() { return $this->bar; } /** * @return \Baz\Bar[] */ public function getAllBar() { return $this->barArray; } } 

That way eclipse knows by the javadoc what to use in autocomplete. It might work the same in other editors.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.