Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

FrameworkConfig methods not found by PHPStan and psalm #46546

Copy link
Copy link
Closed
@ThomasLandauer

Description

@ThomasLandauer
Issue body actions

Symfony version(s) affected

5.4.9

Description

Similar problem as in #42342

With a framework.php similar to the example shown at https://symfony.com/doc/current/http_client.html#scoping-client

// config/packages/framework.php
use Symfony\Config\FrameworkConfig;

return static function (FrameworkConfig $framework) {
    $framework->httpClient()->scopedClient('github.client')
        ->scope('https://api\.github\.com')
        ->header('Accept', 'application/vnd.github.v3+json')
        ->header('Authorization', 'token %env(GITHUB_API_TOKEN)%')
    ;
};

...psalm is reporting:

PossiblyUndefinedMethod - config/packages/framework.php - Method Symfony\Config\FrameworkConfig::scopedClient does not exist

and PHPStan:

Call to an undefined method Symfony\Config\Framework\HttpClientConfig|Symfony\Config\FrameworkConfig::scopedClient().

Even though I do have public function scopedClient(string $name, $value = []) in my var/cache/dev/Symfony/Config/Framework/HttpClientConfig.php

So it looks like adding this to phpstan.neon isn't enough anymore:

scanDirectories:
    - var/cache/dev/Symfony/Config

The same error is raised for other packages, e.g.:

  • Call to an undefined method Symfony\Config\Twig\GlobalConfig|Symfony\Config\TwigConfig::value().
  • Call to an undefined method Symfony\Config\Monolog\HandlerConfig|Symfony\Config\MonologConfig::type().

Was there a change recently?

How to reproduce

See above

Possible Solution

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.