Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automated] Update psalm-baseline.xml #29556

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/workflowengine/lib/Check/FileMimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ protected function getActualValue() {
}

if ($this->storage->file_exists($this->path) && $this->storage->filesize($this->path)) {
/** @var string */
$path = $this->storage->getLocalFile($this->path);
$mimeType = $this->mimeTypeDetector->detectContent($path);
return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType);
Expand Down
139 changes: 6 additions & 133 deletions build/psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,6 @@
<code>\Sabre\Uri\split($principal)</code>
</UndefinedFunction>
</file>
<file src="apps/dav/lib/Connector/PublicAuth.php">
<InvalidScalarArgument occurrences="1">
<code>'DummyBasic realm="' . $this-&gt;realm . '"'</code>
</InvalidScalarArgument>
</file>
<file src="apps/dav/lib/Connector/Sabre/AnonymousOptionsPlugin.php">
<InvalidNullableReturnType occurrences="1">
<code>bool</code>
Expand Down Expand Up @@ -1237,7 +1232,7 @@
<InvalidReturnType occurrences="1">
<code>string</code>
</InvalidReturnType>
<InvalidScalarArgument occurrences="6">
<InvalidScalarArgument occurrences="5">
<code>$id</code>
<code>$id</code>
<code>$id</code>
Expand Down Expand Up @@ -1546,10 +1541,6 @@
</ParamNameMismatch>
</file>
<file src="apps/files_external/lib/Lib/Storage/SFTPReadStream.php">
<FalsableReturnStatement occurrences="2">
<code>false</code>
<code>false</code>
</FalsableReturnStatement>
<InvalidArgument occurrences="2">
<code>$this-&gt;handle</code>
<code>$this-&gt;handle</code>
Expand All @@ -1568,11 +1559,6 @@
</InvalidReturnType>
</file>
<file src="apps/files_external/lib/Lib/Storage/SFTPWriteStream.php">
<FalsableReturnStatement occurrences="3">
<code>false</code>
<code>false</code>
<code>false</code>
</FalsableReturnStatement>
<InvalidArgument occurrences="2">
<code>$this-&gt;handle</code>
<code>$this-&gt;handle</code>
Expand All @@ -1591,9 +1577,6 @@
</InvalidReturnType>
</file>
<file src="apps/files_external/lib/Lib/Storage/SMB.php">
<FalsableReturnStatement occurrences="1">
<code>false</code>
</FalsableReturnStatement>
<InvalidArgument occurrences="1">
<code>$files</code>
</InvalidArgument>
Expand Down Expand Up @@ -1889,12 +1872,8 @@
</InvalidReturnType>
</file>
<file src="apps/files_sharing/lib/SharedStorage.php">
<FalsableReturnStatement occurrences="5">
<FalsableReturnStatement occurrences="1">
<code>$this-&gt;sourceRootInfo</code>
<code>false</code>
<code>false</code>
<code>false</code>
<code>$this-&gt;nonMaskedStorage-&gt;fopen($this-&gt;getUnjailedPath($path), $mode)</code>
</FalsableReturnStatement>
<InvalidNullableReturnType occurrences="1">
<code>ICacheEntry</code>
Expand Down Expand Up @@ -2406,8 +2385,7 @@
<NullArgument occurrences="1">
<code>$cookie</code>
</NullArgument>
<RedundantCondition occurrences="5">
<code>!isset($ldapName[0]) &amp;&amp; empty($ldapName[0])</code>
<RedundantCondition occurrences="4">
<code>is_null($limit)</code>
<code>!is_null($limit) &amp;&amp; (int)$this-&gt;connection-&gt;ldapPagingSize !== 0</code>
<code>is_array($result)</code>
Expand Down Expand Up @@ -2691,11 +2669,6 @@
</ImplicitToStringCast>
<MoreSpecificImplementedParamType occurrences="1"/>
</file>
<file src="apps/user_status/lib/Service/StatusService.php">
<MismatchingDocblockParamType occurrences="1">
<code>string|null</code>
</MismatchingDocblockParamType>
</file>
<file src="apps/workflowengine/lib/Check/AbstractStringCheck.php">
<NullArgument occurrences="1">
<code>null</code>
Expand Down Expand Up @@ -4487,7 +4460,6 @@
</ImplicitToStringCast>
<InvalidReturnStatement occurrences="3">
<code>$helper-&gt;getFileSize($fullPath)</code>
<code>file_put_contents($this-&gt;getSourcePath($path), $data)</code>
<code>$space</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="3">
Expand Down Expand Up @@ -4553,29 +4525,6 @@
</InvalidReturnType>
</file>
<file src="lib/private/Files/Storage/Wrapper/Encoding.php">
<FalsableReturnStatement occurrences="12">
<code>$this-&gt;storage-&gt;opendir($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;stat($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;filesize($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;filemtime($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;file_get_contents($this-&gt;findPathToUse($path))</code>
<code>$result</code>
<code>$this-&gt;storage-&gt;getMimeType($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;hash($type, $this-&gt;findPathToUse($path), $raw)</code>
<code>$this-&gt;storage-&gt;free_space($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;search($query)</code>
<code>$this-&gt;storage-&gt;getLocalFile($this-&gt;findPathToUse($path))</code>
<code>$this-&gt;storage-&gt;getETag($this-&gt;findPathToUse($path))</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>bool</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;storage-&gt;filetype($this-&gt;findPathToUse($path))</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>bool</code>
</InvalidReturnType>
<UndefinedInterfaceMethod occurrences="13">
<code>$this-&gt;namesCache</code>
<code>$this-&gt;namesCache</code>
Expand All @@ -4593,16 +4542,9 @@
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Files/Storage/Wrapper/Encryption.php">
<FalsableReturnStatement occurrences="5">
<code>$this-&gt;storage-&gt;filesize($path)</code>
<FalsableReturnStatement occurrences="1">
<code>false</code>
<code>$this-&gt;storage-&gt;file_get_contents($path)</code>
<code>$this-&gt;storage-&gt;getLocalFile($path)</code>
<code>$stat</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>resource|bool</code>
</ImplementedReturnTypeMismatch>
<InvalidArgument occurrences="2">
<code>$source</code>
<code>$target</code>
Expand Down Expand Up @@ -4630,40 +4572,14 @@
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Files/Storage/Wrapper/Jail.php">
<FalsableReturnStatement occurrences="12">
<code>$this-&gt;getWrapperStorage()-&gt;opendir($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;stat($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;filesize($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;filemtime($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;file_get_contents($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;fopen($this-&gt;getUnjailedPath($path), $mode)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getMimeType($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;hash($type, $this-&gt;getUnjailedPath($path), $raw)</code>
<code>$this-&gt;getWrapperStorage()-&gt;free_space($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;search($query)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getLocalFile($this-&gt;getUnjailedPath($path))</code>
<code>$this-&gt;getWrapperStorage()-&gt;getETag($this-&gt;getUnjailedPath($path))</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>bool</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;getWrapperStorage()-&gt;filetype($this-&gt;getUnjailedPath($path))</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="1">
<code>bool</code>
</InvalidReturnType>
</file>
<file src="lib/private/Files/Storage/Wrapper/PermissionsMask.php">
<FalsableReturnStatement occurrences="1">
<code>$this-&gt;checkMask($permissions) ? parent::fopen($path, $mode) : false</code>
</FalsableReturnStatement>
</file>
<file src="lib/private/Files/Storage/Wrapper/Quota.php">
<FalsableReturnStatement occurrences="2">
<code>$this-&gt;storage-&gt;free_space($path)</code>
<code>$source</code>
</FalsableReturnStatement>
<InvalidReturnStatement occurrences="1">
<code>$extension === 'part'</code>
</InvalidReturnStatement>
Expand All @@ -4682,39 +4598,14 @@
</UndefinedInterfaceMethod>
</file>
<file src="lib/private/Files/Storage/Wrapper/Wrapper.php">
<FalsableReturnStatement occurrences="13">
<code>$this-&gt;getWrapperStorage()-&gt;opendir($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;stat($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;filesize($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;filemtime($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;file_get_contents($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;fopen($path, $mode)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getMimeType($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;hash($type, $path, $raw)</code>
<code>$this-&gt;getWrapperStorage()-&gt;free_space($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;search($query)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getLocalFile($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getETag($path)</code>
<code>$this-&gt;getWrapperStorage()-&gt;getDirectDownload($path)</code>
</FalsableReturnStatement>
<ImplementedReturnTypeMismatch occurrences="1">
<code>bool</code>
</ImplementedReturnTypeMismatch>
<InvalidReturnStatement occurrences="2">
<code>$this-&gt;getWrapperStorage()-&gt;filetype($path)</code>
<InvalidReturnStatement occurrences="1">
<code>$this-&gt;getWrapperStorage()-&gt;test()</code>
</InvalidReturnStatement>
<InvalidReturnType occurrences="2">
<code>bool</code>
<InvalidReturnType occurrences="1">
<code>true</code>
</InvalidReturnType>
</file>
<file src="lib/private/Files/Stream/SeekableHttpStream.php">
<FalsableReturnStatement occurrences="3">
<code>false</code>
<code>false</code>
<code>false</code>
</FalsableReturnStatement>
<InvalidPropertyAssignmentValue occurrences="2">
<code>$this-&gt;current</code>
<code>$this-&gt;current</code>
Expand Down Expand Up @@ -5041,11 +4932,6 @@
<code>mixed</code>
</LessSpecificImplementedReturnType>
</file>
<file src="lib/private/Memcache/Factory.php">
<RedundantCondition occurrences="1">
<code>$lockingCacheClass &amp;&amp; class_exists($distributedCacheClass) &amp;&amp; $lockingCacheClass::isAvailable()</code>
</RedundantCondition>
</file>
<file src="lib/private/Memcache/Memcached.php">
<RedundantCondition occurrences="1">
<code>method_exists(self::$cache, 'deleteMulti')</code>
Expand Down Expand Up @@ -5149,11 +5035,6 @@
<code>?IImage</code>
</InvalidReturnType>
</file>
<file src="lib/private/Preview/ProviderV2.php">
<FalsableReturnStatement occurrences="1">
<code>$file-&gt;getStorage()-&gt;getLocalFile($file-&gt;getInternalPath())</code>
</FalsableReturnStatement>
</file>
<file src="lib/private/Preview/SVG.php">
<ImplicitToStringCast occurrences="1">
<code>$svg</code>
Expand Down Expand Up @@ -6039,18 +5920,10 @@
<code>\OC_App::getStorage($app)</code>
</FalsableReturnStatement>
</file>
<file src="lib/public/Files/Storage.php">
<InvalidReturnType occurrences="1">
<code>string|false</code>
</InvalidReturnType>
</file>
<file src="lib/public/Files/Storage/IStorage.php">
<InvalidParamDefault occurrences="1">
<code>array</code>
</InvalidParamDefault>
<InvalidReturnType occurrences="1">
<code>string|false</code>
</InvalidReturnType>
</file>
<file src="lib/public/FullTextSearch/Model/ISearchRequest.php">
<InvalidClass occurrences="1">
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Archive/Archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ abstract public function remove($path);
* get a file handler
* @param string $path
* @param string $mode
* @return resource
* @return bool|resource
*/
abstract public function getStream($path, $mode);
/**
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Archive/TAR.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public function remove($path) {
*
* @param string $path
* @param string $mode
* @return resource
* @return bool|resource
*/
public function getStream($path, $mode) {
if (strrpos($path, '.') !== false) {
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Archive/ZIP.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public function remove($path) {
* get a file handler
* @param string $path
* @param string $mode
* @return resource
* @return bool|resource
*/
public function getStream($path, $mode) {
if ($mode=='r' or $mode=='rb') {
Expand Down
14 changes: 8 additions & 6 deletions lib/private/Files/Storage/Wrapper/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function __construct(
* The result for filesize when called on a folder is required to be 0
*
* @param string $path
* @return int
* @return int|bool
*/
public function filesize($path) {
$fullPath = $this->getFullPath($path);
Expand Down Expand Up @@ -209,7 +209,7 @@ public function getDirectoryContent($directory): \Traversable {
* see http://php.net/manual/en/function.file_get_contents.php
*
* @param string $path
* @return string
* @return string|bool
*/
public function file_get_contents($path) {
$encryptionModule = $this->getEncryptionModule($path);
Expand Down Expand Up @@ -401,7 +401,9 @@ public function fopen($path, $mode) {
}

if ($this->file_exists($path)) {
/** @var int */
$size = $this->storage->filesize($path);
/** @var int */
$unencryptedSize = $this->filesize($path);
} else {
$size = $unencryptedSize = 0;
Expand Down Expand Up @@ -498,7 +500,7 @@ protected function verifyUnencryptedSize($path, $unencryptedSize) {
if (isset($this->fixUnencryptedSizeOf[$this->getFullPath($path)]) === false) {
$this->fixUnencryptedSizeOf[$this->getFullPath($path)] = true;
try {
$result = $this->fixUnencryptedSize($path, $size, $unencryptedSize);
$result = $this->fixUnencryptedSize($path, (int) $size, $unencryptedSize);
} catch (\Exception $e) {
$this->logger->error('Couldn\'t re-calculate unencrypted size for ' . $path);
$this->logger->logException($e);
Expand Down Expand Up @@ -760,7 +762,7 @@ private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInte
}
if ($result) {
if ($preserveMtime) {
$this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath));
$this->touch($targetInternalPath, (int) $sourceStorage->filemtime($sourceInternalPath));
}
$this->updateEncryptedVersion($sourceStorage, $sourceInternalPath, $targetInternalPath, $isRename, false);
} else {
Expand All @@ -778,7 +780,7 @@ private function copyBetweenStorage(Storage\IStorage $sourceStorage, $sourceInte
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
* @return string
* @return bool|string
*/
public function getLocalFile($path) {
if ($this->encryptionManager->isEnabled()) {
Expand Down Expand Up @@ -807,7 +809,7 @@ public function isLocal() {
* only the following keys are required in the result: size and mtime
*
* @param string $path
* @return array
* @return array|bool
*/
public function stat($path) {
$stat = $this->storage->stat($path);
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Files/Stream/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ protected function readCache() {
/**
* write header at beginning of encrypted file
*
* @return integer
* @return int|false
* @throws EncryptionHeaderKeyExistsException if header key is already in use
*/
protected function writeHeader() {
Expand Down
1 change: 1 addition & 0 deletions lib/private/Preview/ProviderV2.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ protected function getLocalFile(File $file, int $maxSize = null): string {
$this->tmpFiles[] = $absPath;
return $absPath;
} else {
/** @var string */
return $file->getStorage()->getLocalFile($file->getInternalPath());
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Files/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ public function touch($path, $mtime = null);
* The local version of the file can be temporary and doesn't have to be persistent across requests
*
* @param string $path
* @return string|bool
* @return bool|string
* @since 6.0.0
*/
public function getLocalFile($path);
Expand Down