Skip to content

Commit 4039af2

Browse files
committed
Update Codestyle Tools and fix findings
Signed-off-by: Lukas Kämmerling <lukas.kaemmerling@hetzner-cloud.de>
1 parent b581ffb commit 4039af2

File tree

8 files changed

+16
-16
lines changed

8 files changed

+16
-16
lines changed

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
"require-dev": {
2222
"guzzlehttp/guzzle": "^6.3|^7.0",
2323
"phpstan/extension-installer": "^1.0",
24-
"phpstan/phpstan": "^0.12.50",
25-
"phpstan/phpstan-phpunit": "^0.12.16",
26-
"phpstan/phpstan-strict-rules": "^0.12.5",
24+
"phpstan/phpstan": "^1.5.4",
25+
"phpstan/phpstan-phpunit": "^1.1.0",
26+
"phpstan/phpstan-strict-rules": "^1.1.0",
2727
"phpunit/phpunit": "^8.4|^9.4",
28-
"squizlabs/php_codesniffer": "^3.5",
28+
"squizlabs/php_codesniffer": "^3.6",
2929
"symfony/polyfill-apcu": "^1.6"
3030
},
3131
"suggest": {

src/Prometheus/CollectorRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct(Adapter $storageAdapter, bool $registerDefaultMetric
6565
*/
6666
public static function getDefault(): CollectorRegistry
6767
{
68-
return self::$defaultRegistry ?? (self::$defaultRegistry = new self(new Redis()));
68+
return self::$defaultRegistry ?? (self::$defaultRegistry = new self(new Redis())); /** @phpstan-ignore-line */
6969
}
7070

7171
/**

src/Prometheus/Storage/APCng.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ private function metaData(array $data): array
388388
* @param array<array> $labelValues
389389
* @return array<array>
390390
*/
391-
private function buildPermutationTree(array $labelNames, array $labelValues): array
391+
private function buildPermutationTree(array $labelNames, array $labelValues): array /** @phpstan-ignore-line */
392392
{
393393
$treeRowCount = count(array_keys($labelNames));
394394
$numElements = 1;
@@ -450,7 +450,7 @@ private function collectCounters(): array
450450
* @param string $type
451451
* @return array<array>
452452
*/
453-
private function getMetas(string $type): array
453+
private function getMetas(string $type): array /** @phpstan-ignore-line */
454454
{
455455
$arr = [];
456456
$metaCache = apcu_fetch($this->metainfoCacheKey);
@@ -472,7 +472,7 @@ private function getMetas(string $type): array
472472
* @param array<mixed> $metaData
473473
* @return array<array>
474474
*/
475-
private function getValues(string $type, array $metaData): array
475+
private function getValues(string $type, array $metaData): array /** @phpstan-ignore-line */
476476
{
477477
$labels = $arr = [];
478478
foreach (array_values($metaData['labelNames']) as $label) {

src/Prometheus/Storage/Redis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,15 +287,15 @@ public function updateSummary(array $data): void
287287
if (false === $json) {
288288
throw new RuntimeException(json_last_error_msg());
289289
}
290-
$this->redis->setNx($metaKey, $json);
290+
$this->redis->setNx($metaKey, $json); /** @phpstan-ignore-line */
291291

292292
// store value key
293293
$valueKey = $summaryKey . ':' . $this->valueKey($data);
294294
$json = json_encode($this->encodeLabelValues($data['labelValues']));
295295
if (false === $json) {
296296
throw new RuntimeException(json_last_error_msg());
297297
}
298-
$this->redis->setNx($valueKey, $json);
298+
$this->redis->setNx($valueKey, $json); /** @phpstan-ignore-line */
299299

300300
// trick to handle uniqid collision
301301
$done = false;

tests/Test/Performance/TestEngineSpeed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestEngineSpeed
2323
public function __construct(string $driver, int $num_metrics)
2424
{
2525
$this->num_metrics = $num_metrics;
26-
$this->driver = new $driver();
26+
$this->driver = new $driver(); /** @phpstan-ignore-line */
2727
}
2828

2929
/**

tests/Test/Prometheus/MathTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function testQuantileSuccess(array $samples, float $q, float $expected):
2525
/**
2626
* @return array[]
2727
*/
28-
public function providerQuantileSuccess(): array
28+
public function providerQuantileSuccess(): array /** @phpstan-ignore-line */
2929
{
3030
return [
3131
'Even serie' => [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 0.5, 5],

tests/Test/Prometheus/Storage/APCTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Prometheus\Storage;
66

7-
use APCuIterator;
7+
use APCUIterator;
88
use PHPUnit\Framework\TestCase;
99
use Prometheus\CollectorRegistry;
1010

@@ -28,7 +28,7 @@ public function itShouldNotClearWholeAPCacheOnFlush(): void
2828
$registry->getOrRegisterHistogram("namespace", "histogram", "histogram help")->observe(1);
2929
$apc->wipeStorage();
3030

31-
$cacheEntries = iterator_to_array(new APCuIterator(null), true);
31+
$cacheEntries = iterator_to_array(new APCUIterator(null), true);
3232
$cacheMap = array_map(function ($item) {
3333
return $item['value'];
3434
}, $cacheEntries);

tests/Test/Prometheus/Storage/APCngTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace Prometheus\Storage;
66

7-
use APCuIterator;
7+
use APCUIterator;
88
use PHPUnit\Framework\TestCase;
99
use Prometheus\CollectorRegistry;
1010

@@ -29,7 +29,7 @@ public function itShouldNotClearWholeAPCacheOnFlush(): void
2929
$registry->getOrRegisterSummary("namespace", "summary", "summary help")->observe(1);
3030
$apc->wipeStorage();
3131

32-
$cacheEntries = iterator_to_array(new APCuIterator(null), true);
32+
$cacheEntries = iterator_to_array(new APCUIterator(null), true);
3333
$cacheMap = array_map(function ($item) {
3434
return $item['value'];
3535
}, $cacheEntries);

0 commit comments

Comments
 (0)