Symfony service constructor analysis

Open
#253 12 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
php, symfony
Domain
backend, devtools

Research direction

Start by reviewing the existing Symfony container integration and the configured symfony.container_xml_path value, then compare it with the current parameter-count and type analysis. Determine how constructor arguments for services represented in the container XML should be validated, and consider invalid-parameter diagnostics as the completion criterion.

Written by the indexing model from the issue text.

Description

PHPStan already supports analysis for valid parameters count and type.

Method A::a() invoked with 0 parameters, 1 required.
Parameter #1 $a of method A::a() expects B, C given.

However it does not report invalid constructor parameters for Symfony services. We have access to the container via

parameters:
    symfony:
        container_xml_path: app/cache/dev/appDevDebugProjectContainer.xml

so we can analyze constructors as well. Do I miss something or this is a feature that is not implemented?

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.