Answer the question
In order to leave comments, you need to log in
$this in PHP template engine
There is a page - a template on purePHP
It is drawn by inclusion in some class method
<?php
class SomeClass {
public function count() { return 0; }
}
class OtherClass {
/**
* @var SomeClass
*/
protected $var1;
function __construct() {
$this->var1 = new SomeClass;
}
function showCount() {
include('showCount.phtml');
}
}
$x = new OtherClass;
$x->showCount();
?>
<?php
// note : $this instanceof OtherClass
echo $this->var1->count();
?>
<?php
/**
* @var OtherClass
*/
$that = $this;
echo $that->var1->count(); // подсказки работают
?>
Answer the question
In order to leave comments, you need to log in
Question: How can I help the IDE enable Code Completition
/* @var $name \class\name */
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question