Commit fa03e38b authored by catch's avatar catch
Browse files

Issue #3239710 by alexpott, daffie, andypost:...

Issue #3239710 by alexpott, daffie, andypost: \Drupal\Core\Menu\StaticMenuLinkOverrides::loadOverride() causes a deprecation on PHP 8.1
parent 0b3a4ce0
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -71,9 +71,10 @@ public function reload() {
   * {@inheritdoc}
   */
  public function loadOverride($id) {
    assert(is_string($id), 'Menu link plugin ID should be a string.');
    $all_overrides = $this->getConfig()->get('definitions');
    $id = static::encodeId($id);
    return $id && isset($all_overrides[$id]) ? $all_overrides[$id] : [];
    return $all_overrides[$id] ?? [];
  }

  /**
+2 −2
Original line number Diff line number Diff line
@@ -21,14 +21,14 @@ public function reload();
   * @param string $id
   *   A menu link plugin ID.
   *
   * @return array|null
   * @return array
   *   An override with following supported keys:
   *     - parent
   *     - weight
   *     - menu_name
   *     - expanded
   *     - enabled
   *   or NULL if there is no override for the given ID.
   *   or an empty array if there is no override for the given ID.
   */
  public function loadOverride($id);

+0 −2
Original line number Diff line number Diff line
@@ -47,8 +47,6 @@ public function testLoadOverride($overrides, $id, $expected) {
   */
  public function providerTestLoadOverride() {
    $data = [];
    // No specified ID.
    $data[] = [['test1' => ['parent' => 'test0']], NULL, []];
    // Valid ID.
    $data[] = [['test1' => ['parent' => 'test0']], 'test1', ['parent' => 'test0']];
    // Non existing ID.