Additional and extended type hints for your IDE.
Adds the kirby types:create command to your project.
This command will create a file in your projects root directory that your IDE will pick.
Note Make sure you have the
getkirby/cliinstalled to use the command
| Types | K3 | K4 |
|---|---|---|
| 1.1.2 | ✔️ | ❌ |
| 2.0.1 | ❌ | ✔️ |
Require this package with composer using the following command.
composer require --dev lukaskleinschmidt/kirby-types:^1.1
Simply run kirby types:create to create the type hints file.
You can set the filename, force and include option when running the command.
kirby types:create --filename my-ide-helper --force --includeYou can use the following options in your config.php.
These are the plugin's default options.
return [
'lukaskleinschmidt.types' => [
'aliases' => [],
'decorators' => [],
'filename' => 'types.php',
'force' => false,
'include' => [
'aliases',
'blueprints',
'decorators',
'methods',
],
],
];You can add your own aliases you want to include.
return [
'lukaskleinschmidt.types' => [
'aliases' => [
'MyClass' => \LukasKleinschmidt\MyClass::class,
],
],
];You can modify methods and their DocBlock to improve IDE type hints.
The plugin has some default decorators already defined.
use LukasKleinschmidt\Types\Method;
use Kirby\Cms\Layout;
return [
'lukaskleinschmidt.types' => [
'decorators' => [
Layout::class => [
'columns' => [
'@return \Kirby\Cms\LayoutColumns|\Kirby\Cms\LayoutColumn[]',
],
],
],
],
];MIT