Correct return typehint on BlockPluginTrait::blockAccess()

Created on 11 January 2023, almost 2 years ago
Updated 15 February 2023, almost 2 years ago

Problem/Motivation

I believe the current type-hint (AccessResult) is incorrect on the BlockPluginTrait::blockAccess() method because:
* We should always type-hint on a contract instead of an implementation - and this is what we do all over around, the type-hint is always AccessResultInterface in similar cases
* This is the method that should be always overridden in child classes according to the doc block instead of BlockPluginTrait::access() - which return value is AccessResult

With this inconsistency when PHPStan is on the board, we keep getting false-positive errors from PHPStan like:

 Method Drupal\feedback\Plugin\Block\FeedbackLinkBlock::blockAccess() should return Drupal\Core\Access\AccessResult but returns Drupal\Core\Access\AccessResultInterface. 

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Fixed

Version

9.5

Component
Base 

Last updated about 4 hours ago

Created by

🇭🇺Hungary mxr576 Hungary

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024