Problem/Motivation

EntityInterface::toLink() currently document $text as a string|null.

The function actually accepts string|null|array|\Drupal\Component\Render\MarkupInterface since it uses Drupal\Core\Link to output markup.

Proposed resolution

Update EntityInterface::toLink() $text documentation so the $text input is correctly hinted.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

None

API changes

None

Data model changes

None

CommentFileSizeAuthor
#3 3322485-3.patch940 bytesanneke_vde
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

anneke_vde created an issue. See original summary.

anneke_vde’s picture

Title: Drupal\Core\Entity\EntityInterface::toLink() $text documented as string|null actually also accepts an render array » EntityInterface::toLink() $text documented as string|null actually also accepts an render array
Issue summary: View changes
anneke_vde’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
940 bytes

Attached patch updates the documentation for EntityInterface::toLink() $text

idebr’s picture

Status: Needs review » Reviewed & tested by the community

Patch works as expected and fixes static code analysis on customer project, thanks!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 3: 3322485-3.patch, failed testing. View results

idebr’s picture

Status: Needs work » Reviewed & tested by the community
1) Drupal\FunctionalTests\Installer\InstallerExistingConfigSyncDirectoryMultilingualTest::testConfigSync
Exception: Warning: Undefined array key "type"
Drupal\field\FieldStorageConfigStorage->mapFromStorageRecords()() (Line: 163)

Unrelated test failure

alexpott’s picture

Version: 9.5.x-dev » 9.4.x-dev
Status: Reviewed & tested by the community » Fixed

Committed and pushed d2c5a0832c to 10.1.x and 0880562ffc to 10.0.x and b4db962330 to 9.5.x and 6a6dc60c08 to 9.4.x. Thanks!

  • alexpott committed d2c5a08 on 10.1.x
    Issue #3322485 by anneke_vde: EntityInterface::toLink() $text documented...

  • alexpott committed 0880562 on 10.0.x
    Issue #3322485 by anneke_vde: EntityInterface::toLink() $text documented...

  • alexpott committed b4db962 on 9.5.x
    Issue #3322485 by anneke_vde: EntityInterface::toLink() $text documented...

  • alexpott committed 6a6dc60 on 9.4.x
    Issue #3322485 by anneke_vde: EntityInterface::toLink() $text documented...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.