Labeler::label assumes property definition label is always stringable object
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3557030. -->
Reported by: [mglaman](https://www.drupal.org/user/2416470)
Related to !305
>>>
<h3 id="overview">Overview</h3>
<p>While working on <span class="drupalorg-gitlab-issue-link drupalorg-gitlab-link-wrapper"><a href="https://git.drupalcode.org/project/canvas/-/work_items/3557029" class="drupalorg-gitlab-link">https://git.drupalcode.org/project/canvas/-/work_items/3557029</a></span> I got a crash about calling __toString on a string in Labeler::label.</p>
<pre> '@field-item-properties-labels' => implode(', ', array_map(<br> // @phpstan-ignore-next-line method.nonObject<br> fn (string $field_property_name): string =>$field_definition->getItemDefinition()<br> ->getPropertyDefinition($field_property_name)<br> ->getLabel()<br> ->__toString(),</pre><h3 id="proposed-resolution">Proposed resolution</h3>
<p>Instead of calling __toString we should just cast to string.</p>
<pre> // @phpstan-ignore-next-line method.nonObject<br> fn (string $field_property_name): string => (string) $field_definition->getItemDefinition()<br> ->getPropertyDefinition($field_property_name)<br> ->getLabel(),</pre><p>There is a chance contributed modules may not set the label of their field's properties to an instance of TranslatableMarkup like Drupal Core.</p>
<h3 id="ui-changes">User interface changes</h3>
issue