mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
N°5302 - Replace deprecated php strlen usages (#308)
This commit is contained in:
@@ -2855,6 +2855,36 @@ HTML;
|
||||
return strlen($sString ?? '');
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper around the native strlen() PHP method to test a string for null or empty value
|
||||
*
|
||||
* @link https://www.php.net/releases/8.1/en.php#deprecations_and_bc_breaks "Passing null to non-nullable internal function parameters is deprecated"
|
||||
*
|
||||
* @param string|null $sString
|
||||
*
|
||||
* @return boolean if string null or empty
|
||||
* @since 3.0.2 N°5302
|
||||
*/
|
||||
public static function IsNullOrEmptyString(?string $sString): boolean
|
||||
{
|
||||
return $sString == null || strlen($sString) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper around the native strlen() PHP method to test a string not null or empty value
|
||||
*
|
||||
* @link https://www.php.net/releases/8.1/en.php#deprecations_and_bc_breaks "Passing null to non-nullable internal function parameters is deprecated"
|
||||
*
|
||||
* @param string|null $sString
|
||||
*
|
||||
* @return boolean if string is not null and not empty
|
||||
* @since 3.0.2 N°5302
|
||||
*/
|
||||
public static function IsNotNullOrEmptyString(?string $sString): boolean
|
||||
{
|
||||
return !static::IsNullOrEmptyString($sString);
|
||||
}
|
||||
|
||||
//----------------------------------------------
|
||||
// Environment helpers
|
||||
//----------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user