Post #1515011
2026-03-24 18:25 UTC
@m1ke I've run into this numerous times working in existing codebases that extensively used shaped arrays and unfortunately there's no good out-of-the-box answer. PHPStan won't include helpers like `Partial` and doesn't support `TInput&array{b: int}` syntax. The next best solution is creating a custom phpdoc type parser. https://github.com/phpstan/phpstan/discussions/9102
I've had limited success creating multiple phpstan types that copy-pastes base definitions instead of using generics.
Replies (0)
No replies.