Phan/phpstan fixes
This commit is contained in:
@@ -21,8 +21,6 @@ require 'config.php';
|
||||
$LOG_FILE_ID = 'classTest-string';
|
||||
ob_end_flush();
|
||||
|
||||
use CoreLibs\Convert\Byte;
|
||||
|
||||
$log = new CoreLibs\Debug\Logging([
|
||||
'log_folder' => BASE . LOG,
|
||||
'file_id' => $LOG_FILE_ID,
|
||||
|
||||
@@ -209,7 +209,7 @@ class DateTime
|
||||
if ($isodow < 1 || $isodow > 7) {
|
||||
return $long ? 'Invalid' : 'Inv';
|
||||
}
|
||||
return date($long ? 'l' : 'D', strtotime("Sunday +{$isodow} days"));
|
||||
return date($long ? 'l' : 'D', strtotime("Sunday +{$isodow} days") ?: null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,7 +224,7 @@ class DateTime
|
||||
if (!self::checkDate($date)) {
|
||||
return $long ? 'Invalid' : 'Inv';
|
||||
}
|
||||
return date($long ? 'l' : 'D', strtotime($date));
|
||||
return date($long ? 'l' : 'D', strtotime($date) ?: null);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,7 +238,7 @@ class DateTime
|
||||
if (!self::checkDate($date)) {
|
||||
return -1;
|
||||
}
|
||||
return (int)date('N', strtotime($date));
|
||||
return (int)date('N', strtotime($date) ?: null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ class Strings
|
||||
public static function splitFormatString(
|
||||
string $value,
|
||||
string $split_format,
|
||||
string $split_charcters = '-'
|
||||
string $split_characters = '-'
|
||||
): string {
|
||||
// abort if split format is empty
|
||||
if (empty($split_format)) {
|
||||
@@ -45,7 +45,7 @@ class Strings
|
||||
// }
|
||||
$split_list = preg_split(
|
||||
// allowed split characters
|
||||
"/([" . $split_charcters . "]{1})/",
|
||||
"/([" . $split_characters . "]{1})/",
|
||||
$split_format,
|
||||
-1,
|
||||
PREG_SPLIT_DELIM_CAPTURE
|
||||
@@ -74,7 +74,7 @@ class Strings
|
||||
$out .= $last_split . substr($value, $pos);
|
||||
}
|
||||
// if last is not alphanumeric remove, remove
|
||||
if (!strcspn(substr($out, -1, 1), $split_charcters)) {
|
||||
if (!strcspn(substr($out, -1, 1), $split_characters)) {
|
||||
$out = substr($out, 0, -1);
|
||||
}
|
||||
// overwrite only if out is set
|
||||
|
||||
Reference in New Issue
Block a user