Skip to content

slow analysis on big literal array #7901

@staabm

Description

@staabm

Bug report

for some reason, we have a source file in the app which contains an array with ~90.000 literal strings.
analyzing this files takes phpstan a big amount of time:

MailAddressList.php
--- consumed 430 MB, total 766 MB, took 194.68 s

Code snippet that reproduces the problem

simplified example, which takes ~1 second to analyze:
https://phpstan.org/r/a1ac48b5-11ac-4f53-b928-2f08bc54affe
it seems my initial sample is a bit too small, because it was cut down by some tool involved.
here is a full script: https://gist.github.com/staabm/ea8b72c50c68648d48820bb7823e98b2

Expected output

faster analysis

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions