diff --git a/core/metamodel.class.php b/core/metamodel.class.php index c70ee91d4..59cfe3f2f 100644 --- a/core/metamodel.class.php +++ b/core/metamodel.class.php @@ -7718,15 +7718,15 @@ abstract class MetaModel /** * @param string $sClass * @param string $sAttCode - * @param string $sValue + * @param string|null $sValue Code of the state value, can be null if allowed by the attribute definition * * @return \ormStyle|null * @throws \Exception * @throws \CoreException */ - public static function GetEnumStyle(string $sClass, string $sAttCode, string $sValue = ''): ?ormStyle + public static function GetEnumStyle(string $sClass, string $sAttCode, ?string $sValue = ''): ?ormStyle { - if (empty($sAttCode)) { + if (strlen($sAttCode) === 0) { return null; } diff --git a/sources/application/UI/Base/Layout/Object/ObjectDetails.php b/sources/application/UI/Base/Layout/Object/ObjectDetails.php index 6154ce507..1bf5d336c 100644 --- a/sources/application/UI/Base/Layout/Object/ObjectDetails.php +++ b/sources/application/UI/Base/Layout/Object/ObjectDetails.php @@ -59,7 +59,7 @@ class ObjectDetails extends Panel implements iKeyboardShortcut protected $sObjectMode; /** @var string */ protected $sIconUrl; - /** @var string Code of the current value of the attribute carrying the state for $sClassName */ + /** @var string|null Code of the current value of the attribute carrying the state for $sClassName */ protected $sStatusCode; /** @var string Label of the current value of the attribute carrying the state for $sClassName */ protected $sStatusLabel; diff --git a/sources/application/UI/Helper/UIHelper.php b/sources/application/UI/Helper/UIHelper.php index 83ac99f52..ec72ff852 100644 --- a/sources/application/UI/Helper/UIHelper.php +++ b/sources/application/UI/Helper/UIHelper.php @@ -19,12 +19,12 @@ namespace Combodo\iTop\Application\UI\Helper; class UIHelper { /** - * @param string $sStateCode Code of the state value + * @param string|null $sStateCode Code of the state value, can be null if allowed by the attribute definition * @param bool $bAllowFallbackIfNoMatch If set to true, a fallback semantic color code will be returned in case of no matching mappping. Otherwise it will return null to indicate there was no match. * * @return string|null A semantic status color name (eg. success, pending, failure, neutral, ...) depending on the value's code. Usefull to try to find a semantic match when a class has no style defined on its state attribute. */ - public static function GetColorNameFromStatusCode(string $sStateCode, bool $bAllowFallbackIfNoMatch = true): ?string + public static function GetColorNameFromStatusCode(?string $sStateCode, bool $bAllowFallbackIfNoMatch = true): ?string { $sStatusColor = null;