简体   繁体   English

具有CodeIgniter库和PhpStorm的自动完成功能(AKA代码完成)

[英]Autocomplete (AKA Code Completion) with CodeIgniter libraries and PhpStorm

I have an autocomplete.php file in my config directory. 我的配置目录中有一个autocomplete.php文件。 Autocomplete works perfectly everywhere except in library files. 除了库文件之外 ,自动完成功能在任何地方可以完美运行。 Here is an example of the problem: 这是问题的示例:

class Some_custom_lib {
    protected $CI;

    public function __construct() {
        $this->CI =& get_instance();
        $this->CI->load->model('some_custom_model');
    }

    public function createSubrofile($post_vars) {
        return $this->CI->some_custom_model->create_file($post_vars); <-- This will not autocomplete.
    }

To be clear, this is a CodeIgniter library file that lives in applications/libraries folder and is loaded with $this->load->library('Some_custom_lib'); 需要明确的是,这是一个CodeIgniter库文件,位于应用程序/库文件夹中, $this->load->library('Some_custom_lib');加载$this->load->library('Some_custom_lib');

How can I get autocomplete to work inside CodeIgniter library files with PhpStorm? 如何通过PhpStorm自动完成在CodeIgniter库文件中的工作?

Thanks to a kind poster over in the CodeIgniter forums, I have the answer for anyone googling this thread. 感谢CodeIgniter论坛上的友善张贴者,对于任何使用此主题的人,我都有答案。 All you need to do is add 您需要做的就是添加

/*
* @property CI_Controller $CI
*/

to the top of the library. 到图书馆的顶部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM