Skip to content

Commit d544149

Browse files
CarlSchwanskjnldsv
authored andcommitted
Fix psalm errors fron the end of the baseline file
Signed-off-by: Carl Schwan <[email protected]>
1 parent 220d71d commit d544149

File tree

7 files changed

+13
-71
lines changed

7 files changed

+13
-71
lines changed

apps/files_trashbin/lib/Trashbin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -801,7 +801,7 @@ private static function calculateFreeSpace($trashbinSize, $user) {
801801
$availableSpace = $quota;
802802
}
803803

804-
return $availableSpace;
804+
return (int)$availableSpace;
805805
}
806806

807807
/**

build/psalm-baseline.xml

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -4490,11 +4490,9 @@
44904490
<InvalidOperand occurrences="1">
44914491
<code>$matches[1][$last_match][0]</code>
44924492
</InvalidOperand>
4493-
<InvalidReturnStatement occurrences="4">
4493+
<InvalidReturnStatement occurrences="2">
44944494
<code>(INF &gt; 0)? INF: PHP_INT_MAX</code>
44954495
<code>INF</code>
4496-
<code>max($upload_max_filesize, $post_max_size)</code>
4497-
<code>min($upload_max_filesize, $post_max_size)</code>
44984496
</InvalidReturnStatement>
44994497
<InvalidReturnType occurrences="1">
45004498
<code>int</code>
@@ -4532,22 +4530,6 @@
45324530
<code>\Test\Util\User\Dummy</code>
45334531
</UndefinedClass>
45344532
</file>
4535-
<file src="lib/private/legacy/OC_Util.php">
4536-
<InvalidReturnStatement occurrences="1">
4537-
<code>OC_Helper::computerFileSize($userQuota)</code>
4538-
</InvalidReturnStatement>
4539-
<InvalidReturnType occurrences="1">
4540-
<code>float</code>
4541-
</InvalidReturnType>
4542-
<RedundantCondition occurrences="1">
4543-
<code>is_string($expected)</code>
4544-
</RedundantCondition>
4545-
<TypeDoesNotContainType occurrences="3">
4546-
<code>is_bool($expected)</code>
4547-
<code>is_bool($setting[1])</code>
4548-
<code>is_int($expected)</code>
4549-
</TypeDoesNotContainType>
4550-
</file>
45514533
<file src="lib/public/AppFramework/ApiController.php">
45524534
<NoInterfaceProperties occurrences="1">
45534535
<code>$this-&gt;request-&gt;server</code>
@@ -4645,29 +4627,4 @@
46454627
<code>PreconditionNotMetException</code>
46464628
</InvalidClass>
46474629
</file>
4648-
<file src="lib/public/Search/SearchResult.php">
4649-
<InvalidArgument occurrences="1">
4650-
<code>$cursor</code>
4651-
</InvalidArgument>
4652-
</file>
4653-
<file src="lib/public/Share.php">
4654-
<InvalidReturnType occurrences="3">
4655-
<code>array</code>
4656-
<code>array|bool</code>
4657-
<code>mixed</code>
4658-
</InvalidReturnType>
4659-
</file>
4660-
<file src="lib/public/Util.php">
4661-
<InvalidReturnStatement occurrences="1">
4662-
<code>\OC_Helper::computerFileSize($str)</code>
4663-
</InvalidReturnStatement>
4664-
<InvalidReturnType occurrences="1">
4665-
<code>float</code>
4666-
</InvalidReturnType>
4667-
</file>
4668-
<file src="remote.php">
4669-
<InvalidScalarArgument occurrences="1">
4670-
<code>$e-&gt;getCode()</code>
4671-
</InvalidScalarArgument>
4672-
</file>
46734630
</files>

lib/private/legacy/OC_Helper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ public static function freeSpace($dir) {
420420
*/
421421
public static function uploadLimit() {
422422
$ini = \OC::$server->get(IniGetWrapper::class);
423-
$upload_max_filesize = OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
424-
$post_max_size = OCP\Util::computerFileSize($ini->get('post_max_size'));
425-
if ((int)$upload_max_filesize === 0 and (int)$post_max_size === 0) {
423+
$upload_max_filesize = (int)OCP\Util::computerFileSize($ini->get('upload_max_filesize'));
424+
$post_max_size = (int)OCP\Util::computerFileSize($ini->get('post_max_size'));
425+
if ($upload_max_filesize === 0 && $post_max_size === 0) {
426426
return INF;
427-
} elseif ((int)$upload_max_filesize === 0 or (int)$post_max_size === 0) {
427+
} elseif ($upload_max_filesize === 0 || $post_max_size === 0) {
428428
return max($upload_max_filesize, $post_max_size); //only the non 0 value counts
429429
} else {
430430
return min($upload_max_filesize, $post_max_size);

lib/private/legacy/OC_Util.php

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -657,20 +657,8 @@ public static function checkServer(\OC\SystemConfig $config) {
657657
}
658658
}
659659
foreach ($dependencies['ini'] as $setting => $expected) {
660-
if (is_bool($expected)) {
661-
if ($iniWrapper->getBool($setting) !== $expected) {
662-
$invalidIniSettings[] = [$setting, $expected];
663-
}
664-
}
665-
if (is_int($expected)) {
666-
if ($iniWrapper->getNumeric($setting) !== $expected) {
667-
$invalidIniSettings[] = [$setting, $expected];
668-
}
669-
}
670-
if (is_string($expected)) {
671-
if (strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) {
672-
$invalidIniSettings[] = [$setting, $expected];
673-
}
660+
if (strtolower($iniWrapper->getString($setting)) !== strtolower($expected)) {
661+
$invalidIniSettings[] = [$setting, $expected];
674662
}
675663
}
676664

@@ -682,9 +670,6 @@ public static function checkServer(\OC\SystemConfig $config) {
682670
$webServerRestart = true;
683671
}
684672
foreach ($invalidIniSettings as $setting) {
685-
if (is_bool($setting[1])) {
686-
$setting[1] = $setting[1] ? 'on' : 'off';
687-
}
688673
$errors[] = [
689674
'error' => $l->t('PHP setting "%s" is not set to "%s".', [$setting[0], var_export($setting[1], true)]),
690675
'hint' => $l->t('Adjusting this setting in php.ini will make Nextcloud run again')

lib/public/Search/SearchResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ final class SearchResult implements JsonSerializable {
5050
* @param string $name the translated name of the result section or group, e.g. "Mail"
5151
* @param bool $isPaginated
5252
* @param SearchResultEntry[] $entries
53-
* @param null $cursor
53+
* @param ?int|?string $cursor
5454
*
5555
* @since 20.0.0
5656
*/

lib/public/Share.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static function getItemSharedWithUser($itemType, $itemSource, $user, $own
6464
* @param int $format (optional) Format type must be defined by the backend
6565
* @param mixed $parameters
6666
* @param bool $includeCollections
67-
* @return array
67+
* @return void
6868
* @since 5.0.0
6969
* @deprecated 17.0.0
7070
*/
@@ -77,7 +77,7 @@ public static function getItemSharedWithBySource($itemType, $itemSource, $format
7777
* Based on the given token the share information will be returned - password protected shares will be verified
7878
* @param string $token
7979
* @param bool $checkPasswordProtection
80-
* @return array|bool false will be returned in case the token is unknown or unauthorized
80+
* @return void
8181
* @since 5.0.0 - parameter $checkPasswordProtection was added in 7.0.0
8282
* @deprecated 17.0.0
8383
*/
@@ -93,7 +93,7 @@ public static function getShareByToken($token, $checkPasswordProtection = true)
9393
* @param mixed $parameters
9494
* @param int $limit Number of items to return (optional) Returns all by default
9595
* @param bool $includeCollections
96-
* @return mixed Return depends on format
96+
* @return void
9797
* @since 5.0.0
9898
* @deprecated 17.0.0
9999
*/

lib/public/Util.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ public static function humanFileSize($bytes) {
372372
/**
373373
* Make a computer file size (2 kB to 2048)
374374
* @param string $str file size in a fancy format
375-
* @return float a file size in bytes
375+
* @return float|false a file size in bytes
376376
*
377377
* Inspired by: https://www.php.net/manual/en/function.filesize.php#92418
378378
* @since 4.0.0

0 commit comments

Comments
 (0)