Ishoppingcart::addToCart()
states that the method does not take any parameter, while the implementation Shoppingcart::addToCart(Product $product)
requires that a parameter of type Product
must be passed into the method. This means that both declarations are incompatible and while the implemented interface must be satisfied PHP throws the shown error.
Solution would be to either change Ishoppingcart::addToCart()
to Ishoppingcart::addToCart(Product $product)
so that it requires a parameter of type Product
or to change Shoppingcart::addToCart(Product $product)
to allow no parameter to passed into the method: Shoppingcart::addToCart(Product $product = null)
;
The correct way depends on your application requirements.