You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BaseControl::getLabel() has return type Html|string|null, but in compiled template ->getLabel())?->startTag() is used, so it always acts like there is Html or null. No string.
Steps To Reproduce
Create some custom Form Control with method getLabel() returning string and use it in form:
protectedfunctioncreateComponentForm(): Form
{
$form = newForm();
$form->addText('title', 'Title');
$customCheckbox = newclassextendsCheckbox
{
publicfunctiongetLabel($caption = null)
{
return'this is just string';
}
};
$form->addComponent(new$customCheckbox('Is hidden'), 'is_hidden');
return$form;
}
Version: all (I use 3.1.1, but it is present in master too)
Bug Description
Found by efabrica-team/phpstan-latte#399
BaseControl::getLabel() has return type Html|string|null, but in compiled template
->getLabel())?->startTag()
is used, so it always acts like there isHtml
ornull
. Nostring
.Steps To Reproduce
Create some custom Form Control with method getLabel() returning string and use it in form:
In latte:
You will get error
Call to a member function startTag() on string
Expected Behavior
No error.
Possible Solution
The text was updated successfully, but these errors were encountered: