Zend certified PHP/Magento developer

Errors during compilation

Errors during compilation:
CustomGridModelResourceModelGridGridCollection
Incompatible argument type: Required type: MagentoFrameworkDBAdapterAdapterInterface. Actual type: CustomGridModelResourceModelGridGridconnection; File:
C:/xampp/htdocs/magento/app/code/Custom/Grid/Model/ResourceModel/Grid/Grid/Collection.php

Collection.php

<?php

namespace CustomGridModelResourceModelGridGrid;

use MagentoFrameworkApiSearchSearchResultInterface;
use MagentoFrameworkSearchAggregationInterface;
use CustomGridModelResourceModelGridCollection as GridCollection;
use MagentoFrameworkDataCollectionEntityFactoryInterface;
use PsrLogLoggerInterface;
use MagentoFrameworkDataCollectionDbFetchStrategyInterface;
use MagentoFrameworkEventManagerInterface;
use MagentoStoreModelStoreManagerInterface;
use MagentoFrameworkModelResourceModelDbAbstractDb;

/**
 * Class Collection
 * Collection for displaying grid
 */
class Collection extends GridCollection implements SearchResultInterface
{
    /**
     * Resource initialization
     * @param EntityFactoryInterface   $entityFactory,
     * @param LoggerInterface          $logger,
     * @param FetchStrategyInterface   $fetchStrategy,
     * @param ManagerInterface         $eventManager,
     * @param StoreManagerInterface    $storeManager,
     * @param String                   $mainTable,
     * @param String                   $eventPrefix,
     * @param String                   $eventObject,
     * @param String                   $resourceModel,
     * @param $model = 'MagentoFrameworkViewElementUiComponentDataProviderDocument',
     * @param $connection = null,
     * @param AbstractDb              $resource = null
     * @return $this
     */
    public function __construct(
        EntityFactoryInterface $entityFactory,
        LoggerInterface $logger,
        FetchStrategyInterface $fetchStrategy,
        ManagerInterface $eventManager,
        StoreManagerInterface $storeManager,
        $mainTable,
        $eventPrefix,
        $eventObject,
        $resourceModel,
        $model = 'MagentoFrameworkViewElementUiComponentDataProviderDocument',
        $connection = null,
        AbstractDb $resource = null
    ) {
        parent::__construct(
            $entityFactory,
            $logger,
            $fetchStrategy,
            $eventManager,
            $storeManager,
            $connection,
            $resource
        );
        $this->_eventPrefix = $eventPrefix;
        $this->_eventObject = $eventObject;
        $this->_init($model, $resourceModel);
        $this->setMainTable($mainTable);
    }

    /**
     * @return AggregationInterface
     */
    public function getAggregations()
    {
        return $this->aggregations;
    }

    /**
     * @param AggregationInterface $aggregations
     *
     * @return $this
     */
    public function setAggregations($aggregations)
    {
        $this->aggregations = $aggregations;
    }

    /**
     * Get search criteria.
     *
     * @return MagentoFrameworkApiSearchCriteriaInterface|null
     */
    public function getSearchCriteria()
    {
        return null;
    }

    /**
     * Set search criteria.
     *
     * @param MagentoFrameworkApiSearchCriteriaInterface $searchCriteria
     *
     * @return $this
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function setSearchCriteria(
        MagentoFrameworkApiSearchCriteriaInterface $searchCriteria = null
    ) {
        return $this;
    }

    /**
     * Get total count.
     *
     * @return int
     */
    public function getTotalCount()
    {
        return $this->getSize();
    }

    /**
     * Set total count.
     *
     * @param int $totalCount
     *
     * @return $this
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function setTotalCount($totalCount)
    {
        return $this;
    }

    /**
     * Set items list.
     *
     * @param MagentoFrameworkApiExtensibleDataInterface[] $items
     *
     * @return $this
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
     */
    public function setItems(array $items = null)
    {
        return $this;
    }
}