Improve IDE support
Many code editors and IDEs offer support for code completion suggestions or showing meta information about your variables, method calls etc. To make the most use of it, your IDE needs to know what types your variables hold.
Templates and snippets
Kirby exposes some general variables like $page
, $site
etc. to your templates as well as anything returned in the page controller. Your IDE however does not automatically know what these variables stand for. You can change this by adding comments specifying their types:
Your IDE can now infer that $child
is also a Kirby\Cms\Page
object.
Controllers
In your controllers, you can access the standard Kirby objects as arguments to your controller closure. By type-hinting them, your IDE can help you with completion suggestions etc.
Page models
Make sure to do the same for your custom page models: