psalm / psalm-plugin-symfony

Psalm Plugin for Symfony
MIT License
229 stars 53 forks source link

[console] Add 'suggestedValues' Parameter #348

Closed jjjb03 closed 4 months ago

jjjb03 commented 4 months ago

I was facing the issue described in #232.

In my case the given Argument Names are not in the Console Handler, after adding them, plugin runs fine.

    protected function configure(): void {
        $this
            ->addArgument(
                'report_id',
                InputArgument::REQUIRED,
                'The Report id to invoke.'
            )
            ->addArgument(
                'query',
                InputArgument::OPTIONAL,
                'The url encoded values for the report.'
            )
            ->addArgument(
                'format',
                InputArgument::OPTIONAL,
                'The format to use',
                default: FileFormatEnum::EXCEL->name,
                suggestedValues: [
                    FileFormatEnum::PDF->name,
                    FileFormatEnum::EXCEL->name,
                    FileFormatEnum::CSV->name,
                ],
            )
            ->addArgument(
                'country',
                InputArgument::OPTIONAL,
                'The country id',
                default: 'DEFAULT',
                suggestedValues: self::COUNTRIES,
            );
    }