mirror of
https://github.com/nextcloud/server.git
synced 2026-03-21 10:00:33 -04:00
fix(nullcache): make get compliant with the interface
The interface defines ICacheEntry|false, thus we should not return null. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
parent
894f963804
commit
53fb05e2d0
3 changed files with 18 additions and 34 deletions
|
|
@ -4112,31 +4112,12 @@
|
|||
</InvalidOperand>
|
||||
</file>
|
||||
<file src="lib/private/Lockdown/Filesystem/NullCache.php">
|
||||
<InvalidNullableReturnType>
|
||||
<code><![CDATA[get]]></code>
|
||||
</InvalidNullableReturnType>
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[[]]]></code>
|
||||
</InvalidReturnStatement>
|
||||
<InvalidReturnType>
|
||||
<code><![CDATA[getIncomplete]]></code>
|
||||
</InvalidReturnType>
|
||||
<NullableReturnStatement>
|
||||
<code><![CDATA[$file !== '' ? null :
|
||||
new CacheEntry([
|
||||
'fileid' => -1,
|
||||
'parent' => -1,
|
||||
'name' => '',
|
||||
'path' => '',
|
||||
'size' => '0',
|
||||
'mtime' => time(),
|
||||
'storage_mtime' => time(),
|
||||
'etag' => '',
|
||||
'mimetype' => FileInfo::MIMETYPE_FOLDER,
|
||||
'mimepart' => 'httpd',
|
||||
'permissions' => Constants::PERMISSION_READ
|
||||
])]]></code>
|
||||
</NullableReturnStatement>
|
||||
</file>
|
||||
<file src="lib/private/Lockdown/Filesystem/NullStorage.php">
|
||||
<TooManyArguments>
|
||||
|
|
|
|||
|
|
@ -21,20 +21,23 @@ class NullCache implements ICache {
|
|||
}
|
||||
|
||||
public function get($file) {
|
||||
return $file !== '' ? null :
|
||||
new CacheEntry([
|
||||
'fileid' => -1,
|
||||
'parent' => -1,
|
||||
'name' => '',
|
||||
'path' => '',
|
||||
'size' => '0',
|
||||
'mtime' => time(),
|
||||
'storage_mtime' => time(),
|
||||
'etag' => '',
|
||||
'mimetype' => FileInfo::MIMETYPE_FOLDER,
|
||||
'mimepart' => 'httpd',
|
||||
'permissions' => Constants::PERMISSION_READ
|
||||
]);
|
||||
if ($file !== '') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return new CacheEntry([
|
||||
'fileid' => -1,
|
||||
'parent' => -1,
|
||||
'name' => '',
|
||||
'path' => '',
|
||||
'size' => '0',
|
||||
'mtime' => time(),
|
||||
'storage_mtime' => time(),
|
||||
'etag' => '',
|
||||
'mimetype' => FileInfo::MIMETYPE_FOLDER,
|
||||
'mimepart' => 'httpd',
|
||||
'permissions' => Constants::PERMISSION_READ
|
||||
]);
|
||||
}
|
||||
|
||||
public function getFolderContents($folder) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class NulLCacheTest extends \Test\TestCase {
|
|||
}
|
||||
|
||||
public function testGetEmpty(): void {
|
||||
$this->assertNull($this->cache->get('foo'));
|
||||
$this->assertFalse($this->cache->get('foo'));
|
||||
}
|
||||
|
||||
public function testGet(): void {
|
||||
|
|
|
|||
Loading…
Reference in a new issue