Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The return type for Adjustment::getLabel() is string.
But when generating adjustments in LocalTaxTypeBase::apply() the label is assigned the return value of $zone->getDisplayLabel() which returns t('VAT') or a variation of this: a TranslatableMarkup object.
So is the LocalTaxTypeBase function wrong in setting the label to TranslatableMarkup, or is the Adjustment definition wrong?
Comments
Comment #2
bojanz CreditAttribution: bojanz at Centarro commentedDrupal is kinda liberal with TranslatableMarkup vs string, since TranslatableMarkup is automatically casted to string.
However, Adjustments are serialized into the database, so we definitely want to cast the label explicitly, to avoid storing the entire TranslatableMarkup object.
(We have the same problem in many other places, but it's not as critical since those other objects are not serialized this way)
Comment #4
bojanz CreditAttribution: bojanz at Centarro commented