for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace LoginCidadao\BadgesControlBundle\Event;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use LoginCidadao\BadgesControlBundle\BadgesEvents;
use LoginCidadao\BadgesControlBundle\Handler\BadgesHandler;
class BadgesSubscriber implements EventSubscriberInterface
{
/** @var BadgesHandler */
protected $handler;
public function __construct(BadgesHandler $handler)
$this->handler = $handler;
}
public static function getSubscribedEvents()
return array(
BadgesEvents::BADGES_REGISTER_EVALUATOR => array('onRegisterEvaluator',
0),
BadgesEvents::BADGES_EVALUATE => array('onBadgeEvaluate', 0)
);
public function onBadgeEvaluate(EvaluateBadgesEvent $event)
$event
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function onBadgeEvaluate(/** @scrutinizer ignore-unused */ EvaluateBadgesEvent $event)
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
//
public function onRegisterEvaluator(RegisterEvaluatorEvent $event)
$evaluator = $event->getEvaluator();
$id = $evaluator->getName();
$this->handler->register($evaluator);
error_log("Evaluator $id registered");
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.