From 73a67504893239b01691000c6bdd57e6ced7c352 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 8 Nov 2017 10:07:49 +0100 Subject: [PATCH] Make phpcs and PhpStorm happy w/ intentional switch, case fall-throughs Unfortunately, PhpStorm does not regonise PSR2 fall-through comments. On the other hand, phpcs does not support the @noinspection phpdoc comment (/**). The fix is a mix of PSR2 comments and @noinspection tags in code comments. --- library/Icinga/Web/Response/JsonResponse.php | 2 ++ modules/monitoring/library/Monitoring/Plugin/Perfdata.php | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/library/Icinga/Web/Response/JsonResponse.php b/library/Icinga/Web/Response/JsonResponse.php index 744456c82..d0da9a4f3 100644 --- a/library/Icinga/Web/Response/JsonResponse.php +++ b/library/Icinga/Web/Response/JsonResponse.php @@ -176,8 +176,10 @@ class JsonResponse extends Response 'status' => $this->status ); switch ($this->status) { + /** @noinspection PhpMissingBreakStatementInspection */ case static::STATUS_ERROR: $body['message'] = $this->getErrorMessage(); + // Fallthrough case static::STATUS_FAIL: $failData = $this->getFailData(); if ($failData !== null || $this->status === static::STATUS_FAIL) { diff --git a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php index b222bf625..6ffaf181f 100644 --- a/modules/monitoring/library/Monitoring/Plugin/Perfdata.php +++ b/modules/monitoring/library/Monitoring/Plugin/Perfdata.php @@ -290,16 +290,20 @@ class Perfdata } switch (count($parts)) { + /* @noinspection PhpMissingBreakStatementInspection */ case 5: if ($parts[4] !== '') { $this->maxValue = self::convert($parts[4], $this->unit); } + /* @noinspection PhpMissingBreakStatementInspection */ case 4: if ($parts[3] !== '') { $this->minValue = self::convert($parts[3], $this->unit); } + /* @noinspection PhpMissingBreakStatementInspection */ case 3: $this->criticalThreshold = trim($parts[2]) ? trim($parts[2]) : null; + // Fallthrough case 2: $this->warningThreshold = trim($parts[1]) ? trim($parts[1]) : null; }