diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index 12213a5e2a3dfad6bd93c758b34d9d8311523877..b14a8730b684fe92b557896995d97636d34f53da 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -15598,12 +15598,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/content_moderation/src/Form/EntityModerationForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\content_moderation\\\\Hook\\\\ContentModerationHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/content_moderation/src/Hook/ContentModerationHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\content_moderation\\\\Hook\\\\ContentModerationHooks\\:\\:entityBaseFieldInfo\\(\\) has no return type specified\\.$#', @@ -15634,12 +15628,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/content_moderation/src/Hook/ContentModerationHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\content_moderation\\\\Hook\\\\ContentModerationHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/content_moderation/src/Hook/ContentModerationHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\content_moderation\\\\Hook\\\\ContentModerationHooks\\:\\:entityInsert\\(\\) has no return type specified\\.$#', @@ -16576,12 +16564,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/content_translation/src/Routing/ContentTranslationRouteSubscriber.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\content_translation_test\\\\Hook\\\\ContentTranslationTestHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\content_translation_test\\\\Hook\\\\ContentTranslationTestHooks\\:\\:entityTranslationDelete\\(\\) has no return type specified\\.$#', @@ -17746,12 +17728,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\field_test\\\\Hook\\\\FieldTestFieldHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/field/tests/modules/field_test/src/Hook/FieldTestFieldHooks.php', -]; $ignoreErrors[] = [ // identifier: empty.variable 'message' => '#^Variable \\$items in empty\\(\\) always exists and is not falsy\\.$#', @@ -17782,12 +17758,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\field_test_boolean_access_denied\\\\Hook\\\\FieldTestBooleanAccessDeniedHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/field/tests/modules/field_test_boolean_access_denied/src/Hook/FieldTestBooleanAccessDeniedHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\field\\\\Functional\\\\EntityReference\\\\EntityReferenceAdminTest\\:\\:assertFieldDoesNotExist\\(\\) has no return type specified\\.$#', @@ -18946,12 +18916,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/field_ui/src/Routing/RouteSubscriber.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\field_ui_test\\\\Hook\\\\FieldUiTestHooks\\:\\:fieldConfigAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/field_ui/tests/modules/field_ui_test/src/Hook/FieldUiTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\field_ui\\\\Functional\\\\FieldUIDeleteTest\\:\\:assertFieldDoesNotExist\\(\\) has no return type specified\\.$#', @@ -21190,12 +21154,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/image/src/Routing/ImageStyleRoutes.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\image_access_test_hidden\\\\Hook\\\\ImageAccessTestHiddenHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/image/tests/modules/image_access_test_hidden/src/Hook/ImageAccessTestHiddenHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\image_module_test\\\\Hook\\\\ImageModuleTestHooks\\:\\:imageStylePresave\\(\\) has no return type specified\\.$#', @@ -21868,12 +21826,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/jsonapi/src/Serializer/Serializer.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\jsonapi_test_field_access\\\\Hook\\\\JsonapiTestFieldAccessHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/jsonapi/tests/modules/jsonapi_test_field_access/src/Hook/JsonapiTestFieldAccessHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function jsonapi_test_field_filter_access_jsonapi_entity_field_filter_access\\(\\) has no return type specified\\.$#', @@ -22684,12 +22636,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/language/src/Hook/LanguageHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\language\\\\Hook\\\\LanguageHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/language/src/Hook/LanguageHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\language\\\\Hook\\\\LanguageHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -22894,12 +22840,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\language_entity_field_access_test\\\\Hook\\\\LanguageEntityFieldAccessTestHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/language/tests/language_entity_field_access_test/src/Hook/LanguageEntityFieldAccessTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\language_test\\\\Controller\\\\LanguageTestController\\:\\:create\\(\\) has no return type specified\\.$#', @@ -23542,12 +23482,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/layout_builder/src/Form/RevertOverridesForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\layout_builder\\\\Hook\\\\LayoutBuilderHooks\\:\\:blockContentAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/layout_builder/src/Hook/LayoutBuilderHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\layout_builder\\\\Hook\\\\LayoutBuilderHooks\\:\\:entityDelete\\(\\) has no return type specified\\.$#', @@ -25636,12 +25570,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/media/src/Form/MediaTypeDeleteConfirmForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media\\\\Hook\\\\MediaHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media/src/Hook/MediaHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\media\\\\Hook\\\\MediaHooks\\:\\:help\\(\\) has no return type specified\\.$#', @@ -25870,12 +25798,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/media/src/Plugin/views/filter/Status.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media_test_embed\\\\Hook\\\\MediaTestEmbedHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media/tests/modules/media_test_embed/src/Hook/MediaTestEmbedHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\media_test_embed\\\\Routing\\\\RouteSubscriber\\:\\:alterRoutes\\(\\) has no return type specified\\.$#', @@ -26536,12 +26458,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/media_library/src/Hook/MediaLibraryHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media_library\\\\Hook\\\\MediaLibraryHooks\\:\\:imageStyleAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media_library/src/Hook/MediaLibraryHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\media_library\\\\MediaLibraryServiceProvider\\:\\:register\\(\\) has no return type specified\\.$#', @@ -26614,18 +26530,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/media_library/tests/modules/media_library_test/src/Form/TestNodeFormOverride.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media_library_test\\\\Hook\\\\MediaLibraryTestHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media_library/tests/modules/media_library_test/src/Hook/MediaLibraryTestHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\media_library_test\\\\Hook\\\\MediaLibraryTestHooks\\:\\:mediaCreateAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/media_library/tests/modules/media_library_test/src/Hook/MediaLibraryTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\media_library_test_widget\\\\Plugin\\\\Field\\\\FieldWidget\\\\MediaLibraryInceptionWidget\\:\\:elementValidate\\(\\) has no return type specified\\.$#', @@ -29826,12 +29730,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/node/src/Hook/NodeHooks1.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\node\\\\Hook\\\\NodeHooks1\\:\\:nodeAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/node/src/Hook/NodeHooks1.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\node\\\\Hook\\\\NodeHooks1\\:\\:userPredelete\\(\\) has no return type specified\\.$#', @@ -30228,12 +30126,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/node/tests/modules/node_access_test/node_access_test.module', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\node_access_test\\\\Hook\\\\NodeAccessTestHooks\\:\\:nodeAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/node/tests/modules/node_access_test/src/Hook/NodeAccessTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\node_test\\\\Hook\\\\NodeTestHooks\\:\\:nodeInsert\\(\\) has no return type specified\\.$#', @@ -32100,24 +31992,12 @@ 'count' => 1, 'path' => __DIR__ . '/modules/rest/src/Routing/ResourceRoutes.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\config_test_rest\\\\Hook\\\\ConfigTestRestHooks\\:\\:configTestAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\rest_test\\\\Hook\\\\RestTestHooks\\:\\:entityBaseFieldInfo\\(\\) has no return type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\rest_test\\\\Hook\\\\RestTestHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\Tests\\\\rest\\\\Functional\\\\EntityResource\\\\EntityResourceTestBase\\:\\:assert406Response\\(\\) has no return type specified\\.$#', @@ -36194,12 +36074,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/EntityTestViewBuilder.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityBaseFieldInfo\\(\\) has no return type specified\\.$#', @@ -36212,24 +36086,12 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityCreateAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityExtraFieldInfo\\(\\) has no return type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityInsert\\(\\) has no return type specified\\.$#', @@ -36260,18 +36122,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityTestAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityTestCreateAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\entity_test\\\\Hook\\\\EntityTestHooks\\:\\:entityTestInsert\\(\\) has no return type specified\\.$#', @@ -43113,24 +42963,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/user/src/UserStorageInterface.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\user_access_test\\\\Hook\\\\UserAccessTestHooks\\:\\:entityCreateAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\user_access_test\\\\Hook\\\\UserAccessTestHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php', -]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\user_access_test\\\\Hook\\\\UserAccessTestHooks\\:\\:userAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\user_language_test\\\\Controller\\\\UserLanguageTestController\\:\\:buildPostResponse\\(\\) has no return type specified\\.$#', @@ -50337,12 +50169,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\views_entity_test\\\\Hook\\\\ViewsEntityTestHooks\\:\\:entityFieldAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views_entity_test\\\\Hook\\\\ViewsEntityTestHooks\\:\\:entityLoad\\(\\) has no return type specified\\.$#', @@ -52893,12 +52719,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/workflows/tests/modules/workflow_type_test/src/Form/ComplexTestTypeConfigureForm.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\workflow_type_test\\\\Hook\\\\WorkflowTypeTestHooks\\:\\:workflowAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/workflows/tests/modules/workflow_type_test/src/Hook/WorkflowTypeTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\workflow_type_test\\\\Plugin\\\\WorkflowType\\\\WorkflowCustomAccessType\\:\\:workflowAccess\\(\\) has no return type specified\\.$#', @@ -53295,24 +53115,12 @@ 'count' => 1, 'path' => __DIR__ . '/modules/workspaces/src/FormOperations.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\workspaces\\\\Hook\\\\WorkspacesHooks\\:\\:entityAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/workspaces/src/Hook/WorkspacesHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\workspaces\\\\Hook\\\\WorkspacesHooks\\:\\:entityBaseFieldInfo\\(\\) has no return type specified\\.$#', 'count' => 1, 'path' => __DIR__ . '/modules/workspaces/src/Hook/WorkspacesHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\workspaces\\\\Hook\\\\WorkspacesHooks\\:\\:entityCreateAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/workspaces/src/Hook/WorkspacesHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\workspaces\\\\Hook\\\\WorkspacesHooks\\:\\:entityDelete\\(\\) has no return type specified\\.$#', @@ -53583,12 +53391,6 @@ 'count' => 1, 'path' => __DIR__ . '/modules/workspaces/src/WorkspacesServiceProvider.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Method Drupal\\\\workspace_access_test\\\\Hook\\\\WorkspaceAccessTestHooks\\:\\:workspaceAccess\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/workspaces/tests/modules/workspace_access_test/src/Hook/WorkspaceAccessTestHooks.php', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\workspace_update_test\\\\Negotiator\\\\TestWorkspaceNegotiator\\:\\:getActiveWorkspace\\(\\) has no return type specified\\.$#', diff --git a/core/lib/Drupal/Core/Entity/entity.api.php b/core/lib/Drupal/Core/Entity/entity.api.php index 5c5d9a264e2bf3836f2d344c48837d6e26757752..d57ed231e0ab185bfeda9ef460efa97b8007fa65 100644 --- a/core/lib/Drupal/Core/Entity/entity.api.php +++ b/core/lib/Drupal/Core/Entity/entity.api.php @@ -709,7 +709,7 @@ * * @ingroup entity_api */ -function hook_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account) { +function hook_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account): \Drupal\Core\Access\AccessResultInterface { // No opinion. return AccessResult::neutral(); } @@ -741,7 +741,7 @@ function hook_entity_access(\Drupal\Core\Entity\EntityInterface $entity, $operat * * @ingroup entity_api */ -function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account) { +function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $operation, \Drupal\Core\Session\AccountInterface $account): \Drupal\Core\Access\AccessResultInterface { // No opinion. return AccessResult::neutral(); } @@ -768,7 +768,7 @@ function hook_ENTITY_TYPE_access(\Drupal\Core\Entity\EntityInterface $entity, $o * * @ingroup entity_api */ -function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $account, array $context, $entity_bundle) { +function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $account, array $context, $entity_bundle): \Drupal\Core\Access\AccessResultInterface { // No opinion. return AccessResult::neutral(); } @@ -794,7 +794,7 @@ function hook_entity_create_access(\Drupal\Core\Session\AccountInterface $accoun * * @ingroup entity_api */ -function hook_ENTITY_TYPE_create_access(\Drupal\Core\Session\AccountInterface $account, array $context, $entity_bundle) { +function hook_ENTITY_TYPE_create_access(\Drupal\Core\Session\AccountInterface $account, array $context, $entity_bundle): \Drupal\Core\Access\AccessResultInterface { // No opinion. return AccessResult::neutral(); } @@ -2162,7 +2162,7 @@ function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\Ent * * @see \Drupal\Core\Entity\EntityAccessControlHandlerInterface::fieldAccess() */ -function hook_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, ?\Drupal\Core\Field\FieldItemListInterface $items = NULL) { +function hook_entity_field_access($operation, \Drupal\Core\Field\FieldDefinitionInterface $field_definition, \Drupal\Core\Session\AccountInterface $account, ?\Drupal\Core\Field\FieldItemListInterface $items = NULL): \Drupal\Core\Access\AccessResultInterface { if ($field_definition->getName() == 'field_of_interest' && $operation == 'edit') { return AccessResult::allowedIfHasPermission($account, 'update field of interest'); } diff --git a/core/modules/content_moderation/src/Hook/ContentModerationHooks.php b/core/modules/content_moderation/src/Hook/ContentModerationHooks.php index cd0ffba64c8975f865da04696cece39b7e9dba72..26f2da79658c679b595ec2df299585306529ccec 100644 --- a/core/modules/content_moderation/src/Hook/ContentModerationHooks.php +++ b/core/modules/content_moderation/src/Hook/ContentModerationHooks.php @@ -2,6 +2,7 @@ namespace Drupal\content_moderation\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\views\Plugin\views\filter\Broken; use Drupal\views\ViewExecutable; use Drupal\views\Views; @@ -205,10 +206,10 @@ public function entityFormDisplayAlter(EntityFormDisplayInterface $form_display, * that wants to moderate things. */ #[Hook('entity_access')] - public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { /** @var \Drupal\content_moderation\ModerationInformationInterface $moderation_info */ $moderation_info = \Drupal::service('content_moderation.moderation_information'); - $access_result = NULL; + $access_result = AccessResult::neutral(); if ($operation === 'view') { $access_result = $entity instanceof EntityPublishedInterface && !$entity->isPublished() ? AccessResult::allowedIfHasPermission($account, 'view any unpublished content') : AccessResult::neutral(); $access_result->addCacheableDependency($entity); @@ -240,7 +241,7 @@ public function entityAccess(EntityInterface $entity, $operation, AccountInterfa * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { if ($items && $operation === 'edit') { /** @var \Drupal\content_moderation\ModerationInformationInterface $moderation_info */ $moderation_info = \Drupal::service('content_moderation.moderation_information'); diff --git a/core/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php b/core/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php index a7e03f04ad7a33fb8d201b7ed6575fead051ef09..218ef4ab170c107feb1c39bd53dfb26a17ab0c54 100644 --- a/core/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php +++ b/core/modules/content_translation/tests/modules/content_translation_test/src/Hook/ContentTranslationTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\content_translation_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Session\AccountInterface; @@ -36,7 +37,7 @@ public function entityBundleInfoAlter(&$bundles): void { * Implements hook_entity_access(). */ #[Hook('entity_access')] - public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { $access = \Drupal::state()->get('content_translation.entity_access.' . $entity->getEntityTypeId()); if (!empty($access[$operation])) { return AccessResult::allowed(); diff --git a/core/modules/field/tests/modules/field_test/src/Hook/FieldTestFieldHooks.php b/core/modules/field/tests/modules/field_test/src/Hook/FieldTestFieldHooks.php index cd7c9db3022cf87274361ea2bac45f4ac2f07808..774038c6ed52311b4090b3e9e230f9a411293c16 100644 --- a/core/modules/field/tests/modules/field_test/src/Hook/FieldTestFieldHooks.php +++ b/core/modules/field/tests/modules/field_test/src/Hook/FieldTestFieldHooks.php @@ -4,6 +4,7 @@ namespace Drupal\field_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; @@ -47,7 +48,7 @@ public function fieldStorageConfigUpdateForbid(FieldStorageConfigInterface $fiel * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { if ($field_definition->getName() == "field_no_{$operation}_access") { return AccessResult::forbidden(); } diff --git a/core/modules/field/tests/modules/field_test_boolean_access_denied/src/Hook/FieldTestBooleanAccessDeniedHooks.php b/core/modules/field/tests/modules/field_test_boolean_access_denied/src/Hook/FieldTestBooleanAccessDeniedHooks.php index 438fa19bfaa32936adada32cd4f14716782b5fd6..dd2a7d099af4b7bc999b1b8eb684afa623cc7e4e 100644 --- a/core/modules/field/tests/modules/field_test_boolean_access_denied/src/Hook/FieldTestBooleanAccessDeniedHooks.php +++ b/core/modules/field/tests/modules/field_test_boolean_access_denied/src/Hook/FieldTestBooleanAccessDeniedHooks.php @@ -4,6 +4,7 @@ namespace Drupal\field_test_boolean_access_denied\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; @@ -19,7 +20,7 @@ class FieldTestBooleanAccessDeniedHooks { * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { return AccessResult::forbiddenIf($field_definition->getName() === \Drupal::state()->get('field.test_boolean_field_access_field')); } diff --git a/core/modules/field_ui/tests/modules/field_ui_test/src/Hook/FieldUiTestHooks.php b/core/modules/field_ui/tests/modules/field_ui_test/src/Hook/FieldUiTestHooks.php index 97a999c6b6bbd2c12b6fed68f3748d0fe6f521d0..cf2e1c7faab0161ff68dc8df99cfb644f2059722 100644 --- a/core/modules/field_ui/tests/modules/field_ui_test/src/Hook/FieldUiTestHooks.php +++ b/core/modules/field_ui/tests/modules/field_ui_test/src/Hook/FieldUiTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\field_ui_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Render\Element; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Access\AccessResult; @@ -19,7 +20,7 @@ class FieldUiTestHooks { * Implements hook_ENTITY_TYPE_access(). */ #[Hook('field_config_access')] - public function fieldConfigAccess(FieldConfigInterface $field) { + public function fieldConfigAccess(FieldConfigInterface $field): AccessResultInterface { return AccessResult::forbiddenIf($field->getName() == 'highlander'); } diff --git a/core/modules/image/tests/modules/image_access_test_hidden/src/Hook/ImageAccessTestHiddenHooks.php b/core/modules/image/tests/modules/image_access_test_hidden/src/Hook/ImageAccessTestHiddenHooks.php index 13ea926a6c1efcb766e3763f5d8f91c3e4000cdf..9ed87f04f18f40f077647dfd16d794f040b2f86d 100644 --- a/core/modules/image/tests/modules/image_access_test_hidden/src/Hook/ImageAccessTestHiddenHooks.php +++ b/core/modules/image/tests/modules/image_access_test_hidden/src/Hook/ImageAccessTestHiddenHooks.php @@ -4,6 +4,7 @@ namespace Drupal\image_access_test_hidden\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; @@ -19,7 +20,7 @@ class ImageAccessTestHiddenHooks { * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { if ($field_definition->getName() == 'field_image' && $operation == 'edit') { return AccessResult::forbidden(); } diff --git a/core/modules/jsonapi/tests/modules/jsonapi_test_field_access/src/Hook/JsonapiTestFieldAccessHooks.php b/core/modules/jsonapi/tests/modules/jsonapi_test_field_access/src/Hook/JsonapiTestFieldAccessHooks.php index 0eac08911f9190cea33cc8ca958775f2b3f00ade..cead8815d0f149e63b0b3db3a432fb19d46a6129 100644 --- a/core/modules/jsonapi/tests/modules/jsonapi_test_field_access/src/Hook/JsonapiTestFieldAccessHooks.php +++ b/core/modules/jsonapi/tests/modules/jsonapi_test_field_access/src/Hook/JsonapiTestFieldAccessHooks.php @@ -4,6 +4,7 @@ namespace Drupal\jsonapi_test_field_access\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Field\FieldDefinitionInterface; @@ -18,7 +19,7 @@ class JsonapiTestFieldAccessHooks { * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account): AccessResultInterface { // @see \Drupal\Tests\jsonapi\Functional\ResourceTestBase::testRelationships(). if ($field_definition->getName() === 'field_jsonapi_test_entity_ref') { // Forbid access in all cases. diff --git a/core/modules/language/src/Hook/LanguageHooks.php b/core/modules/language/src/Hook/LanguageHooks.php index efee95af2d2d209bdacc3ff571310efff057069a..af87a145792cfc8819c3aed9e349be4afea5ac1c 100644 --- a/core/modules/language/src/Hook/LanguageHooks.php +++ b/core/modules/language/src/Hook/LanguageHooks.php @@ -2,6 +2,7 @@ namespace Drupal\language\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrlFallback; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUrl; use Drupal\language\Plugin\LanguageNegotiation\LanguageNegotiationUI; @@ -300,7 +301,7 @@ public function fieldInfoAlter(&$info): void { * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { // Only allow edit access on a langcode field if the entity it is attached to // is configured to have an alterable language. Also without items we can not // decide whether or not to allow access. diff --git a/core/modules/language/tests/language_entity_field_access_test/src/Hook/LanguageEntityFieldAccessTestHooks.php b/core/modules/language/tests/language_entity_field_access_test/src/Hook/LanguageEntityFieldAccessTestHooks.php index 95fcfeef468e8c573db3f9cf8d220355b46b4c49..f0df2bc3fd62b20b57373cc3ffee98f1b4c3b40c 100644 --- a/core/modules/language/tests/language_entity_field_access_test/src/Hook/LanguageEntityFieldAccessTestHooks.php +++ b/core/modules/language/tests/language_entity_field_access_test/src/Hook/LanguageEntityFieldAccessTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\language_entity_field_access_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; @@ -19,7 +20,7 @@ class LanguageEntityFieldAccessTestHooks { * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { return AccessResult::forbidden(); } diff --git a/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php b/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php index 195cb0db3d19f8849e57c2619d90b9568f6b352d..2e000df78f45f89b426e4aaaf6e1b3361c7f9fc3 100644 --- a/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php +++ b/core/modules/layout_builder/src/Hook/LayoutBuilderHooks.php @@ -2,6 +2,7 @@ namespace Drupal\layout_builder\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Link; use Drupal\Core\Breadcrumb\Breadcrumb; @@ -261,7 +262,7 @@ public function pluginFilterBlockAlter(array &$definitions, array $extra, $consu * Implements hook_ENTITY_TYPE_access(). */ #[Hook('block_content_access')] - public function blockContentAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function blockContentAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { /** @var \Drupal\block_content\BlockContentInterface $entity */ if ($operation === 'view' || $entity->isReusable() || empty(\Drupal::service('inline_block.usage')->getUsage($entity->id()))) { // If the operation is 'view' or this is reusable block or if this is diff --git a/core/modules/media/src/Hook/MediaHooks.php b/core/modules/media/src/Hook/MediaHooks.php index d8cb68552725d8019662448d475b8a43397210c7..0745eb8e5b53bd7b312a3a0d251f685338415ca6 100644 --- a/core/modules/media/src/Hook/MediaHooks.php +++ b/core/modules/media/src/Hook/MediaHooks.php @@ -2,6 +2,7 @@ namespace Drupal\media\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\views\ViewExecutable; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Field\FieldTypeCategoryManagerInterface; @@ -102,7 +103,7 @@ public function theme() : array { * Implements hook_entity_access(). */ #[Hook('entity_access')] - public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { if ($operation === 'delete' && $entity instanceof FieldConfigInterface && $entity->getTargetEntityTypeId() === 'media') { /** @var \Drupal\media\MediaTypeInterface $media_type */ $media_type = \Drupal::entityTypeManager()->getStorage('media_type')->load($entity->getTargetBundle()); diff --git a/core/modules/media/tests/modules/media_test_embed/src/Hook/MediaTestEmbedHooks.php b/core/modules/media/tests/modules/media_test_embed/src/Hook/MediaTestEmbedHooks.php index 19d6399dcbc113ce3686327da603d97254eafe08..fb518f051f73c7db74bf830702db68acf8635e03 100644 --- a/core/modules/media/tests/modules/media_test_embed/src/Hook/MediaTestEmbedHooks.php +++ b/core/modules/media/tests/modules/media_test_embed/src/Hook/MediaTestEmbedHooks.php @@ -4,6 +4,7 @@ namespace Drupal\media_test_embed\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Entity\Display\EntityViewDisplayInterface; @@ -28,7 +29,7 @@ public function entityViewAlter(&$build, EntityInterface $entity, EntityViewDisp * Implements hook_entity_access(). */ #[Hook('entity_access')] - public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { return AccessResult::neutral()->addCacheTags([ '_media_test_embed_filter_access:' . $entity->getEntityTypeId() . ':' . $entity->id(), ]); diff --git a/core/modules/media_library/src/Hook/MediaLibraryHooks.php b/core/modules/media_library/src/Hook/MediaLibraryHooks.php index a8da48121dfb6a10991bdaefe561e1936ae0b908..0bf9fdf9a2a57a37a082a6ae66152f97e3659017 100644 --- a/core/modules/media_library/src/Hook/MediaLibraryHooks.php +++ b/core/modules/media_library/src/Hook/MediaLibraryHooks.php @@ -3,6 +3,7 @@ namespace Drupal\media_library\Hook; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem; @@ -242,13 +243,14 @@ public function localTasksAlter(&$local_tasks): void { * Implements hook_ENTITY_TYPE_access(). */ #[Hook('image_style_access')] - public function imageStyleAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function imageStyleAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { // Prevent the fallback 'media_library' image style from being deleted. // @todo Lock the image style instead of preventing delete access. // https://www.drupal.org/project/drupal/issues/2247293 if ($operation === 'delete' && $entity->id() === 'media_library') { return AccessResult::forbidden(); } + return AccessResult::neutral(); } } diff --git a/core/modules/media_library/tests/modules/media_library_test/src/Hook/MediaLibraryTestHooks.php b/core/modules/media_library/tests/modules/media_library_test/src/Hook/MediaLibraryTestHooks.php index a8ac4d0b58916b98e6bc4b7647bf1523ae8200f8..f0efd2f7951a27374634b50962c6079c3deb17b6 100644 --- a/core/modules/media_library/tests/modules/media_library_test/src/Hook/MediaLibraryTestHooks.php +++ b/core/modules/media_library/tests/modules/media_library_test/src/Hook/MediaLibraryTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\media_library_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\media_library_test\Form\TestNodeFormOverride; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldDefinitionInterface; @@ -20,7 +21,7 @@ class MediaLibraryTestHooks { * Implements hook_ENTITY_TYPE_create_access(). */ #[Hook('media_create_access')] - public function mediaCreateAccess(AccountInterface $account, array $context, $entity_bundle) { + public function mediaCreateAccess(AccountInterface $account, array $context, $entity_bundle): AccessResultInterface { if (isset($context['media_library_state'])) { /** @var \Drupal\media_library\MediaLibraryState $state */ $state = $context['media_library_state']; @@ -33,7 +34,7 @@ public function mediaCreateAccess(AccountInterface $account, array $context, $en * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { $deny_fields = \Drupal::state()->get('media_library_test_entity_field_access_deny_fields', []); // Always deny the field_media_no_access field. $deny_fields[] = 'field_media_no_access'; diff --git a/core/modules/node/src/Hook/NodeHooks1.php b/core/modules/node/src/Hook/NodeHooks1.php index 4431ea541d71d8a7d65b71fbf26e43fbf2cb46dd..8bd4fcf9007c27d94bf5c1956b65c5549fcac360 100644 --- a/core/modules/node/src/Hook/NodeHooks1.php +++ b/core/modules/node/src/Hook/NodeHooks1.php @@ -2,6 +2,7 @@ namespace Drupal\node\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\language\ConfigurableLanguageInterface; use Drupal\Core\Database\Query\SelectInterface; use Drupal\Core\Database\Query\AlterableInterface; @@ -361,7 +362,7 @@ public function formSystemThemesAdminFormAlter(&$form, FormStateInterface $form_ * Implements hook_ENTITY_TYPE_access(). */ #[Hook('node_access')] - public function nodeAccess(NodeInterface $node, $operation, AccountInterface $account) { + public function nodeAccess(NodeInterface $node, $operation, AccountInterface $account): AccessResultInterface { $type = $node->bundle(); // Note create access is handled by hook_ENTITY_TYPE_create_access(). switch ($operation) { diff --git a/core/modules/node/tests/modules/node_access_test/src/Hook/NodeAccessTestHooks.php b/core/modules/node/tests/modules/node_access_test/src/Hook/NodeAccessTestHooks.php index 3de72af339c21ee0978dc87808f24a98080f9f76..3efd7c319488f806dc2d687fea6775264a3030e2 100644 --- a/core/modules/node/tests/modules/node_access_test/src/Hook/NodeAccessTestHooks.php +++ b/core/modules/node/tests/modules/node_access_test/src/Hook/NodeAccessTestHooks.php @@ -5,6 +5,7 @@ namespace Drupal\node_access_test\Hook; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Session\AccountInterface; use Drupal\node\NodeInterface; use Drupal\Core\Hook\Attribute\Hook; @@ -102,7 +103,7 @@ public function nodeAccessRecords(NodeInterface $node): array { * Implements hook_ENTITY_TYPE_access(). */ #[Hook('node_access')] - public function nodeAccess(NodeInterface $node, $operation, AccountInterface $account) { + public function nodeAccess(NodeInterface $node, $operation, AccountInterface $account): AccessResultInterface { $secret_catalan = \Drupal::state()->get('node_access_test_secret_catalan') ?: 0; if ($secret_catalan && $node->language()->getId() == 'ca') { // Make all Catalan content secret. diff --git a/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php b/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php index 808c95082f776b05b37f725f249d37de60119e6c..12d2e1a3faecd77134538e611bd3f906bbc41835 100644 --- a/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php +++ b/core/modules/rest/tests/modules/config_test_rest/src/Hook/ConfigTestRestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\config_test_rest\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResultReasonInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Session\AccountInterface; @@ -30,7 +31,7 @@ public function entityTypeAlter(array &$entity_types) : void { * Implements hook_ENTITY_TYPE_access(). */ #[Hook('config_test_access')] - public function configTestAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function configTestAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { // Add permission, so that EntityResourceTestBase's scenarios can test access // being denied. By default, all access is always allowed for the config_test // config entity. diff --git a/core/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php b/core/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php index 7e2ba048cd5352b514bce90edd0e9ce72c1e75ef..1a87e5a92205c5b205768eac1840356c3a201c7b 100644 --- a/core/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php +++ b/core/modules/rest/tests/modules/rest_test/src/Hook/RestTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\rest_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Access\AccessResult; @@ -23,7 +24,7 @@ class RestTestHooks { * @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::setUp() */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPost() // @see \Drupal\Tests\rest\Functional\EntityResource\EntityResourceTestBase::testPatch() if ($field_definition->getName() === 'field_rest_test') { diff --git a/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php b/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php index 472a1039b19cb72913058322b59c673550da16f2..c8b7a55f5b522e6be2918e13497ccb0b9c8ce06a 100644 --- a/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php +++ b/core/modules/system/tests/modules/entity_test/src/Hook/EntityTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\entity_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Url; use Drupal\Component\Render\FormattableMarkup; @@ -288,7 +289,7 @@ public function entityUpdate(EntityInterface $entity) { * @see \Drupal\system\Tests\Entity\FieldAccessTest::testFieldAccess() */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { if ($field_definition->getName() == 'field_test_text') { if ($items) { if ($items->value == 'no access value') { @@ -610,7 +611,7 @@ public function entityDisplayBuildAlter(&$build, $context): void { * Implements hook_entity_access(). */ #[Hook('entity_access')] - public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { // Only apply to the 'entity_test' entities. if ($entity->getEntityType()->getProvider() != 'entity_test') { return AccessResult::neutral(); @@ -641,7 +642,7 @@ public function entityAccess(EntityInterface $entity, $operation, AccountInterfa * Implements hook_ENTITY_TYPE_access() for 'entity_test'. */ #[Hook('entity_test_access')] - public function entityTestAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityTestAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { \Drupal::state()->set('entity_test_entity_test_access', TRUE); // No opinion. return AccessResult::neutral(); @@ -651,7 +652,7 @@ public function entityTestAccess(EntityInterface $entity, $operation, AccountInt * Implements hook_entity_create_access(). */ #[Hook('entity_create_access')] - public function entityCreateAccess(AccountInterface $account, $context, $entity_bundle) { + public function entityCreateAccess(AccountInterface $account, $context, $entity_bundle): AccessResultInterface { \Drupal::state()->set('entity_test_entity_create_access', TRUE); \Drupal::state()->set('entity_test_entity_create_access_context', $context); if ($entity_bundle === 'forbidden_access_bundle') { @@ -667,7 +668,7 @@ public function entityCreateAccess(AccountInterface $account, $context, $entity_ * Implements hook_ENTITY_TYPE_create_access() for 'entity_test'. */ #[Hook('entity_test_create_access')] - public function entityTestCreateAccess(AccountInterface $account, $context, $entity_bundle) { + public function entityTestCreateAccess(AccountInterface $account, $context, $entity_bundle): AccessResultInterface { \Drupal::state()->set('entity_test_entity_test_create_access', TRUE); // No opinion. return AccessResult::neutral(); diff --git a/core/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php b/core/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php index a346f6d40cca177acbf50c0f9a2c8ea25c343b2d..5772c30926f265f11614bcb6f708d8869600d10e 100644 --- a/core/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php +++ b/core/modules/user/tests/modules/user_access_test/src/Hook/UserAccessTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\user_access_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Session\AccountInterface; @@ -20,7 +21,7 @@ class UserAccessTestHooks { * Implements hook_ENTITY_TYPE_access() for entity type "user". */ #[Hook('user_access')] - public function userAccess(User $entity, $operation, $account) { + public function userAccess(User $entity, $operation, $account): AccessResultInterface { if ($entity->getAccountName() == "no_edit" && $operation == "update") { // Deny edit access. return AccessResult::forbidden(); @@ -40,7 +41,7 @@ public function userAccess(User $entity, $operation, $account) { * Implements hook_entity_create_access(). */ #[Hook('entity_create_access')] - public function entityCreateAccess(AccountInterface $account, array $context, $entity_bundle) { + public function entityCreateAccess(AccountInterface $account, array $context, $entity_bundle): AccessResultInterface { if ($context['entity_type_id'] != 'user') { return AccessResult::neutral(); } @@ -52,7 +53,7 @@ public function entityCreateAccess(AccountInterface $account, array $context, $e * Implements hook_entity_field_access(). */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { // Account with role sub-admin can view the status, init and mail fields for // user with no roles. if ($field_definition->getTargetEntityTypeId() == 'user' && $operation === 'view' && in_array($field_definition->getName(), ['status', 'init', 'mail'])) { diff --git a/core/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php b/core/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php index 27c861c8a910410da197438399021ea99e83d440..539a873cee5846ce6000eac89906f75ae4f24f44 100644 --- a/core/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php +++ b/core/modules/views/tests/modules/views_entity_test/src/Hook/ViewsEntityTestHooks.php @@ -4,6 +4,7 @@ namespace Drupal\views_entity_test\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Access\AccessResult; use Drupal\Core\Field\FieldItemListInterface; use Drupal\Core\Session\AccountInterface; @@ -34,7 +35,7 @@ public function entityBaseFieldInfo(EntityTypeInterface $entity_type) { * @see \Drupal\system\Tests\Entity\FieldAccessTest::testFieldAccess() */ #[Hook('entity_field_access')] - public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL) { + public function entityFieldAccess($operation, FieldDefinitionInterface $field_definition, AccountInterface $account, ?FieldItemListInterface $items = NULL): AccessResultInterface { if ($field_definition->getName() == 'test_text_access') { if ($items) { if ($items->value == 'no access value') { diff --git a/core/modules/workflows/tests/modules/workflow_type_test/src/Hook/WorkflowTypeTestHooks.php b/core/modules/workflows/tests/modules/workflow_type_test/src/Hook/WorkflowTypeTestHooks.php index 63fedc901ca087520f5a5912ccd47616dcd79dc9..6c966bfdbfdc2bf9c301a1ce935e6b2233889228 100644 --- a/core/modules/workflows/tests/modules/workflow_type_test/src/Hook/WorkflowTypeTestHooks.php +++ b/core/modules/workflows/tests/modules/workflow_type_test/src/Hook/WorkflowTypeTestHooks.php @@ -5,6 +5,7 @@ namespace Drupal\workflow_type_test\Hook; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; use Drupal\workflow_type_test\Plugin\WorkflowType\WorkflowCustomAccessType; use Drupal\Core\Session\AccountInterface; use Drupal\workflows\WorkflowInterface; @@ -31,7 +32,7 @@ public function workflowTypeInfoAlter(&$definitions): void { * Implements hook_ENTITY_TYPE_access() for the Workflow entity type. */ #[Hook('workflow_access')] - public function workflowAccess(WorkflowInterface $entity, $operation, AccountInterface $account) { + public function workflowAccess(WorkflowInterface $entity, $operation, AccountInterface $account): AccessResultInterface { if ($entity->getTypePlugin()->getPluginId() === 'workflow_custom_access_type') { return WorkflowCustomAccessType::workflowAccess($entity, $operation, $account); } diff --git a/core/modules/workspaces/src/Hook/WorkspacesHooks.php b/core/modules/workspaces/src/Hook/WorkspacesHooks.php index f9d2c314f07b0fb30d1f1c70486dd500d4b2860a..2a382eb0b3178802747dfd99b9a503d9c150f5ab 100644 --- a/core/modules/workspaces/src/Hook/WorkspacesHooks.php +++ b/core/modules/workspaces/src/Hook/WorkspacesHooks.php @@ -2,6 +2,7 @@ namespace Drupal\workspaces\Hook; +use Drupal\Core\Access\AccessResultInterface; use Drupal\workspaces\ViewsQueryAlter; use Drupal\views\Plugin\views\query\QueryPluginBase; use Drupal\views\ViewExecutable; @@ -185,7 +186,7 @@ public function entityRevisionDelete(EntityInterface $entity) { * @see \Drupal\workspaces\EntityAccess */ #[Hook('entity_access')] - public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function entityAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { return \Drupal::service('class_resolver')->getInstanceFromDefinition(EntityAccess::class)->entityOperationAccess($entity, $operation, $account); } @@ -195,7 +196,7 @@ public function entityAccess(EntityInterface $entity, $operation, AccountInterfa * @see \Drupal\workspaces\EntityAccess */ #[Hook('entity_create_access')] - public function entityCreateAccess(AccountInterface $account, array $context, $entity_bundle) { + public function entityCreateAccess(AccountInterface $account, array $context, $entity_bundle): AccessResultInterface { return \Drupal::service('class_resolver')->getInstanceFromDefinition(EntityAccess::class)->entityCreateAccess($account, $context, $entity_bundle); } diff --git a/core/modules/workspaces/tests/modules/workspace_access_test/src/Hook/WorkspaceAccessTestHooks.php b/core/modules/workspaces/tests/modules/workspace_access_test/src/Hook/WorkspaceAccessTestHooks.php index 7f47e13df26b46885451a4e8ff7c384ba81ccda1..b1d3a888caf09a764fc1911f146713b34f344f81 100644 --- a/core/modules/workspaces/tests/modules/workspace_access_test/src/Hook/WorkspaceAccessTestHooks.php +++ b/core/modules/workspaces/tests/modules/workspace_access_test/src/Hook/WorkspaceAccessTestHooks.php @@ -5,6 +5,7 @@ namespace Drupal\workspace_access_test\Hook; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Access\AccessResultInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Hook\Attribute\Hook; @@ -18,7 +19,7 @@ class WorkspaceAccessTestHooks { * Implements hook_ENTITY_TYPE_access() for the 'workspace' entity type. */ #[Hook('workspace_access')] - public function workspaceAccess(EntityInterface $entity, $operation, AccountInterface $account) { + public function workspaceAccess(EntityInterface $entity, $operation, AccountInterface $account): AccessResultInterface { return \Drupal::state()->get("workspace_access_test.result.{$operation}", AccessResult::neutral()); }