Add stub file for uploadprogress_get_info function

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2022-01-19 14:49:12 -03:00
parent e260351af9
commit 8fa99a3363
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
5 changed files with 33 additions and 17 deletions

View File

@ -13,7 +13,6 @@ use PhpMyAdmin\Plugins\UploadInterface;
use function array_key_exists;
use function function_exists;
use function trim;
use function uploadprogress_get_info;
/**
* Implementation for upload progress
@ -67,7 +66,8 @@ class UploadProgress implements UploadInterface
$status = null;
// @see https://pecl.php.net/package/uploadprogress
if (function_exists('uploadprogress_get_info')) {
$status = uploadprogress_get_info($id);
// phpcs:ignore SlevomatCodingStandard.Namespaces.ReferenceUsedNamesOnly.ReferenceViaFullyQualifiedName
$status = \uploadprogress_get_info($id);
}
if ($status) {

View File

@ -8,6 +8,8 @@ parameters:
- libraries/constants.php
bootstrapFiles:
- test/phpstan-constants.php
stubFiles:
- test/stubs/uploadprogress.stub
excludePaths:
- examples/openid.php
- node_modules/*

View File

@ -191,6 +191,9 @@
<code>mb_strpos($row, ' ON ')</code>
<code>mb_strpos($row, ' ON ')</code>
</PossiblyFalseOperand>
<PossiblyNullArgument occurrences="1">
<code>$row[0]</code>
</PossiblyNullArgument>
</file>
<file src="libraries/classes/Command/CacheWarmupCommand.php">
<MixedArgument occurrences="2">
@ -5380,7 +5383,7 @@
<InvalidReturnType occurrences="1">
<code>int|bool</code>
</InvalidReturnType>
<MixedArgument occurrences="51">
<MixedArgument occurrences="50">
<code>$_SERVER['SCRIPT_NAME']</code>
<code>$a</code>
<code>$arrayKeys</code>
@ -5403,7 +5406,6 @@
<code>$link</code>
<code>$link</code>
<code>$link</code>
<code>$link</code>
<code>$one_database_tables</code>
<code>$one_database_tables</code>
<code>$one_table_name</code>
@ -10505,14 +10507,10 @@
<MixedArgument occurrences="1">
<code>$_SESSION[$SESSION_KEY]</code>
</MixedArgument>
<MixedArrayAccess occurrences="7">
<MixedArrayAccess occurrences="3">
<code>$_SESSION[$SESSION_KEY][$id]</code>
<code>$ret['finished']</code>
<code>$ret['total']</code>
<code>$status['bytes_total']</code>
<code>$status['bytes_total']</code>
<code>$status['bytes_uploaded']</code>
<code>$status['bytes_uploaded']</code>
</MixedArrayAccess>
<MixedArrayAssignment occurrences="7">
<code>$_SESSION[$SESSION_KEY][$id]</code>
@ -10529,20 +10527,13 @@
<code>$_SESSION[$SESSION_KEY]</code>
<code>$_SESSION[$SESSION_KEY]</code>
</MixedArrayOffset>
<MixedAssignment occurrences="6">
<MixedAssignment occurrences="2">
<code>$_SESSION[$SESSION_KEY][$id]</code>
<code>$ret</code>
<code>$ret['complete']</code>
<code>$ret['percent']</code>
<code>$ret['total']</code>
<code>$status</code>
</MixedAssignment>
<MixedInferredReturnType occurrences="1">
<code>array|null</code>
</MixedInferredReturnType>
<MixedOperand occurrences="1">
<code>$ret['complete']</code>
</MixedOperand>
<MixedReturnStatement occurrences="2">
<code>$ret</code>
<code>$ret</code>

View File

@ -25,6 +25,10 @@
</ignoreFiles>
</projectFiles>
<stubs>
<file name="test/stubs/uploadprogress.stub"/>
</stubs>
<plugins>
<pluginClass class="Psalm\PhpUnitPlugin\Plugin"/>
</plugins>

View File

@ -0,0 +1,19 @@
<?php
/**
* @param string $identifier
* @return array{
* upload_id: string,
* fieldname: string,
* filename: string,
* time_start: int,
* time_last: int,
* speed_average: int,
* speed_last: int,
* bytes_uploaded: int,
* bytes_total: int,
* files_uploaded: int,
* est_sec: int
* }|null
*/
function uploadprogress_get_info(string $identifier): ?array {}