-
-
Notifications
You must be signed in to change notification settings - Fork 946
Open
Labels
Description
Feature request
Consider this example code with a function (playground):
/**
* @phpstan-type BlockAttributes array{
* language: string,
* highlightedLines: string,
* showLineNumbers: bool,
* wrapLines: bool
* }
*/
/**
* Render.
*
* @param BlockAttributes $attributes Block attributes.
* @param string $content Content.
* @return string Rendered block.
*/
function render_block( array $attributes, string $content ): string {
/* ... */
return $content;
}PHPStan currently fails here with three errors:
- Function render_block() has parameter $attributes with no value type specified in iterable type array.
- PHPDoc tag @param for parameter $attributes with type BlockAttributes is incompatible with native type array.
- Parameter $attributes of function render_block() has invalid type BlockAttributes.
It seems that the @phpstan-type alias only works when it is attached to a class (playground).
It would be useful if the class association wasn't required.
Reactions are currently unavailable