I’m trying out PHPStorm, a specialised PHP IDE that is supposed to give us ‘superpowers’ and help us write better PHP code. Indeed, I can see it’s full of amazing features, but I can’t seem to find how to configure it to work well with the latest version of Kirby. How do I get it to recognise all the Kirby classes, and not complain that variables like
$site in my templates are ‘undefined’?
I’m using PHPStorm on a Mac, and I know we have some PHPStorm veterans here, so I’m hoping you might be able to guide us newbies…
Thank you for the link, @texnixe - really useful. Is this how you use PHPStorm - that is, do you follow those conventions?
I’m noticing that using an IDE like this ‘prompts’ you to organise your code in a certain way - which is not a bad thing at all. Right now, I’m opening some old projects that had lots of computed Page properties declared in the Controller - rather than the Model - and, of course, following the guide above we’d have to use PHPDoc syntax at the template level for every one of those variables, in order for PHPStorm to recognise them. So, easier to move the code into the Model…
Next, I’d like to know if there is a way for us to customise the ‘link’ that PHPStorm tries to create when hovering over tokens - like:
Yes, but was easier to post the link then to explain in words