現在の php テンプレートのスコープ/コンテキストを定義するドキュメント コメントを探しています。(@var に類似)
ビュークラスの例:
<?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;
$pageTitle へのアクセスが保護されているため、PHPStorm は検査エラーを出します。
スコープを与えるヒントはありますか?何かのようなもの:
<?php
// template.php
/** @scope ExampleView */ // <---????
/** @var $this ExampleView */
echo $this->pageTitle;