lukaskleinschmidt / kirby-types
Kirby Types
Installs: 383
Dependents: 1
Suggesters: 0
Security: 0
Stars: 18
Watchers: 2
Forks: 0
Open Issues: 1
Type:kirby-plugin
Requires
- php: ^8.0
- getkirby/composer-installer: ^1.2
- phpdocumentor/reflection-docblock: ^5.3
Requires (Dev)
- getkirby/cli: ^1.1
- getkirby/cms: ^3.9
README
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/cli
installed to use the command
Installation
Require this package with composer using the following command.
composer require --dev lukaskleinschmidt/kirby-types:^1.1
Usage
Simply run kirby types:create
to create the type hints file.
Command Options
You can set the filename
, force
and include
option when running the command.
kirby types:create --filename my-ide-helper --force --include
Options
You 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', ], ], ];
Aliases
You can add your own aliases you want to include.
return [ 'lukaskleinschmidt.types' => [ 'aliases' => [ 'MyClass' => \LukasKleinschmidt\MyClass::class, ], ], ];
Decorators
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[]', ], ], ], ], ];
License
MIT