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

@@ -9,7 +9,7 @@ parameters:
#friendly: #friendly:
# lineBefore: 3 # lineBefore: 3
# lineAfter: 3 # lineAfter: 3
level: 8 # max is now 9 level: 8 # max is now 10
# strictRules: # strictRules:
# allRules: false # allRules: false
checkMissingCallableSignature: true checkMissingCallableSignature: true

View File

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