Active
Project:
Coder
Version:
8.3.x-dev
Component:
Coder Sniffer
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jun 2023 at 12:18 UTC
Updated:
31 Oct 2024 at 17:48 UTC
Jump to comment: Most recent
#3253472: Support advanced PHPStan data types (general, arrays) introduced support for extended array specifications, but apparently multi-line array shapes are unsupported
A docblock like this:
/**
* Returns an array with the driver's autoload information.
*
* [...]
*
* @return array{
* 'autoload': string,
* 'namespace': string,
* 'dependencies': array<string, array{'autoload': string, 'namespace': string}>,
* }
*/
public function getAutoloadInfo(): array {
...
which is parsed OK by PHPStan fails in coder with
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
151 | ERROR | [x] Expected "array" but found "array{" for function
| | return type
| | (Drupal.Commenting.FunctionComment.InvalidReturn)
152 | ERROR | [x] Return comment indentation must be 3 spaces, found
| | 5 spaces
| | (Drupal.Commenting.FunctionComment.ReturnCommentIndentation)
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------
Comments
Comment #2
mondrakeComment #3
mfbThis would be wonderful for documenting array shapes for function parameters as well. Those have some additional phpcs errors: