Skip to content

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

Closed
@VincentLanglet

Description

@VincentLanglet

%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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions