我们可以在PHP编辑器中使用类似的自动完成功能:
<?php
/**
* Class Controller
* @property foo foo
*/
class Controller {
public function bar() {
$this->foo-> // autocomplete here
}
}
class foo() {
}
但如果我想要一个像__call
这样的魔术方法的自动完成,那该怎么可能
以下示例:
<?php
Class Controller {
public function __call($function, $arguments) {
if($function == 'foo') {
// some logic here
}
}
}
Class Home extends Controller {
public function somefunction() {
$this-> // should have an autocomplete of foo
}
}
任何想法如何在PHP编辑器中配置自动完成
如果有特定的
,我会使用PHP-Storm答案 0 :(得分:4)
您可以使用@method
phpdoc标记获取魔术方法的自动填充功能
这是一个代码示例:
<?php
/**
* Class Controller
* @method mixed foo() foo($parametersHere) explanation of the function
*/
Class Controller {
public function __call($function, $arguments) {
if($function == 'foo') {
// some logic here
}
}
}
这应该可以正常使用