diff -u b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php --- b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php +++ b/core/lib/Drupal/Core/Menu/MenuTreeStorage.php @@ -76,12 +76,12 @@ /** * List of plugin definition fields. * + * @var array + * * @todo Decide how to keep these field definitions in sync. * https://www.drupal.org/node/2302085 * * @see \Drupal\Core\Menu\MenuLinkManager::$defaults - * - * @var array */ protected $definitionFields = [ 'menu_name', @@ -530,7 +530,7 @@ * @param array $original * The original menu link. */ - protected function moveChildren($fields, $original) { + protected function moveChildren(array $fields, array $original) { $query = $this->connection->update($this->table, $this->options); $query->fields(['menu_name' => $fields['menu_name']]); @@ -581,7 +581,7 @@ * @return array|false * Returns a definition array, or FALSE if no parent was found. */ - protected function findParent($link, $original) { + protected function findParent(array $link, array $original) { $parent = FALSE; // This item is explicitly top-level, skip the rest of the parenting. @@ -792,7 +792,9 @@ // @todo Consider making this dynamic based on static::MAX_DEPTH or from the // schema if that is generated using static::MAX_DEPTH. // https://www.drupal.org/node/2302043 - $subquery->fields($this->table, ['p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9']); + $subquery->fields($this->table, [ + 'p1', 'p2', 'p3', 'p4', 'p5', 'p6', 'p7', 'p8', 'p9', + ]); $subquery->condition('id', $id); $result = current($subquery->execute()->fetchAll(\PDO::FETCH_ASSOC)); $ids = array_filter($result); @@ -839,7 +841,7 @@ * @param array $links * An array of all definitions keyed by ID. */ - protected function saveRecursive($id, &$children, &$links) { + protected function saveRecursive($id, array &$children, array &$links) { if (!empty($links[$id]['parent']) && empty($links[$links[$id]['parent']])) { // Invalid parent ID, so remove it. $links[$id]['parent'] = ''; diff -u b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php --- b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php @@ -69,7 +69,7 @@ // - child-1 // - child-1-1 // - child-1-2 - // - child-2 + // - child-2. $base_options = [ 'title' => 'Menu link test', 'provider' => $module, @@ -129,7 +129,11 @@ $menu_link_plugin = $this->menuLinkManager->createInstance($links[$id]); $expected_parent = $links[$parent] ?? ''; - $this->assertEquals($expected_parent, $menu_link_plugin->getParent(), new FormattableMarkup('Menu link %id has parent of %parent, expected %expected_parent.', ['%id' => $id, '%parent' => $menu_link_plugin->getParent(), '%expected_parent' => $expected_parent])); + $this->assertEquals($expected_parent, $menu_link_plugin->getParent(), new FormattableMarkup('Menu link %id has parent of %parent, expected %expected_parent.', [ + '%id' => $id, + '%parent' => $menu_link_plugin->getParent(), + '%expected_parent' => $expected_parent, + ])); } } @@ -146,7 +150,7 @@ $link = MenuLinkContent::create($options); $link->save(); // Make sure the changed timestamp is set. - $this->assertEquals(REQUEST_TIME, $link->getChangedTime(), 'Creating a menu link sets the "changed" timestamp.'); + $this->assertEquals(\Drupal::time()->getRequestTime(), $link->getChangedTime(), 'Creating a menu link sets the "changed" timestamp.'); $options = [ 'title' => 'Test Link', ]; @@ -154,7 +158,7 @@ $link->changed->value = 0; $link->save(); // Make sure the changed timestamp is updated. - $this->assertEquals(REQUEST_TIME, $link->getChangedTime(), 'Changing a menu link sets "changed" timestamp.'); + $this->assertEquals(\Drupal::time()->getRequestTime(), $link->getChangedTime(), 'Changing a menu link sets "changed" timestamp.'); } /**