Skip to content

Commit

Permalink
Merge pull request #45 from geerteltink/docs/dockblock-typehint
Browse files Browse the repository at this point in the history
docs: add example for type hinting in docblocks
  • Loading branch information
geerteltink committed Oct 24, 2020
2 parents 680171d + 10a0146 commit 6a6ed6f
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions docs/book/v2/coding-style-guide.md
Expand Up @@ -1257,11 +1257,32 @@ $instance = new class extends \Foo implements

> ### Additional Laminas rules
>
> Code SHOULD be written so it explains itself. DocBlocks and comments
> SHOULD only be used if necessary. They MUST NOT start with `#` and MUST
> NOT be empty. They SHOULD NOT be used for already typehinted arguments,
> Code SHOULD be written so it explains itself.
>
> DocBlocks and comments SHOULD only be used if necessary. They MUST NOT start
> with `#` and MUST NOT be empty.
>
> DocBlocks and comments SHOULD NOT be used for already typehinted arguments,
> except arrays.
>
```php
/**
* Sets a single-line title
*
* The string `param` and `return` tags should be omitted as they are already
* type hinted.
*
* A `param` tag should be here to describe the array.
*
* @param array<string,string> $context
*/
public function setTitle(string $title, array $context): void
{
// ...
}
```

> The asterisks in a DocBlock should align, and there should be one
> space between the asterisk and tag.
>
Expand Down

0 comments on commit 6a6ed6f

Please sign in to comment.