DI parameters that contain a list are not reported as a list

Open
#406 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
php, symfony
Domain
tooling

Research direction

Start at the extension handling $container->getParameter('parameter_containing_a_list') and trace how its array<int, T> type is inferred. Reproduce the PHPStan bleeding issue with a list parameter, then verify that list-valued parameters are reported as list without breaking other array parameters.

Written by the indexing model from the issue text.

Description

When using $container->getParameter('parameter_containing_a_list'), the type provided by the extension is array<int, T> (with the appropriate type for T).
This causes issues when running phpstan in bleeding and passing that value to a function expecting list<T>.

It would be great if the extension could report the type as list<T> when the parameter value is a list.

Dominant language
PHP
Stars
800
Forks
104
Avg merge
4m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from phpstan/phpstan-symfony

All issues in phpstan/phpstan-symfony

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.