Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Add documentation for HelperTrait for IDE auto-completion
Browse files Browse the repository at this point in the history
  • Loading branch information
thexpand committed Sep 12, 2018
1 parent 2e2a8d2 commit a60436e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/book/flash-messenger-view-helper.md
Expand Up @@ -144,3 +144,27 @@ data-dismiss="alert" aria-hidden="true">&times;</button><ul><li>',
],
],
```

## IDE auto-completion in templates

The `Zend\Mvc\Plugin\FlashMessenger\View\HelperTrait` trait can be used to
provide auto-completion for modern IDEs. It defines the aliases of the view
helpers in a DocBlock as `@method` tags.

### Usage

In order to allow auto-completion in templates, `$this` variable should be
type-hinted via a DocBlock at the top of your template. It is recommended that
you always add the `Zend\View\Renderer\PhpRenderer` as the first type, so that
the IDE can auto-suggest the default view helpers from `zend-view`. Next, chain
the `HelperTrait` from `zend-i18n` with a pipe symbol (a.k.a. vertical bar) `|`:

```php
/**
* @var Zend\View\Renderer\PhpRenderer|Zend\Mvc\Plugin\FlashMessenger\View\HelperTrait $this
*/
```

You may chain as many `HelperTrait` traits as you like, depending on view
helpers from which Zend Framework component you are using and would like to
provide auto-completion for.

0 comments on commit a60436e

Please sign in to comment.