Answer the question
In order to leave comments, you need to log in
PHPDoc for autocompletion with a crooked autoloader?
A long time ago I came to a project in which all classes are called through a singleton manager. Everything would be fine, but because of this it is difficult with auto-completion.
Roughly everything is like this:
class ClassManager {
private $objects;
function __get($name) {
if (isset($this->objects[$name])) {
return $this->objects[$name];
} else {
$file = $this->getFileName($name);
$file_path = $_SERVER['DOCUMENT_ROOT'] . '/' .$file;
if ($file AND file_exists($file_path)) {
require_once($file_path);
$this->objects[$name] = new $name();
return $this->objects[$name];
}
return (object) $temp;
}
}
private function getFileName($name) {
return $name;
}
}
class CM {
static $init = NULL;
static function init() {
self::$init = new ClassManager();
}
}
CM::$init->Shab->и_название_метода_вспоминай_сам
Answer the question
In order to leave comments, you need to log in
I remember when I looked at Phalcon, there are configs for different IDEs with lists of classes and functions, you can see how it was done and do it yourself. In Phpstorm the plugin worked.
/** @var $instance MyMegaShabClass */
$instance = CM::$init->Shab;
$instance->и_название_метода_подскажет_IDEA
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question