Verified Commit 7488aea7 authored by quietone's avatar quietone
Browse files

Issue #3501886 by mstrelan, smustgrave, nicxvan: Add return type to hook...

Issue #3501886 by mstrelan, smustgrave, nicxvan: Add return type to hook implementations without obvious group
parent bd35301f
Loading
Loading
Loading
Loading
Loading
+0 −90
Original line number Diff line number Diff line
@@ -13447,12 +13447,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/comment/src/Hook/CommentHooks.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\comment\\\\Hook\\\\CommentHooks\\:\\:nodeUpdateIndex\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/comment/src/Hook/CommentHooks.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\comment\\\\Plugin\\\\EntityReferenceSelection\\\\CommentSelection\\:\\:entityQueryAlter\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -16609,12 +16603,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/content_translation/tests/src/Unit/Menu/ContentTranslationLocalTasksTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Function contextual_preprocess\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/contextual/contextual.module',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\contextual\\\\ContextualController\\:\\:create\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -31609,12 +31597,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/search/tests/modules/search_extra_type/src/Plugin/Search/SearchExtraTypeSearch.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\search_langcode_test\\\\Hook\\\\SearchLangcodeTestHooks\\:\\:searchPreprocess\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/search/tests/modules/search_langcode_test/src/Hook/SearchLangcodeTestHooks.php',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\Tests\\\\search\\\\Functional\\\\Rest\\\\SearchPageJsonAnonTest\\:\\:assertAuthenticationEdgeCases\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -33877,12 +33859,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/default_format_test/src/DefaultFormatTestController.php',
];
$ignoreErrors[] = [
	'message' => '#^Function deprecation_test_deprecated_hook\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/deprecation_test/deprecation_test.module',
];
$ignoreErrors[] = [
	'message' => '#^Call to deprecated function deprecation_test_function\\(\\)\\:
in drupal\\:8\\.4\\.0 and is removed from drupal\\:9\\.0\\.0\\. This is
@@ -35667,36 +35643,12 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/module_autoload_test/src/SomeClass.php',
];
$ignoreErrors[] = [
	'message' => '#^Function module_test_test_hook\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.file.inc',
];
$ignoreErrors[] = [
	'message' => '#^Function module_test_altered_test_hook\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.implementations.inc',
];
$ignoreErrors[] = [
	'message' => '#^Function module_test_load\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.module',
];
$ignoreErrors[] = [
	'message' => '#^Function module_test_modules_installed\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.module',
];
$ignoreErrors[] = [
	'message' => '#^Function module_test_modules_uninstalled\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/modules/module_test/module_test.module',
];
$ignoreErrors[] = [
	'message' => '#^Function module_test_post_update_test\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -38409,30 +38361,6 @@
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/src/Unit/Routing/AdminRouteSubscriberTest.php',
];
$ignoreErrors[] = [
	'message' => '#^Function nyan_cat_extension\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/themes/engines/nyan_cat/nyan_cat.engine',
];
$ignoreErrors[] = [
	'message' => '#^Function nyan_cat_render_template\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/themes/engines/nyan_cat/nyan_cat.engine',
];
$ignoreErrors[] = [
	'message' => '#^Function test_subtheme_views_post_render\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/themes/test_subtheme/test_subtheme.theme',
];
$ignoreErrors[] = [
	'message' => '#^Function test_subtheme_views_pre_render\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/modules/system/tests/themes/test_subtheme/test_subtheme.theme',
];
$ignoreErrors[] = [
	'message' => '#^Function test_theme_depending_on_modules_post_update_module_install\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -58344,12 +58272,6 @@
	'count' => 1,
	'path' => __DIR__ . '/themes/claro/claro.theme',
];
$ignoreErrors[] = [
	'message' => '#^Function claro_views_pre_render\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/themes/claro/claro.theme',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\claro\\\\ClaroPreRender\\:\\:managedFile\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
@@ -58374,18 +58296,6 @@
	'count' => 1,
	'path' => __DIR__ . '/themes/claro/src/ClaroPreRender.php',
];
$ignoreErrors[] = [
	'message' => '#^Function twig_extension\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/themes/engines/twig/twig.engine',
];
$ignoreErrors[] = [
	'message' => '#^Function twig_render_template\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
	'count' => 1,
	'path' => __DIR__ . '/themes/engines/twig/twig.engine',
];
$ignoreErrors[] = [
	'message' => '#^Method Drupal\\\\olivero\\\\OliveroPreRender\\:\\:textFormat\\(\\) has no return type specified\\.$#',
	'identifier' => 'missingType.return',
+3 −3
Original line number Diff line number Diff line
@@ -556,7 +556,7 @@ function hook_form_system_theme_settings_alter(&$form, \Drupal\Core\Form\FormSta
 * @param string $hook
 *   The name of the theme hook.
 */
function hook_preprocess(&$variables, $hook) {
function hook_preprocess(&$variables, $hook): void {
  static $hooks;

  // Add contextual links to the variables, if the user has permission.
@@ -807,7 +807,7 @@ function hook_themes_uninstalled(array $themes): void {
 * @return string
 *   The file extension the theme engine will recognize.
 */
function hook_extension() {
function hook_extension(): string {
  // Extension for template base names in Twig.
  return '.html.twig';
}
@@ -833,7 +833,7 @@ function hook_extension() {
 *   The output generated from the template. In most cases this will be a string
 *   containing HTML markup.
 */
function hook_render_template($template_file, $variables) {
function hook_render_template($template_file, $variables): string|\Stringable {
  $twig_service = \Drupal::service('twig');

  return $twig_service->loadTemplate($template_file)->render($variables);
+1 −1
Original line number Diff line number Diff line
@@ -337,7 +337,7 @@ public function entityPredelete(EntityInterface $entity): void {
   * Implements hook_node_update_index().
   */
  #[Hook('node_update_index')]
  public function nodeUpdateIndex(EntityInterface $node) {
  public function nodeUpdateIndex(EntityInterface $node): string {
    $index_comments =& drupal_static('comment_node_update_index');
    if ($index_comments === NULL) {
      // Do not index in the following three cases:
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
 * @see contextual_page_attachments()
 * @see \Drupal\contextual\ContextualController::render()
 */
function contextual_preprocess(&$variables, $hook, $info) {
function contextual_preprocess(&$variables, $hook, $info): void {
  // Determine the primary theme function argument.
  if (!empty($info['variables'])) {
    $keys = array_keys($info['variables']);
+2 −2
Original line number Diff line number Diff line
@@ -315,12 +315,12 @@ function hook_node_search_result(NodeInterface $node): array {
 * @param \Drupal\node\NodeInterface $node
 *   The node being indexed.
 *
 * @return string
 * @return string|\Stringable
 *   Additional node information to be indexed.
 *
 * @ingroup entity_crud
 */
function hook_node_update_index(NodeInterface $node) {
function hook_node_update_index(NodeInterface $node): string|\Stringable {
  $text = '';
  $ratings = \Drupal::database()->query('SELECT [title], [description] FROM {my_ratings} WHERE [nid] = :nid', [':nid' => $node->id()]);
  foreach ($ratings as $rating) {
Loading