PHPStorm support?

Hey does anyone use PHPStorm with Kirby and have you gotten the functions and variables working?

For example “$kirby” gives an undefined variable error while “snippet” is an undefined function.

Is it possible to get kirby variables defined in someway?

I know how to disable them but i’d like to get them working :stuck_out_tongue:

How do the code reflection headers of php classes in PHPstorm looks like?

It seems kirby toolkit classes already do include eclipse (ZendStudio,…) style reflection headers.

I’ll ask a workmate (PHPstorm fanboy) tomorrow.

Svnt.

I’ve figured out how to get the variables like snippet working (my own fault by marking the directory as excluded), however $kirby is still undefined; this is the error i get from phpstorm.

This warning sounds sensible. Using a variable only defined in a if/else block can result in bugs.

But if this inspection in PhpStorm is not useful for you, you can disable it. There are a few inspections I tend to disable because they’re not relevant to a project, my coding style, or because they have too many false positives for my taste.

I started to use PHPStorm and Laravel for work, so when I returned to my Kirby projects this holiday, I was missing PHPStorm, and I noticed… PHPStorm has a hard time understanding Kirby.

So I made this IDE-helper-generator, after the Laravel IDE-helper by barryvdh. Hope it’s useful to someone. :slight_smile:

Just put it in your project root and run php _ide_helper_generator.php from the command line. Don’t add the generated files to your Kirby, just leave them for PHPStorm to inspect.