PhpStorm configuration for automatic creation of the class namespace use statement like in ZendStudio - zend-studio

I like ZendStudio feature when after typing class name and pressing "Enter" it automatically adds namespace use statement into the head of the script file.
Is it possible to do the same in the PhpStorm IDE?

Not sure if this has been there all the time, or if it a new addition but it can be done already.
On my case, you get on top of the class that you want the use imported and you press alt+Enter. A popup allowing you to select which namespace you want to import pops up.
You can see a more graphical explanation here:
PHP Storm Tricks: Add your USE Statements Automatically!

I just wanted to disable it (it's native and enabled by default now) and found this SO thread.
For people like me, here's where the setting:
Editor > Auto-import > PHP - Enable auto-import in namespace scope

Please vote http://youtrack.jetbrains.net/issue/WI-1362

In PHPStorm 6.0.3 on Mac (and presumably other platforms) you should follow the advice given by #Savageman. It worked for me.

Go to "Settings" (Ctrl+Alt+S) > "Code Style > PHP" (I'm assuming you're using PS 3.0)

Related

Highlight debug functions

I use PhpStorm for a while now, and it's code inspection and syntax highlighting is great! To further extend this feature, I am looking for a way to alert myself of 'debug functions'. I frequently use functions like var_dump(), exit() or echo '<pre>',print($var),'</pre>'. Unfortunately, I also frequently forget these when deploying some code.
Is it possible to add custom highlighting in PhpStorm for some defined functions with the Inspection-feature, so I am visually notified that some debugging-code is still present? Or a plugin or other feature to accomplish something like that?
Install and use Php Inspections (EA Extended) plugin
Once installed -- Settings/Preferences | Editor | Inspections
One of the inspections this plugin provides called Forgotten debug statements -- find it there (hint: there is a search field -- use it)
This inspection will highlight some standard debug related functions + you can add your own function names.
P.S.
This inspection works with PHP functions only -- it will not find constructions like echo '<pre>',print($var),'</pre>'.
BTW -- why don't you try Xdebug/Zend Debugger for a proper debug experience?

How do I use completion by "Ctrl-n" with XVim?

I use XVim, a nice product. I want to use code completion like Ctrl+n on Vim, but it is not working in XVim.
So, how can I use completion like that with XVim?
According to its FeatureList, this isn't implemented (yet). Why don't you raise this on the forum, or open an issue?!

Sublime Text - Unable to edit package settings

I am trying to edit the settings for an installed package for Sublime Text.
Background:
Installed Laravel 4 Artisan package via Package Control: Install Package.
Trying to run Artisan commands returns an error message:
Laravel requires the Mcrypt PHP extension.
Via terminal, artisan works fine. This leads me to believe that the PHP version used by Laravel 4 Artisan in Sublime Text is different from the version set up in my .bash_profile.
In the terminal, which php returns /Applications/MAMP/bin/php/php5.4.10/bin/php
In Sublime Text, Package Settings > Laravel 4 Artisan > Settings - Default points to:
{
"php_path": "php"
}
These settings seem to be read-only. I cannot even change the text, let alone save it with the new PHP location.
Any ideas or am I missing something simple?
problem solved. The problem is me being a Sublime Text noob.
Solution for those of you who don't know:
Sublime text packages appear to have various settings modes. A default mode and a user mode.
If you copy the contents of default mode over to user mode, then edit user mode. Then I believe that the settings in user will extend / override the settings in the default mode.
From what I can see, you cannot edit the settings in default.
So instead of { "php_path": "php" }, user settings should be something like the following depending on your php setup.
{
"php_path": "/Applications/MAMP/bin/php/php5.4.10/bin/php"
}
Happy to see you solved your problem. I'll clarify a bit to help anyone else who comes across this. You are correct in the fact that the settings are merged. The load order determines how these files are merged. The User folder is always last. So whatever you specify there will always be taken over that of previous configurations.
Depending on how you installed your plugin, the "Default" settings that came with the plugin may be overwritten. So you don't want to make any changes there that you hope to persist, so placing them in the User folder is the correct thing to do. As an additional note, you don't have to copy the entire contents of the "default" settings. Rather, you only need to specify the settings you want to override. Things will be merged appropriately.
One last thing, I don't believe ST2 makes the default settings read only. I do know ST3 does (well based on where it is installed). Be sure to post questions with the correct tag (sublimetext3 in this case). Was to long for a comment, but I hope this helps clarify things for you.
Also in case anyone is still struggling after doing this, remember to restart SublimeText to enable.

Setting up phpstorm 4 with XAMPP on Windows 7

I need help setting up phpstorm (4.0) with XAMPP which is at the default location c:\xampp\htdocs. I create all my projects at c:\xampp\htdocs\projectname.
Here are the things I have already done:
Setup the PHP interpretator by going to settings and then PHP (main menu)
Go to PHP > Servers and then
To setup run configuration I have the done the following:
Now when I run using the above configuration it just takes me to localhost in my browser, instead of the file I am editing (http://localhost instead of localhost/myproject/myfile.php).
What am I missing? I read the help topics of phpstorm and googled a lot but still couldn't figure it out.
Turns out you don't need to set up run configuration. The answer lies in setting up the mapping in the deployment tab in settings.
(assuming that you are creating your projects in c:\xampp\htdocs)
To do that go to settings (Ctrl + Alt + S) and then choose deployment:
Under mappings tab, it should look like this:
And after that you can view the file in the browser through this menu:
Check the answer to this question. If you need to debug, the recommended way to do it is zero configuration debugging.

Where is scaffold in RubyMine

I'm trying RubyMine, and watching this tutorial https://www.jetbrains.com/ruby/documentation/ . The author uses there project->new->scaffold but i could not find scaffold there. What's wrong?
Whenever searching for something in RubyMine, a highliy recommented thing is "Search"->"Find Action" (Cmd-Shift-A).
Just type "scaffold" in the search field and it shows the relevant IDE actions.
Click on File -> New -> Run Rails Generator...
type scaffold and press enter
in the next dialog you can enter the scaffold parameters
With RubyMine, I often find it easier to use the terminal for Rails commands like generating scaffolds and migrations and use the RubyMine interface for watching what's happening in the server console, raking the database or routes, etc. It's sort of the best of both worlds. Good luck.

Resources