Skip to content

Commit f96072f

Browse files
KreinerKreiner
authored andcommitted
Clean up phpstan output
Signed-off-by: Kreiner <[email protected]>
1 parent 963afe3 commit f96072f

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/Prometheus/Storage/APC.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function updateCounter(array $data): void
141141
}
142142

143143
/**
144-
* @param array $metaData
144+
* @param array<string> $metaData
145145
* @param string $labels
146146
* @return string
147147
*/
@@ -153,7 +153,7 @@ private function assembleLabelKey(array $metaData, string $labels): string
153153
/**
154154
* Store ':label' keys for each metric's labelName in APC.
155155
*
156-
* @param array $data
156+
* @param array<mixed> $data
157157
* @return void
158158
*/
159159
private function storeLabelKeys(array $data): void
@@ -184,7 +184,7 @@ private function addItemToKey(string $key, string $item): void
184184
if (false === $arr) {
185185
$arr = [];
186186
}
187-
if (in_array($item, $arr)) {
187+
if (in_array($item, $arr, true)) {
188188
return;
189189
}
190190
$arr[] = $item;
@@ -300,12 +300,15 @@ private function metaData(array $data): array
300300
* [9] => ['/private', 'get', 'fail'], [10] => ['/private', 'post', 'success'], [11] => ['/private', 'post', 'fail'],
301301
* [12] => ['/metrics', 'put', 'success'], [13] => ['/metrics', 'put', 'fail'], [14] => ['/metrics', 'get', 'success'],
302302
* [15] => ['/metrics', 'get', 'fail'], [16] => ['/metrics', 'post', 'success'], [17] => ['/metrics', 'post', 'fail']
303-
* @return array
303+
* @param array<string> $labelNames
304+
* @param array<array> $labelValues
305+
* @return array<array>
304306
*/
305307
private function buildPermutationTree(array $labelNames, array $labelValues): array
306308
{
307309
$treeRowCount = count(array_keys($labelNames));
308310
$numElements = 1;
311+
$treeInfo = [];
309312
for ($i = $treeRowCount - 1; $i >= 0; $i--) {
310313
$treeInfo[$i]['numInRow'] = count($labelValues[$i]);
311314
$numElements *= $treeInfo[$i]['numInRow'];
@@ -361,15 +364,15 @@ private function collectCounters(): array
361364
* When given a type ('histogram', 'gauge', or 'counter'), return an iterable array of matching records retrieved from APCu
362365
*
363366
* @param string $type
364-
* @return array
367+
* @return array<array>
365368
*/
366369
private function getMetas(string $type) : array
367370
{
368371
$arr = [];
369372
$root = apcu_fetch($this->rootNode());
370373
if (is_array($root)) {
371374
foreach ($root as $metaKey) {
372-
if (preg_match('/' . self::PROMETHEUS_PREFIX . ':' . $type . ':.*:meta/', $metaKey) && false !== ($gauge = apcu_fetch($metaKey))) {
375+
if ((1 === preg_match('/' . self::PROMETHEUS_PREFIX . ':' . $type . ':.*:meta/', $metaKey)) && false !== ($gauge = apcu_fetch($metaKey))) {
373376
$arr[] = [ 'key' => $metaKey, 'value' => $gauge ];
374377
}
375378
}
@@ -381,8 +384,8 @@ private function getMetas(string $type) : array
381384
* When given a type ('histogram', 'gauge', or 'counter') and metaData array, return an iterable array of matching records retrieved from APCu
382385
*
383386
* @param string $type
384-
* @param array $metaData
385-
* @return array
387+
* @param array<mixed> $metaData
388+
* @return array<array>
386389
*/
387390
private function getValues(string $type, array $metaData) : array
388391
{

0 commit comments

Comments
 (0)