Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for inline comments in array shapes #3168

Open
alexandre-daubois opened this issue Jan 24, 2025 · 0 comments
Open

Support for inline comments in array shapes #3168

alexandre-daubois opened this issue Jan 24, 2025 · 0 comments
Labels

Comments

@alexandre-daubois
Copy link

alexandre-daubois commented Jan 24, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants