Last week I've got a question: "I need to explain when the Introduce Variable hint is invoked?" and I've realized that I could mention it briefly in this weblog because I'm not sure how many of you have already noticed it. I like this feature because I have a feeling that it boost my productivity. As an example imagine following common OOP piece of code:
$simpleClass = new SimpleClass();
To create an instance of a class, a new object must be created and
assigned to a variable. An object will always be assigned. This hint appeares just in the moment when assignment is ommited:
Then Alt+Enter is enough to fix it and assign it to a variable.
The other typical use cases when this hint appears: function, method invocations. So, on every line in the following piece of code this hint should appear:
The implementation doesn't try to find out whether the function or method really returns a value, it's left just up to the user's decision whether to use or not use this hint.
The last note I would like to mention is that the name of generated variable on left side is taken just from the right hand side and is preselected to be able to modify it instantly. See the screenshot:
Please comment or report bugs, I will wait for your feedback.