Skip to content

Nested references don't work in associative arrays #197

@1234ru

Description

@1234ru

I have arrays of items, whose structure is declared, and I reference to that structure in the arrays' declaration.

If the array has implicit or numeric keys, suggestion works fine.

But if the array has string keys, suggestion doesn't work.

<?php

class Test {
    /** @var = [
     *      'one' => '',
     *      'two' => '',
     *  ] */
    public $x;
}

/** @var $a = [ Test::$x ] */
$a = [
    [
        '' // suggests 'one', 'two' as expected
    ]
];

/** @var $b = [ Test::$x ] */
$b = [
    'key' => [
        '' // doesn't suggest anything :(
    ]
];

Is there a way to make such reference work in an associative array?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions