diff --git a/core/.phpstan-baseline.php b/core/.phpstan-baseline.php index b2c42d37625..8e14aced6da 100644 --- a/core/.phpstan-baseline.php +++ b/core/.phpstan-baseline.php @@ -12010,12 +12010,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/automated_cron/src/Hook/AutomatedCronHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function ban_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/ban/ban.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\ban\\\\BanIpManager\\:\\:banIp\\(\\) has no return type specified\\.$#', @@ -14044,12 +14038,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function comment_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/comment/comment.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function comment_uri\\(\\) has no return type specified\\.$#', @@ -18622,12 +18610,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/datetime_range/tests/src/Functional/EntityResource/EntityTest/EntityTestDateRangeTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function dblog_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/dblog/dblog.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\dblog\\\\Form\\\\DblogClearLogConfirmForm\\:\\:create\\(\\) has no return type specified\\.$#', @@ -20908,12 +20890,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/file/file.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function file_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/file/file.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function file_managed_file_submit\\(\\) has no return type specified\\.$#', @@ -22432,12 +22408,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/filter/tests/src/Kernel/TextFormatElementFormTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function help_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/help/help.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\help\\\\HelpSectionManager\\:\\:clearCachedDefinitions\\(\\) has no return type specified\\.$#', @@ -22618,12 +22588,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/help/tests/src/Unit/HelpTopicTwigTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function history_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/history/history.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function history_write\\(\\) has no return type specified\\.$#', @@ -25468,12 +25432,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/language/tests/src/Unit/Menu/LanguageLocalTasksTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function layout_builder_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/layout_builder/layout_builder.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function layout_builder_module_implements_alter\\(\\) has no return type specified\\.$#', @@ -27208,12 +27166,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/locale/locale.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function locale_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/locale/locale.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function locale_update_10300\\(\\) has no return type specified\\.$#', @@ -32490,12 +32442,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/node/node.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function node_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/node/node.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function _node_access_rebuild_batch_finished\\(\\) has no return type specified\\.$#', @@ -36066,12 +36012,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/search/search.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function search_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/search/search.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function search_theme_suggestions_search_result\\(\\) has no return type specified\\.$#', @@ -37026,12 +36966,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/settings_tray/tests/src/Unit/Access/BlockPluginHasSettingsTrayFormAccessCheckTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function shortcut_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/shortcut/shortcut.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\shortcut\\\\Entity\\\\Shortcut\\:\\:postSave\\(\\) has no return type specified\\.$#', @@ -38526,12 +38460,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/system/system.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function system_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/system.install', -]; $ignoreErrors[] = [ // identifier: variable.undefined 'message' => '#^Variable \\$directories might not be defined\\.$#', @@ -39408,12 +39336,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/css_disable_transitions_test/src/Hook/CssDisableTransitionsTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function database_test_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/database_test/database_test.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\database_test\\\\Form\\\\DatabaseTestForm\\:\\:submitForm\\(\\) has no return type specified\\.$#', @@ -40010,12 +39932,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/entity_schema_test/src/Hook/EntitySchemaTestHooks.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function entity_test_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/entity_test/entity_test.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function _entity_test_record_hooks\\(\\) has no return type specified\\.$#', @@ -42229,12 +42145,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.implementations.inc', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function module_test_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function module_test_hook_info\\(\\) has no return type specified\\.$#', @@ -42432,12 +42342,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/performance_test/src/PerformanceDataCollector.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function pgsql_test_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/pgsql_test/pgsql_test.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\plugin_test\\\\Hook\\\\PluginTestHooks\\:\\:pluginTestAlter\\(\\) has no return type specified\\.$#', @@ -43599,12 +43503,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/system/tests/modules/update_test_schema/update_test_schema.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function update_test_schema_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/system/tests/modules/update_test_schema/update_test_schema.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function update_test_schema_update_8001\\(\\) has no return type specified\\.$#', @@ -48957,12 +48855,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/user/tests/src/Unit/UserAccessControlHandlerTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function user_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/user/user.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function _user_cancel\\(\\) has no return type specified\\.$#', @@ -56109,12 +56001,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/src/Plugin/views/style/StyleTest.php', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function views_test_data_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/views/tests/modules/views_test_data/views_test_data.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Method Drupal\\\\views_test_entity_reference\\\\Hook\\\\ViewsTestEntityReferenceHooks\\:\\:viewsDataAlter\\(\\) has no return type specified\\.$#', @@ -60177,12 +60063,6 @@ $ignoreErrors[] = [ 'count' => 1, 'path' => __DIR__ . '/modules/workspaces/workspaces.install', ]; -$ignoreErrors[] = [ - // identifier: missingType.return - 'message' => '#^Function workspaces_schema\\(\\) has no return type specified\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/modules/workspaces/workspaces.install', -]; $ignoreErrors[] = [ // identifier: missingType.return 'message' => '#^Function demo_umami_requirements\\(\\) has no return type specified\\.$#', diff --git a/core/lib/Drupal/Core/Database/database.api.php b/core/lib/Drupal/Core/Database/database.api.php index 76dbb14fcef..00fc79f5b16 100644 --- a/core/lib/Drupal/Core/Database/database.api.php +++ b/core/lib/Drupal/Core/Database/database.api.php @@ -577,7 +577,7 @@ function hook_query_TAG_alter(Drupal\Core\Database\Query\AlterableInterface $que * * @ingroup schemaapi */ -function hook_schema() { +function hook_schema(): array { $schema['users_data'] = [ 'description' => 'Stores module data as key/value pairs per user.', 'fields' => [ diff --git a/core/modules/ban/ban.install b/core/modules/ban/ban.install index f3c003a91c3..28bf7492a87 100644 --- a/core/modules/ban/ban.install +++ b/core/modules/ban/ban.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function ban_schema() { +function ban_schema(): array { $schema['ban_ip'] = [ 'description' => 'Stores banned IP addresses.', 'fields' => [ diff --git a/core/modules/comment/comment.install b/core/modules/comment/comment.install index e86e629a343..b170eed6d44 100644 --- a/core/modules/comment/comment.install +++ b/core/modules/comment/comment.install @@ -33,7 +33,7 @@ function comment_install(): void { /** * Implements hook_schema(). */ -function comment_schema() { +function comment_schema(): array { $schema['comment_entity_statistics'] = [ 'description' => 'Maintains statistics of entity and comments posts to show "new" and "updated" flags.', 'fields' => [ diff --git a/core/modules/dblog/dblog.install b/core/modules/dblog/dblog.install index 796799c7b7f..78d780ed1e0 100644 --- a/core/modules/dblog/dblog.install +++ b/core/modules/dblog/dblog.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function dblog_schema() { +function dblog_schema(): array { $schema['watchdog'] = [ 'description' => 'Table that contains logs of all system events.', 'fields' => [ diff --git a/core/modules/file/file.install b/core/modules/file/file.install index cc816f6ec00..698cd5c404a 100644 --- a/core/modules/file/file.install +++ b/core/modules/file/file.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function file_schema() { +function file_schema(): array { $schema['file_usage'] = [ 'description' => 'Track where a file is used.', 'fields' => [ diff --git a/core/modules/help/help.install b/core/modules/help/help.install index 442aca8d277..89afa53e63c 100644 --- a/core/modules/help/help.install +++ b/core/modules/help/help.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function help_schema() { +function help_schema(): array { $schema['help_search_items'] = [ 'description' => 'Stores information about indexed help search items', 'fields' => [ diff --git a/core/modules/history/history.install b/core/modules/history/history.install index 80ff36378d3..574c41a8dfa 100644 --- a/core/modules/history/history.install +++ b/core/modules/history/history.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function history_schema() { +function history_schema(): array { $schema['history'] = [ 'description' => 'A record of which {users} have read which {node}s.', 'fields' => [ diff --git a/core/modules/layout_builder/layout_builder.install b/core/modules/layout_builder/layout_builder.install index 587aa49153f..a6717951a5e 100644 --- a/core/modules/layout_builder/layout_builder.install +++ b/core/modules/layout_builder/layout_builder.install @@ -43,7 +43,7 @@ function layout_builder_install(): void { /** * Implements hook_schema(). */ -function layout_builder_schema() { +function layout_builder_schema(): array { $schema['inline_block_usage'] = [ 'description' => 'Track where a block_content entity is used.', 'fields' => [ diff --git a/core/modules/locale/locale.install b/core/modules/locale/locale.install index 3ca2ce3db24..543a8798484 100644 --- a/core/modules/locale/locale.install +++ b/core/modules/locale/locale.install @@ -68,7 +68,7 @@ function locale_uninstall(): void { /** * Implements hook_schema(). */ -function locale_schema() { +function locale_schema(): array { $schema['locales_source'] = [ 'description' => 'List of English source strings.', 'fields' => [ diff --git a/core/modules/node/node.install b/core/modules/node/node.install index d4bc1c5b717..ddde78929ad 100644 --- a/core/modules/node/node.install +++ b/core/modules/node/node.install @@ -40,7 +40,7 @@ function node_requirements($phase) { /** * Implements hook_schema(). */ -function node_schema() { +function node_schema(): array { $schema['node_access'] = [ 'description' => 'Identifies which realm/grant pairs a user must possess in order to view, update, or delete specific nodes.', 'fields' => [ diff --git a/core/modules/search/search.install b/core/modules/search/search.install index d55c4d2f03a..2ca98bc1cfe 100644 --- a/core/modules/search/search.install +++ b/core/modules/search/search.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function search_schema() { +function search_schema(): array { $schema['search_dataset'] = [ 'description' => 'Stores items that will be searched.', 'fields' => [ diff --git a/core/modules/shortcut/shortcut.install b/core/modules/shortcut/shortcut.install index 5f1dd604c35..ed0743df3d1 100644 --- a/core/modules/shortcut/shortcut.install +++ b/core/modules/shortcut/shortcut.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function shortcut_schema() { +function shortcut_schema(): array { $schema['shortcut_set_users'] = [ 'description' => 'Maps users to shortcut sets.', 'fields' => [ diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 5b921ee4696..441f1cccb00 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1638,7 +1638,7 @@ function system_install(): void { /** * Implements hook_schema(). */ -function system_schema() { +function system_schema(): array { // @deprecated The sequences table has been deprecated in drupal:10.2.0 and is // removed from drupal:12.0.0. See https://www.drupal.org/node/3220378. // @todo Remove sequences table in Drupal 12. See https://www.drupal.org/i/3335756 diff --git a/core/modules/system/tests/modules/database_test/database_test.install b/core/modules/system/tests/modules/database_test/database_test.install index 774d8f624c8..6f4d3b7a4f8 100644 --- a/core/modules/system/tests/modules/database_test/database_test.install +++ b/core/modules/system/tests/modules/database_test/database_test.install @@ -15,7 +15,7 @@ declare(strict_types=1); * Therefore, the schema must actually be declared in a normal module * like any other, not directly in the test file. */ -function database_test_schema() { +function database_test_schema(): array { $schema['test'] = [ 'description' => 'Basic test table for the database unit tests.', 'fields' => [ diff --git a/core/modules/system/tests/modules/entity_test/entity_test.install b/core/modules/system/tests/modules/entity_test/entity_test.install index 667b630fc9c..1c8d21cbdf7 100644 --- a/core/modules/system/tests/modules/entity_test/entity_test.install +++ b/core/modules/system/tests/modules/entity_test/entity_test.install @@ -40,7 +40,7 @@ function entity_test_install(): void { /** * Implements hook_schema(). */ -function entity_test_schema() { +function entity_test_schema(): array { // Schema for simple entity. $schema['entity_test_example'] = [ 'description' => 'Stores entity_test items.', diff --git a/core/modules/system/tests/modules/module_test/module_test.install b/core/modules/system/tests/modules/module_test/module_test.install index 7c3638e88d9..7b62b9229a0 100644 --- a/core/modules/system/tests/modules/module_test/module_test.install +++ b/core/modules/system/tests/modules/module_test/module_test.install @@ -12,7 +12,7 @@ use Drupal\Core\Database\Database; /** * Implements hook_schema(). */ -function module_test_schema() { +function module_test_schema(): array { $schema['module_test'] = [ 'description' => 'Dummy table to test the behavior of hook_schema() during module installation.', 'fields' => [ diff --git a/core/modules/system/tests/modules/pgsql_test/pgsql_test.install b/core/modules/system/tests/modules/pgsql_test/pgsql_test.install index 1b8940ef080..d1761978c83 100644 --- a/core/modules/system/tests/modules/pgsql_test/pgsql_test.install +++ b/core/modules/system/tests/modules/pgsql_test/pgsql_test.install @@ -10,7 +10,7 @@ declare(strict_types=1); /** * Implements hook_schema(). */ -function pgsql_test_schema() { +function pgsql_test_schema(): array { $schema['pgsql_sequence_test'] = [ 'description' => 'Test sequence changes on pgsql driver.', 'fields' => [ diff --git a/core/modules/system/tests/modules/update_test_schema/update_test_schema.install b/core/modules/system/tests/modules/update_test_schema/update_test_schema.install index 74f262faf59..09b73cfcfa8 100644 --- a/core/modules/system/tests/modules/update_test_schema/update_test_schema.install +++ b/core/modules/system/tests/modules/update_test_schema/update_test_schema.install @@ -35,7 +35,7 @@ function update_test_schema_requirements($phase) { * * The schema defined here will vary on state to allow for update hook testing. */ -function update_test_schema_schema() { +function update_test_schema_schema(): array { $schema_version = \Drupal::state()->get('update_test_schema_version', 8000); $table = [ 'fields' => [ diff --git a/core/modules/user/user.install b/core/modules/user/user.install index 0d4211433c0..176d329511d 100644 --- a/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -8,7 +8,7 @@ /** * Implements hook_schema(). */ -function user_schema() { +function user_schema(): array { $schema['users_data'] = [ 'description' => 'Stores module data as key/value pairs per user.', 'fields' => [ diff --git a/core/modules/views/tests/modules/views_test_data/views_test_data.install b/core/modules/views/tests/modules/views_test_data/views_test_data.install index 97535ef92ec..06c90bb6ab0 100644 --- a/core/modules/views/tests/modules/views_test_data/views_test_data.install +++ b/core/modules/views/tests/modules/views_test_data/views_test_data.install @@ -10,7 +10,7 @@ declare(strict_types=1); /** * Implements hook_schema(). */ -function views_test_data_schema() { +function views_test_data_schema(): array { return \Drupal::state()->get('views_test_data_schema'); } diff --git a/core/modules/workspaces/workspaces.install b/core/modules/workspaces/workspaces.install index 0028ec805e2..6dfb3312fb8 100644 --- a/core/modules/workspaces/workspaces.install +++ b/core/modules/workspaces/workspaces.install @@ -61,7 +61,7 @@ function workspaces_install(): void { /** * Implements hook_schema(). */ -function workspaces_schema() { +function workspaces_schema(): array { $schema['workspace_association'] = [ 'description' => 'Stores the association between entity revisions and their workspace.', 'fields' => [