I have run command bin/magento setup:di:compile in my Magento 2.2.7.x. I got below error

Errors during compilation:

MGS\Mmegamenu\Controller\Adminhtml\Mmegamenu\Save Extra parameters passed to parent construct: $ data. File: /home/animolds/public_html/app/code/MGS/Mmegamenu/Controller/Adminhtml/Mmegamenu/Save.php Total Errors Count: 1

[Magento\Framework\Validator\Exception] Error during compilation

this is the save .php file

 <?php /**  *  * Copyright © 2015 Magento. All rights reserved.  * See COPYING.txt for license details.  */ namespace MGS\Mmegamenu\Controller\Adminhtml\Mmegamenu;  use Magento\Framework\UrlInterface;  class Save extends \MGS\Mmegamenu\Controller\Adminhtml\Mmegamenu {     /**      * @var Category      */     protected $  _categoryInstance;       /**      * @var UrlInterface      */     private $  urlBuilder;      /**      * Current category key      *      * @var string      */     protected $  _currentCategoryKey;      /**      * Array of level position counters      *      * @var array      */     protected $  _itemLevelPositions = [];      /**      * Catalog category      *      * @var \Magento\Catalog\Helper\Category      */     protected $  _catalogCategory;      /**      * @var \Magento\Framework\Registry      */     protected $  _registry;      /**      * Customer session      *      * @var \Magento\Framework\App\Http\Context      */     protected $  httpContext;      /**      * Catalog layer      *      * @var \Magento\Catalog\Model\Layer      */     protected $  _catalogLayer;      /**      * Product collection factory      *      * @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory      */     protected $  _productCollectionFactory;      /**      * @var \Magento\Catalog\Model\Indexer\Category\Flat\State      */     protected $  flatState;      /**      * @var \Magento\Framework\ObjectManagerInterface      */     protected $  _objectManager;      /**      * @var \Magento\Cms\Model\Template\FilterProvider      */     protected $  _filterProvider;      /**      * @var \Magento\Cms\Model\Template\FilterProvider      */     protected $  _modelCategory;       /**      * @param \Magento\Framework\View\Element\Template\Context $  context      * @param \Magento\Catalog\Model\CategoryFactory $  categoryFactory      * @param \Magento\Catalog\Model\Category $  modelCategory      * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $  productCollectionFactory      * @param \Magento\Catalog\Model\Layer\Resolver $  layerResolver      * @param \Magento\Framework\App\Http\Context $  httpContext      * @param \Magento\Catalog\Helper\Category $  catalogCategory      * @param \Magento\Framework\Registry $  registry      * @param \Magento\Catalog\Model\Indexer\Category\Flat\State $  flatState      * @param array $  data      */     public function __construct(         \Magento\Backend\App\Action\Context $  context,         \Magento\Catalog\Model\CategoryFactory $  categoryFactory,         \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $  productCollectionFactory,         \Magento\Catalog\Model\Layer\Resolver $  layerResolver,         \Magento\Catalog\Model\Category $  modelCategory,         \Magento\Framework\App\Http\Context $  httpContext,         \Magento\Catalog\Helper\Category $  catalogCategory,         \Magento\Framework\Registry $  registry,         \Magento\Store\Model\StoreManagerInterface $  _storeManager,         \Magento\Catalog\Model\Indexer\Category\Flat\State $  flatState,         \Magento\Framework\ObjectManagerInterface $  objectManager,         UrlInterface $  urlBuilder,         \Magento\Cms\Model\Template\FilterProvider $  filterProvider,         array $  data = []     ) {         $  this->_productCollectionFactory = $  productCollectionFactory;         $  this->_catalogLayer = $  layerResolver->get();         $  this->httpContext = $  httpContext;         $  this->_catalogCategory = $  catalogCategory;         $  this->_modelCategory = $  modelCategory;         $  this->_storeManager = $  _storeManager;         $  this->_registry = $  registry;         $  this->flatState = $  flatState;         $  this->_categoryInstance = $  categoryFactory->create();         $  this->_objectManager = $  objectManager;         $  this->_filterProvider = $  filterProvider;         $  this->_urlBuilder = $  urlBuilder;         parent::__construct($  context, $  data);     }     /**      * Save action      *      * @return \Magento\Framework\Controller\ResultInterface      */     public function execute()     {         /** @var \Magento\Backend\Model\View\Result\Redirect $  resultRedirect */         $  resultRedirect = $  this->resultRedirectFactory->create();         // check if data sent         $  data = $  this->getRequest()->getPostValue();          if ($  data) {             $  id = $  this->getRequest()->getParam('id');             $  model = $  this->_objectManager->create('MGS\Mmegamenu\Model\Mmegamenu')->load($  id);             if (!$  model->getId() && $  id) {                 $  this->messageManager->addError(__('This item no longer exists.'));                 return $  resultRedirect->setPath('*/*/');             }              if(isset($  data['sub_category'])){                 $  data['sub_category_ids'] = implode(',', $  data['sub_category']);             }              if($  data['menu_type'] == 2){                  $  data['category_id'] = 0;                  $  data['sub_category'] = $  data['top_content'] = $  data['bottom_content'] = $  data['sub_category_ids'] = '';             }             else{                 $  data['static_content'] = '';             }              if(!isset($  data['stores'])){                 $  data['stores'] = NULL;             }             $  item = array(                 'id' => rand() . time(),                 'parent_id' => $  data['parent_id'],                 'menu_type' => $  data['menu_type'],                 'url' => $  data['url'],                 'title' => $  data['title'],                 'category_id' => $  data['category_id'],                 'sub_category_ids' => $  data['sub_category_ids'],                 'use_thumbnail' => $  data['use_thumbnail'],                 'position' => $  data['position'],                 'columns' => $  data['columns'],                 'special_class' => $  data['special_class'],                 'static_content' => $  data['static_content'],                 'top_content' => $  data['top_content'],                 'bottom_content' => $  data['bottom_content'],                 'left_content' => $  data['left_content'],                 'left_col' => $  data['left_col'],                 'right_col' => $  data['right_col'],                 'right_content' => $  data['right_content'],                 'status' => $  data['status'],                 'html_label' => $  data['html_label'],             );              $  data['sub_content'] = $  this->getMenuHtml($  item);              // init model and set data              $  model->setData($  data);              // try to save it             try {                 // save the data                 $  model->save();                 // display success message                 $  this->messageManager->addSuccess(__('You saved the item.'));                 // clear previously saved data from session                 $  this->_objectManager->get('Magento\Backend\Model\Session')->setFormData(false);                  // check if 'Save and Continue'                 if ($  this->getRequest()->getParam('back')) {                     return $  resultRedirect->setPath('*/*/edit', ['id' => $  model->getId()]);                 }                 // go to grid                 return $  resultRedirect->setPath('*/*/');             } catch (\Exception $  e) {                 // display error message                 $  this->messageManager->addError($  e->getMessage());                 // save data in session                 $  this->_objectManager->get('Magento\Backend\Model\Session')->setFormData($  data);                 // redirect to edit form                 return $  resultRedirect->setPath('*/*/edit', ['id' => $  this->getRequest()->getParam('id')]);             }         }         return $  resultRedirect->setPath('*/*/');     }      /**      * Get url for category data      *      * @param Category $  category      * @return string      */     public function getCategoryUrl($  category)     {         if ($  category instanceof Category) {             $  url = $  category->getUrl();         } else {             $  url = $  this->_categoryInstance->setData($  category->getData())->getUrl();         }          return $  url;     }      public function getMenuHtml($  item) {         if ($  item['menu_type'] == 2) {             return $  this->getStaticMenu($  item);         } else {             return $  this->getCategoryMenu($  item);         }     }      public function getStaticMenu($  item) {          if (filter_var($  item['url'], FILTER_VALIDATE_URL)) {              $  itemUrl = $  item['url'];         }else{             $  itemUrl = $  itemUrl = $  this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB) .$  item['url'];         }          $  html = '';          if ($  item['html_label'] != '') {             $  html.=$  item['html_label'];         }          $  html.=''.$  item['title'].'';          if ($  item['static_content'] != '') {             $  html.='';              $  html.='
  • ' . $ item['static_content'] . '
  • '; } return $ html; } public function getCategoryMenu($ item) { $ html = '_modelCategory->load($ categoryId); $ html.=' href="'; if ($ item['url'] != '') { if (filter_var($ item['url'], FILTER_VALIDATE_URL)) { $ itemUrl = $ item['url']; }else{ $ itemUrl = $ this->_storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_WEB) .$ item['url']; } } else { if ($ this->_storeManager->getStore()->getRootCategoryId() == $ category->getId()) { $ itemUrl = '#'; } else { $ itemUrl = $ this->getCategoryUrl($ category); } } } $ html .= $ itemUrl . '" class="level0">'; if ($ item['html_label'] != '') { $ html.=$ item['html_label']; } $ html.=''.$ item['title'].''; $ subCatAccepp = $ this->getSubCategoryAccepp($ categoryId, $ item); if (count($ subCatAccepp) > 0 || $ item['top_content'] != '' || $ item['bottom_content'] != '') { $ html.=''; $ html.='
  • '; $ columnAccepp = count($ subCatAccepp); $ arrColumn = []; if ($ columnAccepp > 0) { $ columns = $ item['columns']; if($ columns > 1 && $ item['left_content']!='' && $ item['left_col']!=0){ $ columns = $ columns - $ item['left_col']; } if($ columns > 1 && $ item['right_content']!='' && $ item['right_col']!=0){ $ columns = $ columns - $ item['right_col']; } $ arrOneElement = array_chunk($ subCatAccepp, 1); $ countCat = count($ subCatAccepp); $ count = 0; while ($ countCat > 0) { for ($ i = 0; $ i 1) { $ html.= ''; if ($ item['top_content'] != '') { $ html.='' . $ item['top_content'] . ''; } if($ item['left_content']!='' && $ item['left_col']!=0){ $ html.='getColumnByCol($ item['columns']) * $ item['left_col'].'">' . $ item['left_content'] . ''; } } else { $ html.= ''; } foreach ($ arrColumn as $ _arrColumn) { $ html.= $ this->drawListSub($ item, $ _arrColumn); } if ($ columns > 1) { if($ item['right_content']!='' && $ item['right_col']!=0){ $ html.='getColumnByCol($ item['columns']) * $ item['right_col'].'">' . $ item['right_content'] . ''; } if ($ item['bottom_content'] != '') { $ html.='' . $ item['bottom_content'] . ''; } $ html.= ''; } else { $ html.= ''; } } $ html.='
  • '; } return $ html; } public function getColumnByCol($ col) { return 12/$ col; } public function getSubCategoryAccepp($ categoryId, $ item) { $ subCatExist = explode(',', $ item['sub_category_ids']); $ category = $ this->_modelCategory->load($ categoryId); $ children = $ category->getChildrenCategories(); $ childrenCount = count($ children); $ subCatId = array(); if ($ childrenCount > 0) { foreach ($ children as $ child) { if (in_array($ child->getId(), $ subCatExist)) { $ subCatId[] = $ child->getId(); } } } return $ subCatId; } public function drawListSub($ item, $ catIds) { $ html = ''; if ($ item['columns'] > 1) { $ html.='getColumnByCol($ item['columns']) . '">'; } if (count($ catIds) > 0) { foreach ($ catIds as $ categoryId) { $ category = $ this->_modelCategory->load($ categoryId); $ html.= $ this->drawList($ category, $ item); } } if ($ item['columns'] > 1) { $ html.=''; } return $ html; } public function drawList($ category, $ item, $ level = 1) { $ maxLevel = 10; $ mediaUrl = $ this->_urlBuilder->getBaseUrl(['_type' => \Magento\Framework\UrlInterface::URL_TYPE_MEDIA]); $ children = $ this->getSubCategoryAccepp($ category->getId(), $ item); $ childrenCount = count($ children); $ htmlLi = ' 0 && $ item['columns'] == 1) { $ htmlLi .= ' dropdown-submenu'; } $ htmlLi .= '">'; $ html[] = $ htmlLi; if ($ category->getMgsCateThumb() !="" && $ item['columns'] > 1 && $ level == 1 && $ item['use_thumbnail'] == 1) { $ imageCate = $ category->getMgsCateThumb(); $ imageCateUrl = $ mediaUrl . 'catalog/category/' . $ imageCate; $ html[] = 'getCategoryUrl($ category) . '">getName().'" class="img-fluid img-full" src="'.$ imageCateUrl.'" />'; } $ html[] = 'getCategoryUrl($ category) . '">'; if ($ item['columns'] > 1 && $ level == 1) { $ html[] = ''; } $ html[] = $ category->getName(); if($ category->getMgsMegamenuItemLabel()){ $ backgroundLabel = ""; if($ category->getMgsMegamenuItemBackground()){ $ backgroundLabel = $ category->getMgsMegamenuItemBackground(); } if($ backgroundLabel != ""){ $ html[] = ''; }else { $ html[] = ''; } $ html[] = $ category->getMgsMegamenuItemLabel(); $ html[] = ''; } if ($ item['columns'] > 1 && $ level == 1) { $ html[] = ''; } if ($ childrenCount > 0 && $ item['columns'] == 1) { $ html[] = ''; } $ html[] = ''; if ($ level 0) { $ i = 0; foreach ($ children as $ child) { $ i++; if ($ i _modelCategory->load($ child); $ htmlChildren .= $ this->drawList($ _child, $ item, ($ level + 1)); } } } if (!empty($ htmlChildren)) { $ html[] = ''; $ html[] = ' 1) { $ html[] = ' class="sub-menu"'; } else { $ html[] = ' class="dropdown-menu-ct"'; } $ html[] = '>'; $ html[] = $ htmlChildren; $ html[] = ''; } } $ html[] = ''; $ html = implode("\n", $ html); return $ html; } }

    any clue?