Skip to content

The ParameterDynamicReturnTypeExtension doesn't support correctly syntax like %env(bool:FTP_ACTIVE)% #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
VincentLanglet opened this issue Oct 7, 2021 · 2 comments · Fixed by #200

Comments

@VincentLanglet
Copy link
Contributor

%env(bool:FTP_ACTIVE)% should be considered as a bool but it's considered as a string.

I end up with error like

Parameter #1 $ftp of method App\Core\Service\Logistic\Reflex\ReflexFile::setFtp() expects bool, string given.

Currently, the value is inferred with the code

if ($parameterKey !== null) {
    $parameter = $this->parameterMap->getParameter($parameterKey);
    if ($parameter !== null) {
        return $this->generalizeType($scope->getTypeFromValue($parameter->getValue()));
     }
}

There is a lot of env var processor: https://symfony.com/doc/current/configuration/env_var_processors.html

I can contribute, but how you do you want to handle this @ondrejmirtes ?
Should I check if the value start with %env(bool, ..., to consider this as a special case ?

@ondrejmirtes
Copy link
Member

I don't know the inner workings of PHPStan\Symfony\ParameterMap but I feel like it should somehow use the Symfony internals to correctly resolve this type.

@github-actions
Copy link

github-actions bot commented Mar 7, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants