Skip to content

Commit

Permalink
fix(psalm): Add stubs
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Klehr <[email protected]>
  • Loading branch information
marcelklehr committed Feb 2, 2024
1 parent fcc2029 commit 8376c2e
Show file tree
Hide file tree
Showing 3 changed files with 144 additions and 161 deletions.
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<stubs>
<file name="tests/stub.phpstub" preloadClasses="true"/>
</stubs>
<projectFiles>
<directory name="lib" />
<ignoreFiles>
Expand Down
161 changes: 0 additions & 161 deletions tests/psalm-baseline.xml

This file was deleted.

141 changes: 141 additions & 0 deletions tests/stub.phpstub
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<?php

declare(strict_types=1);
namespace OC\Hooks {
class Emitter {
public function emit(string $class, string $value, array $option) {
}
/** Closure $closure */
public function listen(string $class, string $value, $closure) {
}
}
}

namespace OC {
class SystemConfig {
public function getKeys();
public function setValue($key, $value);
public function setValues(array $configs);
public function getValue($key, $default = '');
public function getFilteredValue($key, $default = '');
public function deleteValue($key);
}
}


namespace OC\Files\Cache {


class CacheQueryBuilder extends \OCP\DB\QueryBuilder\IQueryBuilder {
public function __construct(\OCP\IDBCOnnection $db, \OC\SystemConfig $config, \Psr\Log\LoggerInterface $logger, \OCP\FilesMetadata\IFilesMetadataManager $filesMetadataManager);
public function selectFileCache(string $alias = null, bool $joinExtendedCache = true):CacheQueryBuilder;
public function whereStorageId(int $storageId):CacheQueryBuilder;
public function whereFileId(int $fileId):CacheQueryBuilder;
public function wherePath(string $path):CacheQueryBuilder;
public function whereParent(int $parent):CacheQueryBuilder;
public function whereParentInParameter(string $parameter):CacheQueryBuilder;
}
}

namespace Doctrine\DBAL {
final class ParameterType {
/**
* Represents the SQL NULL data type.
*/
public const NULL = 0;

/**
* Represents the SQL INTEGER data type.
*/
public const INTEGER = 1;

/**
* Represents the SQL CHAR, VARCHAR, or other string data type.
*
* @see \PDO::PARAM_STR
*/
public const STRING = 2;

/**
* Represents the SQL large object data type.
*/
public const LARGE_OBJECT = 3;

/**
* Represents a boolean data type.
*
* @see \PDO::PARAM_BOOL
*/
public const BOOLEAN = 5;

/**
* Represents a binary string data type.
*/
public const BINARY = 16;

/**
* Represents an ASCII string data type
*/
public const ASCII = 17;

/**
* This class cannot be instantiated.
*
* @codeCoverageIgnore
*/
private function __construct() {
}
}

final class ArrayParameterType {
/**
* Represents an array of ints to be expanded by Doctrine SQL parsing.
*/
public const INTEGER = ParameterType::INTEGER + Connection::ARRAY_PARAM_OFFSET;

/**
* Represents an array of strings to be expanded by Doctrine SQL parsing.
*/
public const STRING = ParameterType::STRING + Connection::ARRAY_PARAM_OFFSET;

/**
* Represents an array of ascii strings to be expanded by Doctrine SQL parsing.
*/
public const ASCII = ParameterType::ASCII + Connection::ARRAY_PARAM_OFFSET;

/**
* Represents an array of ascii strings to be expanded by Doctrine SQL parsing.
*/
public const BINARY = ParameterType::BINARY + Connection::ARRAY_PARAM_OFFSET;

/**
* @internal
*
* @psalm-param self::* $type
*
* @psalm-return ParameterType::INTEGER|ParameterType::STRING|ParameterType::ASCII|ParameterType::BINARY
*/
public static function toElementParameterType(int $type): int {
}

private function __construct() {
}
}

class Connection {
/**
* Represents an array of ints to be expanded by Doctrine SQL parsing.
*/
public const PARAM_INT_ARRAY = ParameterType::INTEGER + self::ARRAY_PARAM_OFFSET;

/**
* Represents an array of strings to be expanded by Doctrine SQL parsing.
*/
public const PARAM_STR_ARRAY = ParameterType::STRING + self::ARRAY_PARAM_OFFSET;

/**
* Offset by which PARAM_* constants are detected as arrays of the param type.
*/
public const ARRAY_PARAM_OFFSET = 100;
}
}

0 comments on commit 8376c2e

Please sign in to comment.