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.
This commit is contained in:
Eric Lippmann 2017-11-08 10:07:49 +01:00
parent 9921ebc2f8
commit 73a6750489
2 changed files with 6 additions and 0 deletions

View File

@ -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) {

View File

@ -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;
}