Closed : Constructor must implement interface

Hi,

Getting this error.
Argument 1 passed to Basket::__construct() must implement BucketInterface, string given in Basket.php:14

class Basket

    protected $session;
    protected $product;

    public function __construct(BucketInterface $session, Product $product) {
        $this->session = $session;
        $this->product = $product;
    }

interface BucketInterface

interface BucketInterface {

    public function get($key);

    public function set($key, $value);

    public function all();

    public function exists($key);

    public function delete($key);

    public function clear();
}

class BucketStorage implements BucketInterface, Countable {

    protected $bucket;

    public function __construct($bucket = 'default') {
          if (!isset($_SESSION[$bucket])) {
               $_SESSION[$bucket] = [$this->bucket][$key];
           }
           $this->bucket = $bucket;
    }

    public function get($key) {
        if (!$this->exists($key)) {
            return null;
        }
        return $_SESSION[$this->bucket][$key];
    }

    public function set($key, $value) {
        $_SESSION[$this->bucket][$key] = $value;
    }

    public function all() {
        return $_SESSION[$this->bucket];
    }

    public function exists($key) {
        return isset($_SESSION[$this->bucket][$key]);
    }

    public function delete($key) {
        if ($this->exists($key)) {
            unset($_SESSION[$this->bucket][$key]);
        }
    }

    public function clear() {
        unset($_SESSION[$this->bucket]);
    }

    public function count() {
        return count($this->all());
    }

}

league provider BasketServiceProvider

class BasketServiceProvider extends AbstractServiceProvider {

protected $provides = [
    Basket::class
  ];

public function register() {

    $container = $this->getContainer();
    $container->share(Basket::class, function () use ($container) {

        return new Basket(
                $container->get(BucketInterface::class),
                $container->get(Product::class)
        );
    });
}

}

Hi @supervan1

must implement X, string given

This error message indicates that there is a undefined container entry / definition.

In this specific case there is no definition for BucketInterface::class.

Thank you @Odan, Will try,