for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace SilverShop\Tests\Cart;
use SilverStripe\Core\Extension;
use SilverStripe\Dev\TestOnly;
class ShoppingCartTest_TestShoppingCartErroringHooksExtension extends Extension implements TestOnly
{
public function beforeSetQuantity($buyable, $quantity, $filter)
$buyable
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function beforeSetQuantity(/** @scrutinizer ignore-unused */ $buyable, $quantity, $filter)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
$filter
public function beforeSetQuantity($buyable, $quantity, /** @scrutinizer ignore-unused */ $filter)
if ($quantity > 10) {
throw new \Exception('Invalid quantity');
}
public function afterAdd($item, $buyable, $quantity, $filter)
$quantity
public function afterAdd($item, $buyable, /** @scrutinizer ignore-unused */ $quantity, $filter)
public function afterAdd($item, $buyable, $quantity, /** @scrutinizer ignore-unused */ $filter)
public function afterAdd($item, /** @scrutinizer ignore-unused */ $buyable, $quantity, $filter)
if ($item->Quantity > 1) {
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.