php-translation / extractor

Extracts translation strings from source code
MIT License
126 stars 33 forks source link

Symfony FormType - Does not handle class const as option key #131

Closed nfragnet closed 4 years ago

nfragnet commented 5 years ago

Hello,

My FormType looks like this:

class FooType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('bar', BarType::class, [
            BarType::ANY_CONST => 'whatever',
        ]);
    }
}

It seems that the usage of a class const as option key makes the extractor crash with the following message:

In FormTypeLabelImplicit.php line 52:

Notice: Undefined property: PhpParser\Node\Expr\ClassConstFetch::$value 

I'm not sure which test file this case should belong to but as I noticed the issue it in the FormTypeLabelImplicit visitor, I will make a PR adding a test on the FormTypeLabelImplicitTest.