Problem/Motivation
See #3483037: [META] Add return types to hook implementations
This includes all access hooks in entity.api.php, being:
- hook_entity_access
- hook_entity_create_access,
- hook_ENTITY_TYPE_access
- hook_ENTITY_TYPE_create_access
- hook_entity_field_access
Steps to reproduce
Proposed resolution
find . -type f -path "*/src/Hook/*.php" -exec sed -i "/#\[Hook('entity_access')\]/ {N;s|\(public function \w*([^)]*)\) *{|\\1: \\\\\\Drupal\\\\Core\\\\Access\\\\AccessResultInterface {|}" {} +
find . -type f -path "*/src/Hook/*.php" -exec sed -i "/#\[Hook('entity_.*_access')\]/ {N;s|\(public function \w*([^)]*)\) *{|\\1: \\\\\\Drupal\\\\Core\\\\Access\\\\AccessResultInterface {|}" {} +
composer phpcbf
./vendor/bin/phpstan --memory-limit=1G --configuration=./core/phpstan.neon.dist --generate-baseline=./core/.phpstan-baseline.php
Remaining tasks
User interface changes
Introduced terminology
API changes
\Drupal\content_moderation\Hook\ContentModerationHooks::entityAccess
returns AccessResult::neutral()
instead of NULL
when it has no opinion.