PhpStorm Field accessed via magic method

后端 未结 3 2086
心在旅途
心在旅途 2021-02-02 05:07

I have ignited datatables Library in my CodeIgniter library folder.

Some Code from Library

class Datatables
{
    /**
     * Global container variables for         


        
3条回答
  •  醉酒成梦
    2021-02-02 06:08

    As mentioned by LazyOne in the question comments:

    You have to declare them via @property in PHPDoc comment that belongs to that class.

    /**
     * @property string $bar
     */
    class Foo {
    
        public function __get($name) {
            if ($name == 'bar') {
                return 'bar';
            }
            return NULL;
        }
    }
    

    Snippet from Dmitry Dulepov's article "Quick tip: magic methods and PhpStorm".

提交回复
热议问题