Skip to content

Replace deprecated PHPStan TypeUtils::flattenTypes with local TypeFlattener - #8749

Merged
TomasVotruba merged 2 commits into
mainfrom
decouple-phpstan-flatten-types
Oct 21, 2026
Merged

TomasVotruba merged 2 commits into
mainfrom
decouple-phpstan-flatten-types

Conversation

@TomasVotruba

Copy link
Copy Markdown
Member

PHPStan\Type\TypeUtils::flattenTypes() is deprecated upstream and slated for removal. TypeFactory is the only place in src//rules/ that calls it (3 sites).

This adds a local TypeFlattener::flatten() that reimplements the method faithfully - union unwrapping plus the constant-array power-set expansion (with the same 16384 variant bail-out and an inlined cartesian combinations) - and swaps the 3 call sites. Removes the last use PHPStan\Type\TypeUtils in the codebase.

Behavior is unchanged; full test suite passes (4990 tests), PHPStan level 8 and ECS clean.

@TomasVotruba
TomasVotruba merged commit 8bad41b into main Oct 21, 2026
49 checks passed
@TomasVotruba
TomasVotruba deleted the decouple-phpstan-flatten-types branch October 21, 2026 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants