#15348·phpstan

symfony/ux-css slow on big array shape

Author: staabmCreated Oct 1, 2026Updated Oct 1, 2026
Labelsperformance

Bug report

The array shape that symfony/ux-css generates for its css() Twig function has about 840 keys, 126 of them referring to a nested shape, and checking one method parameter against it took seconds.

reproducer in https://github.com/Kocal/sf-ux-css-phpstan-reproducer

running the reproducer on PHPStan 2.2.16:

➜  sf-ux-css-phpstan-reproducer git:(main) ✗ vendor/bin/phpstan analyse -c phpstan-nested.neon --debug -vv
Result cache not used because of debug mode.
/Users/staabm/workspace/sf-ux-css-phpstan-reproducer/src/Ui/Button.php
Result cache is saved.
                                                                                                                        
 [OK] No errors                                                                                                                                                                                                                                 

Elapsed time: 31.34 seconds
Peak memory: 78 MB

running the reproducer on PHPStan 2.3.x@bee10c5:

➜  sf-ux-css-phpstan-reproducer git:(main) ✗ vendor/bin/phpstan analyse -c phpstan-nested.neon --debug -vv 
Result cache not used because of debug mode.
/Users/staabm/workspace/sf-ux-css-phpstan-reproducer/src/Ui/Button.php
Result cache is saved.
                                                                                                                        
 [OK] No errors                                                                                                                                                                                              

Elapsed time: 4.76 seconds
Peak memory: 54 MB