Skip to content

Array shapes handling gets broken when there are many keys (63?) #10080

@ArtemGoutsoul

Description

@ArtemGoutsoul

Bug report

There's a array param with 63 keys (condensed code ):

<?php

/**
 * @param array{
 *    a1?: string,
 *    a2?: string,
 *    a3?: string,
 *  ....
 *    a59?: string,
 *    a60?: string,
 *    a61?: string,
 *    a62?: string|string[]|int|float,
 *    a63?: string
 * } $row
 */
function doStuff(array $row): void
{
	\PHPStan\dumpType($row['a51'] ?? ''); // Dumped type: string
	\PHPStan\dumpType($row['a51'] ?? ''); // Dumped type: array<string>|float|int|string
}

Not really sure what is happening here. If I remove any key - the problem goes away: i.e. the type shows up correctly as string for both lines.

Code snippet that reproduces the problem

https://phpstan.org/r/f79adf76-c8e5-46f9-8615-c887fa4324ea

Expected output

Dumped type: string
Dumped type: string

Did PHPStan help you today? Did it make you happy in any way?

PHPStan makes me happy every day! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions