diff --git a/.phpstan.neon b/.phpstan.neon index fca7f6d59d..2a89c7ae1a 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -6,13 +6,14 @@ parameters: level: 2 paths: - # - addon/ + - addon/ - src/ excludePaths: analyse: - addon/*/lang/* - addon/*/vendor/* + - addon/convert/UnitConvertor.php - addon/pumpio/oauth/* scanDirectories: @@ -39,3 +40,27 @@ parameters: # Ignore missing IMAP\Connection class in PHP <= 8.0 message: '(^Parameter .+ has invalid type IMAP\\Connection\.$)' path: src + + - + # Ignore missing SMTP class in PHPMailer 5.2.21 + # see https://github.com/PHPMailer/PHPMailer/blob/v5.2.21/class.smtp.php + message: '(^.+ an unknown class SMTP\.$)' + path: addon/mailstream/phpmailer + + - + # Ignore missing SMTP class in PHPMailer 5.2.21 + # see https://github.com/PHPMailer/PHPMailer/blob/v5.2.21/class.smtp.php + message: '(^Property .+ has unknown class SMTP as its type\.$)' + path: addon/mailstream/phpmailer + + - + # Ignore missing SMTP class in PHPMailer 5.2.21 + # see https://github.com/PHPMailer/PHPMailer/blob/v5.2.21/class.smtp.php + message: '(^Method .+ has invalid return type SMTP\.$)' + path: addon/mailstream/phpmailer + + - + # Ignore missing SMTP class in PHPMailer 5.2.21 + # see https://github.com/PHPMailer/PHPMailer/blob/v5.2.21/class.smtp.php + message: '(^Instantiated class SMTP not found\.$)' + path: addon/mailstream/phpmailer diff --git a/src/Util/Strings.php b/src/Util/Strings.php index 46d10529a9..fbf691879e 100644 --- a/src/Util/Strings.php +++ b/src/Util/Strings.php @@ -530,8 +530,12 @@ class Strings { $shorthand = trim($shorthand); - if (is_numeric($shorthand)) { - return $shorthand; + if (ctype_digit($shorthand)) { + return (int) $shorthand; + } + + if ($shorthand === '') { + return 0; } $last = strtolower($shorthand[strlen($shorthand) - 1]);