New PHP formatting options in PhpStorm 3.0
Probably some of you have already noticed the changes in PHP code style settings. Putting the new UI look aside, I’d like to focus on new options and briefly explain their meaning and functionality. I hope you find them useful for making your code look more readable and closer to coding standards like PEAR or Zend.
PhpDoc Formatting (Settings|CodeStyle|PHP|PHP Doc)
There is a number of options which allow you to control the look of your PHP doc comments on reformatting:
- Align parameter names
Aligns the parameters prefixed with dollar ‘$’ sign.
- Keep blank lines
Tells if the blank lines (either put manually or inserted on previous reformatting) should be kept. Unchecking the flag will remove any blank lines which are not required by other options. Note: blank line here of course means an empty PHDoc line prefixed with a star ‘*’ character.
- Blank lines around parameters
Inserts blank lines around a group of parameter descriptions each starting with @param tag.
- Blank line before the first tag
Separates a description from the rest of PHPDoc. Note that if “Blank lines around parameters” is checked and the first tag is @param, the flag has no effect because there is already a blank line inserted by another option.
- Align tag comments
Aligns comments of @param tags and other tags. The two groups of tags (@param and other) are handled separately. Tags may have multiline comments in which case the whole comment will be aligned up to another tag or a blank line. Since blank lines appear meaningful for the alignment, it makes sense to keep them (make sure the “Keep blank lines” box is checked).
Code Alignments (Settings|Code Style|PHP|Other)
- Align key-value pairs
If checked, tells the formatter to align key=>value pairs on hash ‘=>’ sign. That’s the options you would most likely to check right now.
- Align consecutive assignments
If you have a group of assignments following each other without any gaps, they will be aligned on equals ‘=’ sign. By a gap I mean either a blank line, a comment or any other operator which is not an assignment (for example, echo).
Do you miss an option or have found a bug?
In both cases you are welcome to submit a feature request or a bug report at http://youtrack.jetbrains.com. And thanks in advance for any feedback!
Working with Windows Azure SQL Database in PhpStorm
PhpStorm provides us the possibility to connect to Windows Azure SQL Database right from within the IDE. In this post, we’ll explore several options that are available for working with Windows Azure SQL Database (or database systems like SQL Server, MySQL, PostgreSQL or Oracle, for that matter): …
Change signature refactoring in PhpStorm
A very powerful refactoring is the Change signature refactoring in PhpStorm. It enables us to modify a function signature in many ways: we can change the function name, change its visibility, add, remove and reorder parameters as well as rename parameters. (more…)…
Folding for imports in PhpStorm 6.0
In PhpStorm 6, we've introduced code folding for imports. Any list of imports will now be folded into a single line. This greatly reduced clutter in your editor when having a lot of imports! (more…)…
Drag & Drop Project Files to Remote Hosts in PhpStorm
The Remote Host pane allows us to work directly on a remote server through FTP, FTPS, SFTP or a local/network folder. A lot of people asked us to add drag & drop to the Remote Host pane in PhpStorm. Good news: PhpStorm 6 comes with drag & drop as well as copy & paste support from the pro…