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:
parent
9921ebc2f8
commit
73a6750489
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue