1

I recently discovered, that you can have phpdocs outside of classes and your IDE (like Eclipse) would autocomplete it.

For example:

<?php /* @var $this Controller */ ?> <div><?php echo $this->app()->name; ?></div>

Eclipse would autocomplete $this->

I found this code snippet in a framework, but I can't find any documentation about this type of phpdoc. Has anyone a link for me? I didn't know, this was possible?

Thanks in advance!

user1978142
  • 7,946
  • 3
  • 17
  • 20

1 Answers1

0

In eclipce I know this way (Eclipse completions - @var (PHPDoc) question):

$that = $this;
if (false) $that = new Controller();

And use $that

But it should work in phpStorm IDE (with @var phpdoc)

Community
  • 1
  • 1
Yegor Lukash
  • 510
  • 2
  • 18