PHP 8.1 base version update

This commit is contained in:
Clemens Schwaighofer
2023-02-28 18:04:42 +09:00
parent 1d220f25eb
commit 0a80abe8a4
30 changed files with 528 additions and 480 deletions

View File

@@ -42,8 +42,11 @@ class Colors
* @param int|false $hsl_flag flag to check for hsl type
* @return bool True if no error, False if error
*/
private static function rgbHslContentCheck(string $color, $rgb_flag, $hsl_flag): bool
{
private static function rgbHslContentCheck(
string $color,
int|false $rgb_flag,
int|false $hsl_flag
): bool {
// extract string between () and split into elements
preg_match("/\((.*)\)/", $color, $matches);
if (

View File

@@ -25,7 +25,7 @@ class Encoding
* if null is set then "none"
* @return void
*/
public static function setErrorChar($string): void
public static function setErrorChar(string|int|null $string): void
{
if (empty($string)) {
$string = 'none';
@@ -52,7 +52,7 @@ class Encoding
* directly
* @return string|int Set error character
*/
public static function getErrorChar(bool $return_substitute_func = false)
public static function getErrorChar(bool $return_substitute_func = false): string|int
{
// return mb_substitute_character();
if ($return_substitute_func === true) {
@@ -78,14 +78,14 @@ class Encoding
* @param string $string string to test
* @param string $from_encoding encoding of string to test
* @param string $to_encoding target encoding
* @return bool|array<string> false if no error or
* @return array<string>|false false if no error or
* array with failed characters
*/
public static function checkConvertEncoding(
string $string,
string $from_encoding,
string $to_encoding
) {
): array|false {
// convert to target encoding and convert back
$temp = mb_convert_encoding($string, $to_encoding, $from_encoding);
$compare = mb_convert_encoding($temp, $from_encoding, $to_encoding);

View File

@@ -32,7 +32,7 @@ class Jason
* or error string ('' for no error)
* @deprecated Use Json::jsonGetLastError()
*/
public static function jsonGetLastError(bool $return_string = false)
public static function jsonGetLastError(bool $return_string = false): int|string
{
return Json::jsonGetLastError($return_string);
}