mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
Fix PhpStan complaining about arithmetic operations between string and int
This commit is contained in:
parent
853b6ceb84
commit
28261d8a7f
@ -35,19 +35,20 @@ class MemoryLimit
|
|||||||
$val = trim($string);
|
$val = trim($string);
|
||||||
|
|
||||||
if (preg_match('/^(\d+)([KMG])$/', $val, $m)) {
|
if (preg_match('/^(\d+)([KMG])$/', $val, $m)) {
|
||||||
$val = $m[1];
|
$val = (int) $m[1];
|
||||||
|
|
||||||
switch ($m[2]) {
|
switch ($m[2]) {
|
||||||
case 'G':
|
case 'G':
|
||||||
$val *= 1024;
|
$val *= 1024;
|
||||||
// Intentional fall-through
|
// no break
|
||||||
case 'M':
|
case 'M':
|
||||||
$val *= 1024;
|
$val *= 1024;
|
||||||
// Intentional fall-through
|
// no break
|
||||||
case 'K':
|
case 'K':
|
||||||
$val *= 1024;
|
$val *= 1024;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return intval($val);
|
return (int) $val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,18 +298,20 @@ class IcingaConfigHelper
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$duration = (int) $m[1];
|
||||||
|
|
||||||
switch ($m[2]) {
|
switch ($m[2]) {
|
||||||
case 'd':
|
case 'd':
|
||||||
$value += $m[1] * 86400;
|
$value += $duration * 86400;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
$value += $m[1] * 3600;
|
$value += $duration * 3600;
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
$value += $m[1] * 60;
|
$value += $duration * 60;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$value += (int) $m[1];
|
$value += $duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,11 +240,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: application/views/helpers/FormStoredPassword.php
|
path: application/views/helpers/FormStoredPassword.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\*\\=\" between string and 1024 results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: library/Director/Application/MemoryLimit.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Constructor of class Icinga\\\\Module\\\\Director\\\\Core\\\\RestApiClient has an unused parameter \\$cn\\.$#"
|
message: "#^Constructor of class Icinga\\\\Module\\\\Director\\\\Core\\\\RestApiClient has an unused parameter \\$cn\\.$#"
|
||||||
count: 1
|
count: 1
|
||||||
@ -395,21 +390,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: library/Director/IcingaConfig/AgentWizard.php
|
path: library/Director/IcingaConfig/AgentWizard.php
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\*\" between string and 3600 results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: library/Director/IcingaConfig/IcingaConfigHelper.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\*\" between string and 60 results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: library/Director/IcingaConfig/IcingaConfigHelper.php
|
|
||||||
|
|
||||||
-
|
|
||||||
message: "#^Binary operation \"\\*\" between string and 86400 results in an error\\.$#"
|
|
||||||
count: 1
|
|
||||||
path: library/Director/IcingaConfig/IcingaConfigHelper.php
|
|
||||||
|
|
||||||
-
|
-
|
||||||
message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getSentOrObjectSetting\\(\\)\\.$#"
|
message: "#^Call to an undefined method Icinga\\\\Module\\\\Director\\\\Web\\\\Form\\\\QuickForm\\:\\:getSentOrObjectSetting\\(\\)\\.$#"
|
||||||
count: 3
|
count: 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user