Skip to content

Commit

Permalink
fix(CI): Fix psalm updates
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Aug 28, 2023
1 parent 98f9379 commit bc723b1
Show file tree
Hide file tree
Showing 8 changed files with 105 additions and 38 deletions.
3 changes: 3 additions & 0 deletions lib/AppConfigOverwrite.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public function __construct(
$this->overWrite = $overWrite;
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function getValue($app, $key, $default = null) {
if (isset($this->overWrite[$app]) && isset($this->overWrite[$app][$key])) {
return $this->overWrite[$app][$key];
Expand Down
2 changes: 1 addition & 1 deletion lib/FilteredNavigationManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function getActiveEntry(): string {
return $this->navigationManager->getActiveEntry();
}

public function setActiveEntry($appId) {
public function setActiveEntry($appId): void {
$this->navigationManager->setActiveEntry($appId);
}

Expand Down
14 changes: 13 additions & 1 deletion lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function rename($source, $target): bool {
}
return false;
}

/**
* @psalm-suppress ParamNameMismatch
*/
Expand Down Expand Up @@ -162,6 +162,9 @@ public function mkdir($path): bool {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function rmdir($path) {
if ($this->checkPath($path)) {
return parent::rmdir($path);
Expand All @@ -178,6 +181,9 @@ public function unlink($path): bool {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function file_put_contents($path, $data) {
if ($this->checkPath($path)) {
return parent::file_put_contents($path, $data);
Expand All @@ -186,6 +192,9 @@ public function file_put_contents($path, $data) {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function fopen($path, $mode) {
if ($this->checkPath($path)) {
return parent::fopen($path, $mode);
Expand All @@ -194,6 +203,9 @@ public function fopen($path, $mode) {
}
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
public function getCache($path = '', $storage = null) {
if (!$storage) {
$storage = $this;
Expand Down
3 changes: 3 additions & 0 deletions lib/Storage/DirMaskCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public function __construct($cache, $mask, callable $checkPath) {
$this->checkPath = $checkPath;
}

/**
* @psalm-suppress MethodSignatureMustProvideReturnType
*/
protected function formatCacheEntry($entry) {
$checkPath = $this->checkPath;
if ($checkPath($entry['path'])) {
Expand Down
2 changes: 1 addition & 1 deletion lib/UserBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public function getHome(string $uid) {
/**
* @return bool
*/
public function hasUserListings() {
public function hasUserListings(): bool {
return true;
}

Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?xml version="1.0"?>
<psalm
errorLevel="4"
findUnusedBaselineEntry="true"
findUnusedCode="false"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
Expand Down Expand Up @@ -40,6 +42,7 @@
<errorLevel type="suppress">
<referencedClass name="OCA\Files\Event\LoadAdditionalScriptsEvent"/>
<referencedClass name="OC\AppFramework\OCS\V1Response"/>
<referencedClass name="OC\DB\ConnectionAdapter"/>
<referencedClass name="OC\Security\CSP\ContentSecurityPolicyNonceManager" />
</errorLevel>
</UndefinedClass>
Expand Down
29 changes: 8 additions & 21 deletions tests/psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,44 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.27.0@faf106e717c37b8c81721845dba9de3d8deed8ff">
<files psalm-version="5.14.1@b9d355e0829c397b9b3b47d0c0ed042a8a70284d">
<file src="lib/AppConfigOverwrite.php">
<MethodSignatureMismatch occurrences="1">
<MethodSignatureMismatch>
<code>public function getValue($app, $key, $default = null) {</code>
</MethodSignatureMismatch>
<UndefinedClass occurrences="1">
<code>ConnectionAdapter</code>
</UndefinedClass>
</file>
<file src="lib/AppInfo/Application.php">
<UndefinedInterfaceMethod occurrences="1">
<UndefinedInterfaceMethod>
<code>listen</code>
</UndefinedInterfaceMethod>
</file>
<file src="lib/AppWhitelist.php">
<UndefinedMethod occurrences="1"/>
</file>
<file src="lib/FilteredSettingsManager.php">
<UndefinedInterfaceMethod occurrences="1">
<code>getSection</code>
</UndefinedInterfaceMethod>
<UndefinedMethod/>
</file>
<file src="lib/Hooks.php">
<InvalidScalarArgument occurrences="1">
<code>$share-&gt;getNodeId()</code>
<InvalidScalarArgument>
<code><![CDATA[$share->getNodeId()]]></code>
</InvalidScalarArgument>
</file>
<file src="lib/Mail.php">
<MissingDependency occurrences="1">
<MissingDependency>
<code>Share</code>
</MissingDependency>
</file>
<file src="lib/RestrictionManager.php">
<UndefinedClass occurrences="1">
<UndefinedClass>
<code>ExternalMountPoint</code>
</UndefinedClass>
</file>
<file src="lib/UserBackend.php">
<ImplicitToStringCast occurrences="1">
<code>$query-&gt;func()-&gt;lower('displayname')</code>
</ImplicitToStringCast>
</file>
</files>
87 changes: 73 additions & 14 deletions tests/stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,48 @@ public static function isAvailable(): bool {

namespace OC {
class NavigationManager implements \OCP\INavigationManager {
public function add($entry) {
}

/**
* Sets the current navigation entry of the currently running app
* @param string $appId id of the app entry to activate (from added $entry)
* @return void
* @since 6.0.0
*/
public function setActiveEntry($appId) {
}

/**
* Get the current navigation entry of the currently running app
* @return string
* @since 20.0.0
*/
public function getActiveEntry() {
}

public function clear($loadDefaultLinks = true) {
}

/**
* Get a list of navigation entries
*
* @param string $type type of the navigation entries
* @return array
* @since 14.0.0
*/
public function getAll(string $type = self::TYPE_APPS): array {
}

/**
* Set an unread counter for navigation entries
*
* @param string $id id of the navigation entry
* @param int $unreadCounter Number of unread entries (0 to hide the counter which is the default)
* @since 22.0.0
*/
public function setUnreadCounter(string $id, int $unreadCounter): void {
}
}

class AppConfig {
Expand Down Expand Up @@ -122,6 +164,8 @@ public static function cleanAppId(string $appName): string {
}

class OC_Template {
public static function printErrorPage($error_msg, $hint = '', $statusCode = 500) {
}
}
}

Expand Down Expand Up @@ -334,6 +378,15 @@ public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader
class CacheWrapper extends Cache {
}
class CachePermissionsMask extends CacheWrapper {
/**
* @param \OCP\Files\Cache\ICache $cache
* @param int $mask
*/
public function __construct($cache, $mask) {
}

protected function formatCacheEntry($entry) {
}
}
}

Expand Down Expand Up @@ -436,10 +489,10 @@ class MountPoint implements IMountPoint {
protected $class;
protected $storageId;
protected $rootId = null;

/** @var int|null */
protected $mountId;

/**
* @param string|\OCP\Files\Storage\IStorage $storage
* @param string $mountpoint
Expand All @@ -452,7 +505,7 @@ class MountPoint implements IMountPoint {
public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null) {
throw new \Exception('stub');
}

/**
* get complete path to the mount point, relative to data/
*
Expand All @@ -461,7 +514,7 @@ public function __construct($storage, $mountpoint, $arguments = null, $loader =
public function getMountPoint() {
throw new \Exception('stub');
}

/**
* Sets the mount point path, relative to data/
*
Expand All @@ -470,43 +523,43 @@ public function getMountPoint() {
public function setMountPoint($mountPoint) {
throw new \Exception('stub');
}

/**
* @return \OCP\Files\Storage\IStorage
*/
public function getStorage() {
throw new \Exception('stub');
}

/**
* @return string
*/
public function getStorageId() {
throw new \Exception('stub');
}

/**
* @return int
*/
public function getNumericStorageId() {
throw new \Exception('stub');
}

/**
* @param string $path
* @return string
*/
public function getInternalPath($path) {
throw new \Exception('stub');
}

/**
* @param callable $wrapper
*/
public function wrapStorage($wrapper) {
throw new \Exception('stub');
}

/**
* Get a mount option
*
Expand All @@ -517,7 +570,7 @@ public function wrapStorage($wrapper) {
public function getOption($name, $default) {
throw new \Exception('stub');
}

/**
* Get all options for the mount
*
Expand All @@ -526,18 +579,18 @@ public function getOption($name, $default) {
public function getOptions() {
throw new \Exception('stub');
}

/**
* @return int
*/
public function getStorageRootId() {
throw new \Exception('stub');
}

public function getMountId() {
throw new \Exception('stub');
}

public function getMountType() {
throw new \Exception('stub');
}
Expand All @@ -549,6 +602,12 @@ public function getMountType() {
use OCP\Files\Storage\IStorage;

class Wrapper implements IStorage {
/**
* @var \OCP\Files\Storage\IStorage $storage
*/
protected $storage;


public function __construct(array $parameters) {
}

Expand Down

0 comments on commit bc723b1

Please sign in to comment.