1 | <?php |
||
25 | class TimeProfilerSubscriber implements EventSubscriberInterface |
||
26 | { |
||
27 | /** @var float */ |
||
28 | private $startTime = -1; |
||
29 | /** @var float */ |
||
30 | private $profiledTime = -1; |
||
31 | |||
32 | /** |
||
33 | * Returns an array of event names this subscriber wants to listen to. |
||
34 | * |
||
35 | * The array keys are event names and the value can be: |
||
36 | * |
||
37 | * * The method name to call (priority defaults to 0) |
||
38 | * * An array composed of the method name to call and the priority |
||
39 | * * An array of arrays composed of the method names to call and respective |
||
40 | * priorities, or 0 if unset |
||
41 | * |
||
42 | * For instance: |
||
43 | * |
||
44 | * * array('eventName' => 'methodName') |
||
45 | * * array('eventName' => array('methodName', $priority)) |
||
46 | * * array('eventName' => array(array('methodName1', $priority), array('methodName2'))) |
||
47 | * |
||
48 | * @return array The event names to listen to |
||
49 | */ |
||
50 | public static function getSubscribedEvents() |
||
57 | |||
58 | public function start(BeforeExecuteEvent $event) |
||
62 | |||
63 | public function stop(AfterExecuteEvent $event) |
||
67 | |||
68 | public function getProfiledTimestamp() |
||
75 | } |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.