Skip to content

Ignoring extract errors #85

@lsv

Description

@lsv

In a choicetype form element, Im using a Enumtype for choices

$builder->add('gender', ChoiceType::class, [
            'label' => 'Gender',
            'choices' => GenderEnumType::getChoices(),
            'required' => $options['fullprofile'],
            'validation_groups' => $validationGroups,
        ]);

The extractor says this

[ERROR] /home/lsv/Projects/findfesten.dk/src/Form/ProfileType.php                                                      
         Line: 65                                                                                                       
         Message: Form choice is not an array       

Which is indeed 'choices' => GenderEnumType::getChoices(), I know that this is a an array

protected static $choices = [
        self::UNKNOWN => 'Not provided',
        self::MALE => 'Male',
        self::FEMALE => 'Female',
    ];

public static function getChoices(): array
{
    return \array_flip(static::$choices);
}

Is there a way to ignore this line? with a annotations or something? - I dont want to ignore the whole form, but just this single line - Something like this

$builder->add('gender', ChoiceType::class, [
            'label' => 'Gender',
            /** @IgnoreTransNextLine */
            'choices' => GenderEnumType::getChoices(),
            'required' => $options['fullprofile'],
            'validation_groups' => $validationGroups,
        ]);

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