phpstan checks for level 9

This commit is contained in:
Clemens Schwaighofer
2024-12-18 10:11:47 +09:00
parent 881c93c343
commit 41e116f7d4
2 changed files with 4 additions and 4 deletions

View File

@@ -46,19 +46,19 @@ class qqUploadedFileXhr implements qqUploadedFile // phpcs:ignore Squiz.Classes.
*/
public function getName(): string
{
return $_GET['qqfile'] ?? '';
return !empty($_GET['qqfile']) && is_string($_GET['qqfile']) ? $_GET['qqfile'] : '';
}
/**
* Get file size from _SERVERa array, throws an error if not possible
*
* @return int
* @return int size of the file
*
* @throws \Exception
*/
public function getSize(): int
{
if (isset($_SERVER['CONTENT_LENGTH'])) {
if (isset($_SERVER['CONTENT_LENGTH']) && is_numeric($_SERVER['CONTENT_LENGTH'])) {
return (int)$_SERVER['CONTENT_LENGTH'];
} else {
throw new \Exception('Getting content length is not supported.');