Skip to content

Accessing different nested object properties trigger MixedPropertyFetch #10380

@annuh

Description

@annuh

Hi,

I've noticed an issue when accessing multiple nested object properties.

Hopefully this snippet explains the issue:

<?php
/**
 * @var object{
 *     Nested: object{
 *         foo: string,
 *         bar: string,
 *    }
 * } $object
 */
if ($object->Nested->foo !== 'Foo') {
    return null;
}
if ($object->Nested->bar !== 'Bar') { // the MixedPropertyFetch is unexpected here
    return null;
}

Link to the snippet https://psalm.dev/r/4ec39c5d44

FYI this only happens with nested objects, accessing multiple properties directly on $response works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions