php - Laravel: method doesn't work without a unused parameter -


i have method remove() has parameter $item, not being used inside of it. phpstorm has grayed out , says parameter $item not being used anywhere. if remove error:

errorexception in cart.php line 51: illegal offset type in cart.php line 51 @ handleexceptions->handleerror('2', 'illegal offset type', 'c:\wamp64\www\laravel\app\cart.php', '51', array('id' => object(product))) in cart.php line 51 @ cart->remove(object(product), '1') in productcontroller.php line 65 @ productcontroller->removefromcart('1') @ call_user_func_array(array(object(productcontroller), 'removefromcart'), array('id' => '1')) in compiled.php line 9399 @ controller->callaction('removefromcart', array('id' => '1')) in compiled.php line 9426 @ controllerdispatcher->dispatch(object(route), object(productcontroller), 'removefromcart') in compiled.php line 8484 @ route->runcontroller() in compiled.php line 8465 @ route->run(object(request)) in compiled.php line 8174 

cart.php:

/**  * remove item cart  *  * @param $item  * @param $id  */ public function remove($item, $id) {     $this->totalqty -= $this->items[$id]['qty']; // line 51     $this->totalprice -= $this->items[$id]['price'] * $this->items[$id]['qty'];     unset($this->items[$id]); } 

works fine if leave there, why doesn't when remove it?

when update method signature have update every instance of method being called reflect new parameters. in productcontroller on line 65 it's still using old method signature (with both item , id). fix update method call in controller use $id.


Comments