Problem/Motivation
phpstan (https://git.drupalcode.org/project/image_field_to_media/-/jobs/10988841) reports this problem:
------ -----------------------------------------------------------------------
Line image_field_to_media.module
------ -----------------------------------------------------------------------
19 Function image_field_to_media_entity_operation() implements
hook_entity_operation but is missing the CacheableMetadata parameter
added in Drupal 11.3. Update the signature to:
image_field_to_media_entity_operation(\Drupal\Core\Entity\EntityInter
face $entity, \Drupal\Core\Cache\CacheableMetadata $cacheability).
🪪 drupal.proceduralHookEntityOperationMissingCacheabilityParameter
💡 See https://www.drupal.org/node/3533080
------ -----------------------------------------------------------------------
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork image_field_to_media-3613622
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
dkmishra commentedPlease review.
Comment #6
wombatbuddy commentedComment #8
prudloff commentedShouldn't we do something with the $cacheability object to ensure the result is correctly cached? For example add the user.permissions cache context.
Comment #9
dkmishra commentedGood catch, thanks @prudloff — you're right, this needs the user.permissions cache context since the result depends on the current user's permission check.