2424/**
2525 * @author Tobias Nyholm <[email protected] > 2626 */
27- class ProfilingPlugin implements Plugin
27+ final class ProfilingPlugin implements Plugin
2828{
2929 /**
3030 * @var list<array{query: Query, queryString: string, duration: float, providerName: string, result: mixed, resultCount: int}>
3131 */
32- private $ queries = [];
32+ private array $ queries = [];
3333
3434 /**
35- * @var string service id of the provider
35+ * @param non-empty- string $name service id of the provider
3636 */
37- private $ name ;
38-
39- public function __construct (string $ name )
40- {
41- $ this ->name = $ name ;
37+ public function __construct (
38+ private readonly string $ name ,
39+ ) {
4240 }
4341
44- /**
45- * @return Promise
46- */
47- public function handleQuery (Query $ query , callable $ next , callable $ first )
42+ public function handleQuery (Query $ query , callable $ next , callable $ first ): Promise
4843 {
4944 $ startTime = microtime (true );
5045
@@ -61,12 +56,7 @@ public function handleQuery(Query $query, callable $next, callable $first)
6156 });
6257 }
6358
64- /**
65- * @param mixed $result
66- *
67- * @return void
68- */
69- private function logQuery (Query $ query , float $ duration , $ result = null )
59+ private function logQuery (Query $ query , float $ duration , mixed $ result = null ): void
7060 {
7161 if ($ query instanceof GeocodeQuery) {
7262 $ queryString = $ query ->getText ();
@@ -94,6 +84,9 @@ public function getQueries(): array
9484 return $ this ->queries ;
9585 }
9686
87+ /**
88+ * @return non-empty-string
89+ */
9790 public function getName (): string
9891 {
9992 return $ this ->name ;
0 commit comments