11<?php
22
3+ declare (strict_types=1 );
4+
35namespace M6Web \Bundle \StatsdBundle \Client ;
46
57use M6Web \Bundle \StatsdBundle \Statsd \MonitorableEventInterface ;
68use M6Web \Component \Statsd \Client as BaseClient ;
7- use Symfony \Component \PropertyAccess ;
9+ use Symfony \Component \PropertyAccess \PropertyAccessorInterface ;
10+ use Symfony \Contracts \EventDispatcher \Event ;
811
912/**
1013 * Class that extends base statsd client, to handle auto-increment from event dispatcher notifications
@@ -14,7 +17,7 @@ class Client extends BaseClient
1417 /** @var array */
1518 protected $ listenedEvents = [];
1619
17- /** @var PropertyAccess\ PropertyAccessorInterface */
20+ /** @var PropertyAccessorInterface */
1821 protected $ propertyAccessor ;
1922
2023 /** @var int|null */
@@ -60,7 +63,7 @@ public function setToSendLimit($toSendLimit)
6063 *
6164 * @return $this
6265 */
63- public function setPropertyAccessor (PropertyAccess \ PropertyAccessorInterface $ propertyAccessor )
66+ public function setPropertyAccessor (PropertyAccessorInterface $ propertyAccessor )
6467 {
6568 $ this ->propertyAccessor = $ propertyAccessor ;
6669
@@ -70,20 +73,15 @@ public function setPropertyAccessor(PropertyAccess\PropertyAccessorInterface $pr
7073 /**
7174 * Handle an event
7275 *
73- * @param EventInterface $event an event
74- * @param string $name the event name
76+ * @param Event $event an event
77+ * @param string $name the event name
7578 *
7679 * @throws Exception
7780 *
7881 * @return void
7982 */
8083 public function handleEvent ($ event , $ name = null )
8184 {
82- // this is used to stay compatible with Symfony 2.3
83- if (is_null ($ name )) {
84- $ name = $ event ->getName ();
85- }
86-
8785 if (!isset ($ this ->listenedEvents [$ name ])) {
8886 return ;
8987 }
@@ -125,7 +123,7 @@ public function handleEvent($event, $name = null)
125123 }
126124 }
127125
128- if (null !== $ this ->toSendLimit && $ this ->getToSend ()-> count ( ) >= $ this ->toSendLimit ) {
126+ if (null !== $ this ->toSendLimit && count ( $ this ->getToSend ()) >= $ this ->toSendLimit ) {
129127 $ immediateSend = true ;
130128 }
131129
@@ -175,9 +173,9 @@ private function addTiming($event, $timingMethod, $node, $tags = [])
175173 /**
176174 * Replaces a string with a method name
177175 *
178- * @param EventInterface $event An event
179- * @param string $eventName The name of the event
180- * @param string $string The node in which the replacing will happen
176+ * @param Event $event An event
177+ * @param string $eventName The name of the event
178+ * @param string $string The node in which the replacing will happen
181179 *
182180 * @return string
183181 */
0 commit comments