fix: add null check
This commit is contained in:
parent
844c8183de
commit
b98f327aad
1 changed files with 3 additions and 1 deletions
|
@ -55,7 +55,9 @@ class Convert {
|
||||||
* @since 1.0-beta
|
* @since 1.0-beta
|
||||||
* @todo Replace with built-in type casting.
|
* @todo Replace with built-in type casting.
|
||||||
*/
|
*/
|
||||||
public static function to_bool( string $value ): bool {
|
public static function to_bool( string|null $value ): bool {
|
||||||
|
if (!$value) return false;
|
||||||
|
|
||||||
// Convert string to lower-case to make it easier.
|
// Convert string to lower-case to make it easier.
|
||||||
$value = strtolower( $value );
|
$value = strtolower( $value );
|
||||||
// Check if string seems to contain a "true" value.
|
// Check if string seems to contain a "true" value.
|
||||||
|
|
Reference in a new issue