Skip to content

Support for inline comments in array shapes #3168

@alexandre-daubois

Description

@alexandre-daubois

Feature description or problem with existing feature

Currently, the following code autocompletes $myParam key:

/**
 * @param array{
 *  name: string,
 *  age: int
 * } $myParam
 */
function test(array $myParam)
{
    $myParam['nam'];
}

Unfortunately, adding inline comments breaks autocomplete:

/**
 * @param array{
 *  name: string, // some other string here
 *  age: int // some integer over there
 * } $myParam
 */
function test(array $myParam)
{
    $myParam['nam'];
}

Describe the solution you'd like

It would be nice to be able to add inline comments (multiline comments are not possible because of PHP, see additional context) to keys, empowering documentation at a glance when having a look at the array shape. Ideally the inline comment could be displayed in the autocomplete window with the type, but this would be more of a "nice to have".

Additional context

Sub-issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions