How to turn on extended code completion in PhpStorm
Hello,
I sometimes need more informations on what a method, function or class does than just its prototype. Is it possible for instance to hook PHP manual to code completion so that after another Ctrl+Space it would show me method description/details in a floating window?
Thanks :)
请先登录再写评论。
Hi there,
Ctrl+Q (or whatever you have got there for "View | Quick Documentation")
That will show what PhpStorm knows about this function (info taken from corresponding PHPDoc blocks).
If you need actual full documentation in browser -- use "View | Extrenal Documentation" (URL is taken from @link PHPDoc tags)
P.S.
Check also "Settings (Preferences on Mac) | Editor | Code Completion --> Autopopup documentation in (ms)..." option
Great, Thanks a lot :). That's what I needed.
pressing CTRL-Q only seems to work if the cursor is in the middle of the method name. Once I've entered the parentheses, I can see the prototype for the parameters (without their @param description) but there doesn't seem to be any way to "see more" i.e. I'd like to see the method's summary description and/or @param details when I'm trying to enter in the parameters.
Am I missing a setting or is it really necessary to finish typing the method and then backspace or select the method with the mouse and then press CTRL-Q? I like PhpStorm but PHPDoc comments for class methods have become pretty useless since our team switched to it.
That's correct.
Otherwise, when you inside the parentheses .. for which element the quick doc should be shown: function/method name .. or variable under cursor? And what should happen if I have multi-level function calls (result of one function is passed as parameter directly to another)?
Having quick doc working this deterministic way (for element under cursor) removes such problems.
Right now I may only suggest one of these:
Other than that: https://youtrack.jetbrains.com/issue/WI-23913
Please explain. Why they were "useful" before and "useless" now?
Taking the time to add helpful documentation to a function is a waste of time if developers don't actually see them when they're coding. PhpStorm not only doesn't show useful information about a function when it's needed, it's actually fairly cumbersome to get at that information if someone does want to see it.
As an example, imagine a function with several parameters and one of them contains helpful text to use an enum:
/**
* @param int $statusId - use the Status enum ex: Status::AWAITING_APPROVAL
* ...
*/
How is any developer going to know to use the Status enum when the editor only tells them that $statusId is an INT? At the point where they see that the function's parameter is an INT called StatusId, if they do decide to make the effort to view the function's documentation, they have to do the following:
press LEFT ARROW twice so the cursor is withing the name of the function or leave the keyboard to grab the mouse and click on the function name
press CTRL + Q to view the popup description and read the descriptions for the list of parameters
press ESCAPE to close the popup window
press RIGHT ARROW twice to get back inside the parentheses
press CTRL + P to make the parameter intellisense popup (or delete both parentheses and then type the first parentheses again so the intellisense will appear)
enter the parameter values and hope you remember the descriptions for the 3rd and 4th parameter
A good editor should help a developer code. At the point where a developer begins entering a parameter for a function, it's an opportunity for the function's author to guide the consumer with what the function (and the author) expects as input and what the developer should expect as output from the function.

Examples include:
1. What is expected for a "mixed" parameter type
2. A parameter description explaining what enum can be used
2. A better description of the value being returned .. perhaps it's a CSV of Ids or an array with the primaryKey as the index
3. Being able to see the @example text with a snippet showing which enum can be used as a parameter
I've been trying to get other developers to document their code more but now that we're using PhpStorm, there isn't much point in it if it's not going to be visible when we're coding.
Hi,
Create an interface file of values like so:
Attachment(s):
Screen Shot 2014-11-13 at 3.28.33 AM.png
Yeah, thanks. I've tried declaring parameters as an enum in the past but, too often, someone will want to pass colType as an INT by passing the querystring value from a dropdown selection or something and the method call fails because the parameter isn't an enum.
John,
The constants in the interface are ints. PHP does not support C enum types, but does reserve the keyword. https://wiki.php.net/rfc/enum
Not sure what you are referring to by extending online help then. But in a user interface you can easily build drop downs that use the numeric values as id's for each drop down value.
I cr5eate the custom types to make coding easier.
Jim