Problem/Motivation

DisplayDeriverBase::setEntityTypeManager() type declaration is set to Drupal\Core\Entity\EntityTypeManager.
Modules like Webprofiler (Devel module) extend the entity type manager.
This will cause TypeError exceptions to be thrown in PHP7.

Proposed resolution

Replace the type declaration with Drupal\Core\Entity\EntityTypeManagerInterface.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

sardara created an issue. See original summary.

sardara’s picture

Status: Active » Needs review
StatusFileSize
new1.39 KB
pfrenssen’s picture

Status: Needs review » Needs work

This makes sense, thanks! Just a few small remarks:

  1. +++ b/src/Display/DisplayDeriverBase.php
    @@ -46,7 +46,7 @@ abstract class DisplayDeriverBase implements ContainerDeriverInterface {
    -   * @return \Drupal\Core\Entity\EntityTypeManager
    +   * @return EntityTypeManagerInterface
    

    Please use the fully qualified namespaces in docblocks.

  2. +++ b/src/Display/DisplayDeriverBase.php
    @@ -56,12 +56,12 @@ abstract class DisplayDeriverBase implements ContainerDeriverInterface {
    -   * @param \Drupal\Core\Entity\EntityTypeManager $entity_type_manager
    +   * @param EntityTypeManagerInterface $entity_type_manager
    

    Same here, use the FQN.

sardara’s picture

Assigned: sardara » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.43 KB
new849 bytes

Thanks for the comment Pieter. Remarks addressed.

  • drunken monkey committed 92c312b on 8.x-1.x authored by sardara
    Issue #2773213 by sardara: Fixed type hint in DisplayDeriverBase to use...
drunken monkey’s picture

Status: Needs review » Fixed

Oh, thanks a lot for spotting and fixing this! (And thanks to pfrenssen for reviewing!)
Committed.
Thanks again!

Status: Fixed » Closed (fixed)

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