PHP Framework-PHP class array member variables how smart hints (auto-complete)?

Source: Internet
Author: User
Tags php class php framework
class a{    static $config = [        'id' => 1,        'status' => ['status1'=>1,'status2'=>2]    ];  }

$s = new A ();
Echo s::config->id;
Die

How to make S:: $config can automatically fill out the ID and status .....

Reply content:

class a{    static $config = [        'id' => 1,        'status' => ['status1'=>1,'status2'=>2]    ];  }

$s = new A ();
Echo s::config->id;
Die

How to make S:: $config can automatically fill out the ID and status .....

Of course, you can do this by using the Phpdoc annotation, an auxiliary class that implements the Arrayaccess interface with the prompt attributes you need.

The principle is actually to let the IDE mistakenly think that this array is a class and then automatically prompt the completion of the property name, and Arrayaccess has the class object as an array operation of the "Black" magic.

The IDE's code hints are generated at the time of loading the project index, and then enter the relevant characters when the search completion prompt, array this if also to hint, the probability is very small, this consumes too much resources, and are local, non-stop retrieval. But if you use sublime it will prompt the most recent words, this may be enough to meet your needs

Phpstorm can automatically prompt the class member variable, as to the element that prompts the array type member variable, temporarily did not involve

The Generic IDE development tool will prompt you for class member variables and class member method names, but you're suggesting that I haven't found them yet.

Basically, these arrays are created at run time, and parsing is not done at this point, and it is not necessary.

Like what:
I'm going to delete a key from the array in the code, what do I suggest?

The complement annotation and complement on the structure level of this array is not as good as the research phpdoc.

Arrayaccess

The new version of the Phpstorm has been supported, today colleagues said he has a hint Ah, my const array declaration directly on the red .... His phpstorm support ...!!

PHPDoc +1 can refer to this http://www.07net01.com/progra ...

Some Ides can be implemented by the installation of the corresponding plugin can also be recommended with sublime

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.