1

How do I make PhpStorm suggest input variables ?

In Java/C# and the like (with VS/Eclipse), when I have a function that receives enum-input-variable, like:

void func(SomeEnum var);

Whenever I type func(, the editor kindly suggests all the available enums (of type SomeEnum). I look for this same functionality in PHP, when I have a predefined set of input options (like DB's tables).

Maybe with the use of Intellilang or these @ tags (PHPDocs ?) I can predefine such list ?

1 Answer 1

2

Currently you cannot limit the possible options for code completion in this regard: PHP simply has no such "thing" similar to Enum. The only limitation you can do is limit by expected parameter type (e.g. int variable will not be offered when parameter expects an array).

I think this will be the correct ticket to look for: http://youtrack.jetbrains.com/issue/WI-854 and maybe http://youtrack.jetbrains.com/issue/WI-3623

Kind of related (for array indexes completion): http://youtrack.jetbrains.com/issue/WI-3423

Sign up to request clarification or add additional context in comments.

4 Comments

What I'm looking for is some JetBrain's feature to compensate for this PHP's missing feature. Any Intellilang / PHPDocs solution ?
@Tal Did you actually read my answer? Did you checked those tickets and what they are about? Do you really think that those tickets would still be opened if such functionality would be already implemented?
What I'm saying here is that neither PhpStorm or PHPDoc does not have such functionality at the moment, and you need to watch for those tickets -- one they will be resolved/fixed such functionality will be available in PhpStorm.
Ok, sorry for misunderstanding (I did read it all) :-\ thank you for taking the time and clearing this out :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.