I have compilation issue on my custom module. Code works properly in magento 2.1 but in magento 2.2 it's shows error at compilation like this
Incompatible argument type: Required type: \Magento\Framework\DB\Adapter\AdapterInterface. Actual type: \Vendor\Module\Model\ResourceModel\Products\type; File: /var/www/html/magento2.2/app/code/Vendor/Module/Model/ResourceModel/Products/Collection.php
<?php
namespace Vendor\Module\Model\ResourceModel\Products;
use Magento\Framework\Data\Collection\Db\FetchStrategyInterface;
use Magento\Framework\Data\Collection\EntityFactoryInterface;
use Magento\Framework\Event\ManagerInterface;
use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
public function __construct(
EntityFactoryInterface $entityFactory,
LoggerInterface $logger,
FetchStrategyInterface $fetchStrategy,
ManagerInterface $eventManager,
$connection = null,
AbstractDb $resource = null
) {
parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
}
...
...
}