diff --git a/src/Plugin/rest/resource/RestMenuItemsCachableDepenency.php b/src/Plugin/rest/resource/RestMenuItemsCachableDepenency.php
deleted file mode 100644
index d3adb9b..0000000
--- a/src/Plugin/rest/resource/RestMenuItemsCachableDepenency.php
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-/**
- * Created by PhpStorm.
- * User: breidert
- * Date: 19.06.17
- * Time: 14:26
- */
-
-namespace Drupal\rest_menu_items\Plugin\rest\resource;
-
-use Drupal\Core\Cache\CacheableDependencyInterface;
-use Drupal\Core\Cache\Cache;
-
-class RestMenuItemsCachableDepenency implements CacheableDependencyInterface {
-
-  // Minimum depth parameter
-  protected $minDepth = 1;
-
-  // Maximum depth parameter
-  protected $maxDepth = 1;
-
-  // the menu being exposed
-  protected $menuName = '';
-
-  /**
-   * RestMenuItemsCachableDepenency constructor.
-   *
-   * @param int $minDepth The minimum depth to be used as a cache context
-   * @param int $maxDepth The maximum depth to be used as a cache context
-   */
-  public function __construct($menuName, $minDepth, $maxDepth) {
-    $this->menuName = $menuName;
-    $this->minDepth = $minDepth;
-    $this->maxDepth = $maxDepth;
-  }
-
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCacheContexts() {
-    $contexts = [];
-    // URL parameters as contexts
-    if ($this->minDepth != 1 || $this->maxDepth != 1) {
-      $contexts[] = 'url.query_args';
-    }
-    return $contexts;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCacheTags() {
-    $tags = [];
-    $tags[] = 'config:system.menu.' . $this->menuName;
-    return $tags;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
-  public function getCacheMaxAge() {
-    return Cache::PERMANENT;
-  }
-
-}
diff --git a/src/Plugin/rest/resource/RestMenuItemsCacheableDependency.php b/src/Plugin/rest/resource/RestMenuItemsCacheableDependency.php
new file mode 100644
index 0000000..523cba4
--- /dev/null
+++ b/src/Plugin/rest/resource/RestMenuItemsCacheableDependency.php
@@ -0,0 +1,75 @@
+<?php
+
+namespace Drupal\rest_menu_items\Plugin\rest\resource;
+
+use Drupal\Core\Cache\CacheableDependencyInterface;
+use Drupal\Core\Cache\Cache;
+
+class RestMenuItemsCacheableDependency implements CacheableDependencyInterface {
+
+  /**
+   * Minimum depth parameter.
+   *
+   * @var int
+   */
+  protected $minDepth;
+
+  /**
+   * Minimum depth parameter.
+   *
+   * @var int
+   */
+  protected $maxDepth;
+
+  /**
+   * The name of the menu.
+   *
+   * @var string
+   */
+  protected $menuName;
+
+  /**
+   * RestMenuItemsCachableDepenency constructor.
+   *
+   * @param string $menuName
+   *   The name of the menu.
+   * @param int $minDepth
+   *   The minimum depth to be used as a cache context.
+   * @param int $maxDepth
+   *   The maximum depth to be used as a cache context.
+   */
+  public function __construct($menuName, $minDepth, $maxDepth) {
+    $this->menuName = $menuName;
+    $this->minDepth = $minDepth;
+    $this->maxDepth = $maxDepth;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCacheContexts() {
+    $contexts = [];
+    // URL parameters as contexts.
+    if ($this->minDepth != 1 || $this->maxDepth != 1) {
+      $contexts[] = 'url.query_args';
+    }
+    return $contexts;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCacheTags() {
+    $tags = [];
+    $tags[] = 'config:system.menu.' . $this->menuName;
+    return $tags;
+  }
+
+  /**
+   * {@inheritdoc}
+   */
+  public function getCacheMaxAge() {
+    return Cache::PERMANENT;
+  }
+
+}
diff --git a/src/Plugin/rest/resource/RestMenuItemsResource.php b/src/Plugin/rest/resource/RestMenuItemsResource.php
index b853015..e9b1ced 100644
--- a/src/Plugin/rest/resource/RestMenuItemsResource.php
+++ b/src/Plugin/rest/resource/RestMenuItemsResource.php
@@ -1,14 +1,11 @@
 <?php
-/**
- * @file
- * Create the menu item REST resource.
- */
 
 namespace Drupal\rest_menu_items\Plugin\rest\resource;
 
 use Drupal\Core\Cache\CacheableResponseInterface;
 use Drupal\Core\Config\ConfigFactoryInterface;
 use Drupal\Core\Menu\MenuTreeParameters;
+use Drupal\menu_link_content\Plugin\Menu\MenuLinkContent;
 use Drupal\Core\Path\AliasManagerInterface;
 use Drupal\rest\Plugin\ResourceBase;
 use Drupal\rest\ResourceResponse;
@@ -102,11 +99,12 @@ class RestMenuItemsResource extends ResourceBase {
    *
    * Returns a list of menu items for specified menu name.
    *
-   * @param string|NULL $menu_name
+   * @param string|null $menu_name
    *   The menu name.
    *
    * @return \Drupal\rest\ResourceResponse
    *   The response containing a list of bundle names.
+   *
    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    */
   public function get($menu_name = NULL) {
@@ -130,7 +128,7 @@ class RestMenuItemsResource extends ResourceBase {
       $menu_tree = \Drupal::menuTree();
       $tree = $menu_tree->load($menu_name, $parameters);
 
-      // Return if the menu does not exist or has no entries
+      // Return if the menu does not exist or has no entries.
       if (empty($tree)) {
         return new ResourceResponse($tree);
       }
@@ -149,12 +147,12 @@ class RestMenuItemsResource extends ResourceBase {
 
       $this->getMenuItems($menu['#items'], $this->menuItems);
 
-      // Return response
+      // Return response.
       $response = new ResourceResponse(array_values($this->menuItems));
 
-      // Configure caching for minDepth and maxDepth parameters
+      // Configure caching for minDepth and maxDepth parameters.
       if ($response instanceof CacheableResponseInterface) {
-        $response->addCacheableDependency(new RestMenuItemsCachableDepenency($menu_name, $this->minDepth, $this->maxDepth));
+        $response->addCacheableDependency(new RestMenuItemsCacheableDependency($menu_name, $this->minDepth, $this->maxDepth));
       }
 
       // Return the JSON response.
@@ -226,18 +224,18 @@ class RestMenuItemsResource extends ResourceBase {
   /**
    * Generate the menu element value.
    *
-   * @param $returnArray
+   * @param array $returnArray
    *   The return array we want to add this item to.
    * @param string $key
    *   The key to use in the output.
-   * @param \Drupal\Core\Menu\MenuLinkDefault $link
+   * @param \Drupal\menu_link_content\Plugin\Menu\MenuLinkContent $link
    *   The link from the menu.
    * @param \Drupal\Core\Url $url
    *   The URL object of the menu item.
    *
    * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
    */
-  private function getElementValue(&$returnArray, $key, $link, $url) {
+  private function getElementValue(array &$returnArray, $key, MenuLinkContent $link, Url $url) {
     $external = $url->isExternal();
     $existing = TRUE;
     $value = NULL;
@@ -248,7 +246,8 @@ class RestMenuItemsResource extends ResourceBase {
     else {
       try {
         $uri = $url->getInternalPath();
-      } catch (\UnexpectedValueException $e) {
+      }
+      catch (\UnexpectedValueException $e) {
         $uri = $relative = Url::fromUri($url->getUri())->toString();
         $existing = FALSE;
       }
