I'm looking for a doc comment that would define the scope/context of the current php template. (similar to @var)
Example View Class:
<?php
class ExampleView {
protected $pageTitle;
public function __construct($title) {
$this->pageTitle = $title;
}
public function render() {
require_once 'template.php';
}
}
--
<?php
// template.php
/** @var $this ExampleView */
echo $this->pageTitle;
PHPStorm gives an inspection error because the access on $pageTitle is protected.
Is there a hint to give scope? Something like:
<?php
// template.php
/** @scope ExampleView */ // <---????
/** @var $this ExampleView */
echo $this->pageTitle;
Unfortunately you cannot -- there is no such tag (either in general or specific to PhpStorm).
Let's hope they (JetBrains devs) do something about it: http://youtrack.jetbrains.com/issue/WI-11022 -- vote/comment/etc and if it will get much more votes we may see it implemented soon (right now that "soon" is far away).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With