Symfony version(s) affected
7.2.4
Description
The extra function in the generated file var/cache/dev/Symfony/Config/Framework/HttpClient/ScopedClientConfig.php is typehinted as @param ParamConfigurator|list<ParamConfigurator|mixed> $value which is causing an issue in my framework.php config file.
Here is an example config that gets the error from phpstan:
<?php
// config/packages/framework.php
use Symfony\Config\FrameworkConfig;
return static function (FrameworkConfig $framework): void {
// append the client cert to the scoped client
$framework->httpClient()->scopedClient('account.server.client')
->baseUri('%env(ACCOUNT_SERVER_BASEURI)%')
->passphrase('%env(ACCOUNT_SERVER_CLIENT_PASSPHRASE)%')
->extra([
'curl' => [
CURLOPT_SSLCERT_BLOB => '%env(base64::ACCOUNT_SERVER_CLIENT_SSLCERT)%',
CURLOPT_SSLKEY_BLOB => '%env(base64::ACCOUNT_SERVER_CLIENT_SSLCERT)%',
],
])
;
The message from PHPStan is:
Parameter #1 $value of method Symfony\Config\Framework\HttpClient\ScopedClientConfig::extra() expects list|Symfony\Component\Config\Loader\ParamConfigurator, array{curl: array{40291: '%env(base64:…', 40292: '%env(base64:…'}} given.
💡 Type #1 from the union: array{curl: array{40291: '%env(base64:…', 40292: '%env(base64:…'}} is not a list.
I think the proper typehint would be @param ParamConfigurator|array<ParamConfigurator|mixed> $value because list expects the array to be sequential integer keys starting at 0. This is all generated code so I'm not quite sure where the fix would be needed as I'm not familiar with that part of the codebase.
How to reproduce
To repro ensure PHPStan in installed and add the following contents to app/config/packages/framework.php:
<?php
// config/packages/framework.php
use Symfony\Config\FrameworkConfig;
return static function (FrameworkConfig $framework): void {
// append the client cert to the scoped client
$framework->httpClient()->scopedClient('account.server.client')
->baseUri('http://google.com/')
->passphrase('PASSWORD')
->extra([
'curl' => [
CURLOPT_SSLCERT_BLOB => 'CERT',
CURLOPT_SSLKEY_BLOB => 'KEY',
],
])
;
};
Possible Solution
No response
Additional Context
No response
Symfony version(s) affected
7.2.4
Description
The extra function in the generated file
var/cache/dev/Symfony/Config/Framework/HttpClient/ScopedClientConfig.phpis typehinted as@param ParamConfigurator|list<ParamConfigurator|mixed> $valuewhich is causing an issue in my framework.php config file.Here is an example config that gets the error from phpstan:
The message from PHPStan is:
I think the proper typehint would be
@param ParamConfigurator|array<ParamConfigurator|mixed> $valuebecause list expects the array to be sequential integer keys starting at 0. This is all generated code so I'm not quite sure where the fix would be needed as I'm not familiar with that part of the codebase.How to reproduce
To repro ensure PHPStan in installed and add the following contents to
app/config/packages/framework.php:Possible Solution
No response
Additional Context
No response