Fix typehint mistake in new Access Policy API

Created on 27 January 2024, 10 months ago
Updated 26 February 2024, 9 months ago

Problem/Motivation

When πŸ“Œ Add the access policy API RTBC landed, we added this piece of code to the base class:

  /**
   * {@inheritdoc}
   */
  public function calculatePermissions(AccountInterface $account, string $scope): CalculatedPermissionsInterface {
    return (new RefinableCalculatedPermissions())->addCacheContexts($this->getPersistentCacheContexts());
  }

That typehint is technically correct because RefinableCalculatedPermissions implements RefinableCalculatedPermissionsInterface, which in turn extends CalculatedPermissionsInterface. But phpstan throws a hissy fit on any extending code because methods of the refinable interface are being called even though we only typehint for the interface with fewer methods.

Proposed resolution

Change the typehint to RefinableCalculatedPermissionsInterface. We can do this without worry as the API hasn't been released yet. So as long as we commit this before 10.3 goes live, we are good.

πŸ“Œ Task
Status

Fixed

Version

11.0 πŸ”₯

Component
BaseΒ  β†’

Last updated about 18 hours ago

Created by

πŸ‡§πŸ‡ͺBelgium kristiaanvandeneynde Antwerp, Belgium

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024