PhpStorm hacks for developers

PhpStorm is the most popular IDE for professional OXID developers.
Here we will collect some useful hacks to make your coding experience even better.

configure PHP version and smarty delimiters

this will help PhpStorm find possible compatibility issues in your code and correctly understand OXID’s templates.

  1. open settings and type “php language level”, then select the php version.
  2. go to settings and type “smarty” into the search bar, then select the bottom “smarty” menu item, input oxid’s custom smarty delimiters and uncheck “Smarty 3 whitespace policy”:

resolving dynamic paths

OXID provides multiple functions for retrieving correct paths to different directories, e.g. $oConfig->getModulesDir() for modules directory.
But PhpStorm needs some help to resolve them, otherwise you will see errors like this:


mapping your _parent classes to the actual oxid classes

when extending OXID classes with modules, you have to use class declaration like this:
class myArticle extends myArticle_parent but since there is no class “myArticle_parent” available, PhpStorm can not resolve methods from parent classes.
To fix this, simply add a new “.ide-helper.php” file to your module, where you map *_parent classes to the actual class you are extending, like this:

namespace VanillaThunder\DevUtils\Application\Extend;
class Email_parent extends \OxidEsales\Eshop\Core\Email {}
class Language_parent extends \OxidEsales\Eshop\Core\Language {}

code inspections might prevent some stupid situations

lets not lie: we all copy-paste code from stackoverflow and other sources.
Sometimes the code was made for a different php version and might not work in current project or it might even contain some… more substancial issues.
Code inspections will help you identifying problems in code, like version incompatibilities or missing function arguments.
Overall code inspections will improve the quality and maintainability of your code.

You also might want to have a look at this extension: Php Inspections (EA Extended)
It provides some additional useful checks like:

  • duplicated methods, that exist in parent class
  • possible null pointer exceptions
  • undefined classes and methods
    (very useful if you copy-paste older code from this forum into newer OXID versions)

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.