Open source projects can sometimes be a bit of a pain in phpStorm.
Here I am going to show how to fix code completion for CodeIgniter in phpStorm.
Common Issues

Close
January 29th, 2012
Open source projects can sometimes be a bit of a pain in phpStorm.
Here I am going to show how to fix code completion for CodeIgniter in phpStorm.
Common Issues
January 27th, 2012
When it comes to layout markup and CSS I use FireBug and the Webdeveloper Toolbar for FireFox constantly.
With HTML block alignment a useful tool is the ruler under the Miscellaneous tab in the Webdev Toolbar.
The problem with it is this, every page refresh you need to add it back.
This is a pain when aligning a lot of different size elements, like forms for example.
So I made a simple tool for it, a graphic that is repeated with CSS over the area you are working in or the entire body.
A tiny bit of CSS and HTML goes a long way.
It is open source and available with an example on GitHub Grid Layout Overlay
Add the div to the area you want the grid to overlay.
1 | <div id="grid"></div> |
Drop the image in an accessible path.
Add the CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #grid { display: block; position: absolute; background: url('../img/100grid.png') repeat; z-index: 10000; width: 100%; height: 100%; min-height: 800px; margin: 0; padding: 0; top: -12px; /* Adjust the Vertical position */ left: -6px; /* Adjust the Horizontal position */ opacity: .7; /* Adjust the opacity */ } |
Make sure to adjust the path to point to the image location url(‘../img/100grid.png’)
Then you should end up with a grid over your layout like this simple example.

I will be posting YouTube entries on this also.
January 26th, 2012
I use phpStorm pretty much exclusively for PHP development, for over a year.
It simply has some awesome features.
But there are some things that people tend to complain about.
One of the biggest I am going to show you how to fix.
phpStorm by Jetbrains uses a stricter approach for code completion than most PHP IDE’s.
They index all constructs but for everything else phpStorm requires proper phpDoc annotations.
The reason behind this I think is simply for performance to keep it a bit litter and to have faster start-ups.
I will be doing a few of these examples for popular open source projects that have code completion issues do to their standards or simply not having phpDocs at all.
Once you get the hand of this, its pretty easy to do and works quite well.
Some of these issues are seen in all IDE’s not just phpStorm
So here we go, digging into the code.
The comments explain just about everything you need to know.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /** * @see https://gist.github.com/1105126 */ // Also some more hints and fixes // WP functions for adding to the admin bar // This will provide code completion for admin_bar functions like add_menu() /** @var $wp_admin_bar WP_Admin_Bar */ global $wp_admin_bar; // Fixing dynamic includes, also so they link properly in the editors environment require_once(get_template_directory() . '/inc/base.php'); //As is the above require will show an error in phpStorm "Cant resolve target....." //To fix this is easy, this fixes the error and also allows control click on the base.php and opens it /** @define "get_template_directory()" "/var/www/wp-dev/wp-content/themes/tridium" This is just for the IDE */ require_once(get_template_directory() . '/inc/base.php'); // These same methods can be used to fix most errors and completion in phpStorm |
Basically for accessing WordPress’s functions and methods that are mostly used eg wpdb, you add this file to the WP root https://gist.github.com/1105126.
I prefer as in the comments of the file to have the class named wpdb and remove the extends.
Like this,
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | /** * @property wpdb $ID * @property wpdb $post_author * @property wpdb $post_date * @property wpdb $post_date_gmt * @property wpdb $post_content * @property wpdb $post_title * @property wpdb $post_excerpt * @property wpdb $post_status * @property wpdb $comment_status * @property wpdb $ping_status * @property wpdb $post_password * @property wpdb $post_name * @property wpdb $to_ping * @property wpdb $pinged * @property wpdb $post_modified * @property wpdb $post_modified_gmt * @property wpdb $post_content_filtered * @property wpdb $post_parent * @property wpdb $guid * @property wpdb $menu_order * @property wpdb $post_type * @property wpdb $post_mime_type * @property wpdb $comment_count * @property wpdb $filter * @property wpdb $term_id * @property wpdb $name * */ class wpdb {} |
Then I drop that file in the WP root.
phpStorm will index the construct and use the listed properties in that file for code completion within the wpdb class.
You should not get duplicate class errors because we are not instantiating it.
Its just there for phpStorm.
I will be doing one of these for phpBB3 and also CodeIgniter so you may want to subscribe and follow future posts.