diff --git a/composer.lock b/composer.lock index b588cf0c5..18844fe46 100644 --- a/composer.lock +++ b/composer.lock @@ -71,12 +71,12 @@ "source": { "type": "git", "url": "https://github.com/nextcloud-deps/ocp.git", - "reference": "dfcf4583e63fea987ad58585bb5f11c65cc05e82" + "reference": "b83c3e45851c4249f42fe088991f66d4af1ceb55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/dfcf4583e63fea987ad58585bb5f11c65cc05e82", - "reference": "dfcf4583e63fea987ad58585bb5f11c65cc05e82", + "url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/b83c3e45851c4249f42fe088991f66d4af1ceb55", + "reference": "b83c3e45851c4249f42fe088991f66d4af1ceb55", "shasum": "" }, "require": { @@ -84,7 +84,7 @@ "psr/clock": "^1.0", "psr/container": "^2.0.2", "psr/event-dispatcher": "^1.0", - "psr/log": "^1.1.4" + "psr/log": "^3.0.2" }, "default-branch": true, "type": "library", @@ -108,7 +108,7 @@ "issues": "https://github.com/nextcloud-deps/ocp/issues", "source": "https://github.com/nextcloud-deps/ocp/tree/master" }, - "time": "2024-10-05T00:42:05+00:00" + "time": "2024-10-12T00:41:45+00:00" }, { "name": "psr/clock", @@ -263,30 +263,30 @@ }, { "name": "psr/log", - "version": "1.1.4", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.0.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "3.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -307,9 +307,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "roave/security-advisories", diff --git a/lib/ACL/ACLStorageWrapper.php b/lib/ACL/ACLStorageWrapper.php index c862a2019..5878f0735 100644 --- a/lib/ACL/ACLStorageWrapper.php +++ b/lib/ACL/ACLStorageWrapper.php @@ -43,33 +43,33 @@ private function checkPermissions(string $path, int $permissions): bool { return ($this->getACLPermissionsForPath($path) & $permissions) === $permissions; } - public function isReadable($path): bool { + public function isReadable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::isReadable($path); } - public function isUpdatable($path): bool { + public function isUpdatable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_UPDATE) && parent::isUpdatable($path); } - public function isCreatable($path): bool { + public function isCreatable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::isCreatable($path); } - public function isDeletable($path): bool { + public function isDeletable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_DELETE) && $this->canDeleteTree($path) && parent::isDeletable($path); } - public function isSharable($path): bool { + public function isSharable(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_SHARE) && parent::isSharable($path); } - public function getPermissions($path): int { + public function getPermissions(string $path): int { return $this->storage->getPermissions($path) & $this->getACLPermissionsForPath($path); } - public function rename($source, $target): bool { + public function rename(string $source, string $target): bool { if (str_starts_with($source, $target)) { $part = substr($source, strlen($target)); //This is a rename of the transfer file to the original file @@ -96,7 +96,7 @@ public function rename($source, $target): bool { parent::rename($source, $target); } - public function opendir($path) { + public function opendir(string $path) { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -118,29 +118,29 @@ public function opendir($path) { return IteratorDirectory::wrap($items); } - public function copy($source, $target): bool { + public function copy(string $source, string $target): bool { $permissions = $this->file_exists($target) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkPermissions($target, $permissions) && $this->checkPermissions($source, Constants::PERMISSION_READ) && parent::copy($source, $target); } - public function touch($path, $mtime = null): bool { + public function touch(string $path, ?int $mtime = null): bool { $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkPermissions($path, $permissions) && parent::touch($path, $mtime); } - public function mkdir($path): bool { + public function mkdir(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::mkdir($path); } - public function rmdir($path): bool { + public function rmdir(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_DELETE) && $this->canDeleteTree($path) && parent::rmdir($path); } - public function unlink($path): bool { + public function unlink(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_DELETE) && $this->canDeleteTree($path) && parent::unlink($path); @@ -154,12 +154,12 @@ private function canDeleteTree(string $path): int { return $this->aclManager->getPermissionsForTree($path) & Constants::PERMISSION_DELETE; } - public function file_put_contents($path, $data): int|float|false { + public function file_put_contents(string $path, mixed $data): int|float|false { $permissions = $this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE; return $this->checkPermissions($path, $permissions) ? parent::file_put_contents($path, $data) : false; } - public function fopen($path, $mode) { + public function fopen(string $path, string $mode) { if ($mode === 'r' or $mode === 'rb') { $permissions = Constants::PERMISSION_READ; } else { @@ -189,7 +189,7 @@ public function getCache($path = '', $storage = null): ICache { return new ACLCacheWrapper($sourceCache, $this->aclManager, $this->inShare); } - public function getMetaData($path): ?array { + public function getMetaData(string $path): ?array { $data = parent::getMetaData($path); if ($data && isset($data['permissions'])) { @@ -213,17 +213,17 @@ public function getScanner($path = '', $storage = null): IScanner { return parent::getScanner($path, $storage); } - public function is_dir($path): bool { + public function is_dir(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::is_dir($path); } - public function is_file($path): bool { + public function is_file(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::is_file($path); } - public function stat($path): array|false { + public function stat(string $path): array|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -231,7 +231,7 @@ public function stat($path): array|false { return parent::stat($path); } - public function filetype($path): string|false { + public function filetype(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -239,7 +239,7 @@ public function filetype($path): string|false { return parent::filetype($path); } - public function filesize($path): false|int|float { + public function filesize(string $path): false|int|float { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -247,12 +247,12 @@ public function filesize($path): false|int|float { return parent::filesize($path); } - public function file_exists($path): bool { + public function file_exists(string $path): bool { return $this->checkPermissions($path, Constants::PERMISSION_READ) && parent::file_exists($path); } - public function filemtime($path): int|false { + public function filemtime(string $path): int|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -260,7 +260,7 @@ public function filemtime($path): int|false { return parent::filemtime($path); } - public function file_get_contents($path): string|false { + public function file_get_contents(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -268,7 +268,7 @@ public function file_get_contents($path): string|false { return parent::file_get_contents($path); } - public function getMimeType($path): string|false { + public function getMimeType(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -276,7 +276,7 @@ public function getMimeType($path): string|false { return parent::getMimeType($path); } - public function hash($type, $path, $raw = false): string|false { + public function hash(string $type, string $path, bool $raw = false): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -284,7 +284,7 @@ public function hash($type, $path, $raw = false): string|false { return parent::hash($type, $path, $raw); } - public function getETag($path): string|false { + public function getETag(string $path): string|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -292,7 +292,7 @@ public function getETag($path): string|false { return parent::getETag($path); } - public function getDirectDownload($path): array|false { + public function getDirectDownload(string $path): array|false { if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) { return false; } @@ -300,7 +300,7 @@ public function getDirectDownload($path): array|false { return parent::getDirectDownload($path); } - public function getDirectoryContent($directory): \Traversable { + public function getDirectoryContent(string $directory): \Traversable { $content = $this->getWrapperStorage()->getDirectoryContent($directory); foreach ($content as $data) { $data['scan_permissions'] ??= $data['permissions']; diff --git a/lib/Command/Trashbin/Cleanup.php b/lib/Command/Trashbin/Cleanup.php index 71e71f3f3..8f1611402 100644 --- a/lib/Command/Trashbin/Cleanup.php +++ b/lib/Command/Trashbin/Cleanup.php @@ -13,6 +13,7 @@ use OCA\GroupFolders\Trash\TrashBackend; use OCP\App\IAppManager; use OCP\Server; +use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; @@ -46,6 +47,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int return -1; } + /** @var QuestionHelper $helper */ $helper = $this->getHelper('question'); $folders = $this->folderManager->getAllFolders(); diff --git a/lib/Mount/GroupFolderStorage.php b/lib/Mount/GroupFolderStorage.php index 18670f99e..9227fca84 100644 --- a/lib/Mount/GroupFolderStorage.php +++ b/lib/Mount/GroupFolderStorage.php @@ -38,7 +38,7 @@ public function getFolderId(): int { return $this->folderId; } - public function getOwner($path): string|false { + public function getOwner(string $path): string|false { $user = $this->userSession->getUser(); if ($user !== null) { return $user->getUID(); diff --git a/lib/Mount/RootPermissionsMask.php b/lib/Mount/RootPermissionsMask.php index 62e19e474..5f593b5ce 100644 --- a/lib/Mount/RootPermissionsMask.php +++ b/lib/Mount/RootPermissionsMask.php @@ -37,7 +37,7 @@ private function checkMask(int $permissions): bool { return ($this->mask & $permissions) === $permissions; } - public function isUpdatable($path): bool { + public function isUpdatable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_UPDATE) and parent::isUpdatable($path); } else { @@ -45,7 +45,7 @@ public function isUpdatable($path): bool { } } - public function isCreatable($path): bool { + public function isCreatable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_CREATE) and parent::isCreatable($path); } else { @@ -53,7 +53,7 @@ public function isCreatable($path): bool { } } - public function isDeletable($path): bool { + public function isDeletable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_DELETE) and parent::isDeletable($path); } else { @@ -61,7 +61,7 @@ public function isDeletable($path): bool { } } - public function isSharable($path): bool { + public function isSharable(string $path): bool { if ($path === '') { return $this->checkMask(Constants::PERMISSION_SHARE) and parent::isSharable($path); } else { @@ -69,7 +69,7 @@ public function isSharable($path): bool { } } - public function getPermissions($path): int { + public function getPermissions(string $path): int { if ($path === '') { return $this->storage->getPermissions($path) & $this->mask; } else { @@ -77,7 +77,7 @@ public function getPermissions($path): int { } } - public function getMetaData($path): ?array { + public function getMetaData(string $path): ?array { $data = parent::getMetaData($path); if ($data && $path === '' && isset($data['permissions'])) { diff --git a/tests/stubs/doctrine_dbal_schema_abstractasset.php b/tests/stubs/doctrine_dbal_schema_abstractasset.php index de9a86572..36e8fdb9b 100644 --- a/tests/stubs/doctrine_dbal_schema_abstractasset.php +++ b/tests/stubs/doctrine_dbal_schema_abstractasset.php @@ -20,7 +20,8 @@ * The abstract asset allows to reset the name of all assets without publishing this to the public userland. * * This encapsulation hack is necessary to keep a consistent state of the database schema. Say we have a list of tables - * array($tableName => Table($tableName)); if you want to rename the table, you have to make sure + * array($tableName => Table($tableName)); if you want to rename the table, you have to make sure this does not get + * recreated during schema migration. */ abstract class AbstractAsset { diff --git a/tests/stubs/oc_core_command_base.php b/tests/stubs/oc_core_command_base.php index a6de76e63..d398338a3 100644 --- a/tests/stubs/oc_core_command_base.php +++ b/tests/stubs/oc_core_command_base.php @@ -65,7 +65,7 @@ public function cancelOperation(): void { } - public function run(InputInterface $input, OutputInterface $output) + public function run(InputInterface $input, OutputInterface $output): int { } diff --git a/tests/stubs/oc_files_objectstore_objectstorestorage.php b/tests/stubs/oc_files_objectstore_objectstorestorage.php index 4ccd00c56..bb3650aca 100644 --- a/tests/stubs/oc_files_objectstore_objectstorestorage.php +++ b/tests/stubs/oc_files_objectstore_objectstorestorage.php @@ -42,7 +42,7 @@ public function __construct($params) { } - public function mkdir($path, bool $force = false): bool + public function mkdir(string $path, bool $force = false): bool { } @@ -50,7 +50,7 @@ public function mkdir($path, bool $force = false): bool * Object Stores use a NoopScanner because metadata is directly stored in * the file cache and cannot really scan the filesystem. The storage passed in is not used anywhere. */ - public function getScanner($path = '', $storage = null): IScanner + public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { } @@ -58,11 +58,11 @@ public function getId(): string { } - public function rmdir($path): bool + public function rmdir(string $path): bool { } - public function unlink($path): bool + public function unlink(string $path): bool { } @@ -70,11 +70,11 @@ public function rmObject(ICacheEntry $entry): bool { } - public function stat($path): array|false + public function stat(string $path): array|false { } - public function getPermissions($path): int + public function getPermissions(string $path): int { } @@ -83,46 +83,45 @@ public function getPermissions($path): int * The default implementations just appends the fileId to 'urn:oid:'. Make sure the URN is unique over all users. * You may need a mapping table to store your URN if it cannot be generated from the fileid. * - * @param int $fileId the fileid - * @return null|string the unified resource name used to identify the object + * @return string the unified resource name used to identify the object */ - public function getURN($fileId) + public function getURN(int $fileId): string { } - public function opendir($path) + public function opendir(string $path) { } - public function filetype($path): string|false + public function filetype(string $path): string|false { } - public function fopen($path, $mode) + public function fopen(string $path, string $mode) { } - public function file_exists($path): bool + public function file_exists(string $path): bool { } - public function rename($source, $target): bool + public function rename(string $source, string $target): bool { } - public function getMimeType($path): string|false + public function getMimeType(string $path): string|false { } - public function touch($path, $mtime = null): bool + public function touch(string $path, ?int $mtime = null): bool { } - public function writeBack($tmpFile, $path) + public function writeBack(string $tmpFile, string $path) { } - public function hasUpdated($path, $time): bool + public function hasUpdated(string $path, int $time): bool { } @@ -130,7 +129,7 @@ public function needsPartFile(): bool { } - public function file_put_contents($path, $data): int + public function file_put_contents(string $path, mixed $data): int { } @@ -142,15 +141,15 @@ public function getObjectStore(): IObjectStore { } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false): bool + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, ?ICacheEntry $sourceCacheEntry = null): bool + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, ?ICacheEntry $sourceCacheEntry = null): bool { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } diff --git a/tests/stubs/oc_files_storage_common.php b/tests/stubs/oc_files_storage_common.php index 8b542e308..5106d3b9f 100644 --- a/tests/stubs/oc_files_storage_common.php +++ b/tests/stubs/oc_files_storage_common.php @@ -64,84 +64,79 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage, public function __construct($parameters) { } - /** - * Remove a file or folder - * - * @param string $path - */ - protected function remove($path): bool + protected function remove(string $path): bool { } - public function is_dir($path): bool + public function is_dir(string $path): bool { } - public function is_file($path): bool + public function is_file(string $path): bool { } - public function filesize($path): int|float|false + public function filesize(string $path): int|float|false { } - public function isReadable($path): bool + public function isReadable(string $path): bool { } - public function isUpdatable($path): bool + public function isUpdatable(string $path): bool { } - public function isCreatable($path): bool + public function isCreatable(string $path): bool { } - public function isDeletable($path): bool + public function isDeletable(string $path): bool { } - public function isSharable($path): bool + public function isSharable(string $path): bool { } - public function getPermissions($path): int + public function getPermissions(string $path): int { } - public function filemtime($path): int|false + public function filemtime(string $path): int|false { } - public function file_get_contents($path): string|false + public function file_get_contents(string $path): string|false { } - public function file_put_contents($path, $data): int|float|false + public function file_put_contents(string $path, mixed $data): int|float|false { } - public function rename($source, $target): bool + public function rename(string $source, string $target): bool { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } - public function getMimeType($path): string|false + public function getMimeType(string $path): string|false { } - public function hash($type, $path, $raw = false): string|false + public function hash(string $type, string $path, bool $raw = false): string|false { } - public function getLocalFile($path): string|false + public function getLocalFile(string $path): string|false { } - protected function searchInDir($query, $dir = ''): array + protected function searchInDir(string $query, string $dir = ''): array { } @@ -154,7 +149,7 @@ protected function searchInDir($query, $dir = ''): array * exclusive access to the backend and will not pick up files that have been added in a way that circumvents * Nextcloud filesystem. */ - public function hasUpdated($path, $time): bool + public function hasUpdated(string $path, int $time): bool { } @@ -162,35 +157,35 @@ protected function getCacheDependencies(): CacheDependencies { } - public function getCache($path = '', $storage = null): ICache + public function getCache(string $path = '', ?IStorage $storage = null): ICache { } - public function getScanner($path = '', $storage = null): IScanner + public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { } - public function getWatcher($path = '', $storage = null): IWatcher + public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { } - public function getPropagator($storage = null): IPropagator + public function getPropagator(?IStorage $storage = null): IPropagator { } - public function getUpdater($storage = null): IUpdater + public function getUpdater(?IStorage $storage = null): IUpdater { } - public function getStorageCache($storage = null): \OC\Files\Cache\Storage + public function getStorageCache(?IStorage $storage = null): \OC\Files\Cache\Storage { } - public function getOwner($path): string|false + public function getOwner(string $path): string|false { } - public function getETag($path): string|false + public function getETag(string $path): string|false { } @@ -201,7 +196,7 @@ public function getETag($path): string|false * @param string $path The path to clean * @return string cleaned path */ - public function cleanPath($path): string + public function cleanPath(string $path): string { } @@ -212,7 +207,7 @@ public function test(): bool { } - public function free_space($path): int|float|false + public function free_space(string $path): int|float|false { } @@ -222,10 +217,8 @@ public function isLocal(): bool /** * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class - * - * @param string $class */ - public function instanceOfStorage($class): bool + public function instanceOfStorage(string $class): bool { } @@ -233,14 +226,12 @@ public function instanceOfStorage($class): bool * A custom storage implementation can return an url for direct download of a give file. * * For now the returned array can hold the parameter url - in future more attributes might follow. - * - * @param string $path */ - public function getDirectDownload($path): array|false + public function getDirectDownload(string $path): array|false { } - public function verifyPath($path, $fileName): void + public function verifyPath(string $path, string $fileName): void { } @@ -256,44 +247,31 @@ public function setMountOptions(array $options): void { } - /** - * @param string $name - * @param mixed $default - */ - public function getMountOption($name, $default = null): mixed + public function getMountOption(string $name, mixed $default = null): mixed { } - /** - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @param bool $preserveMtime - */ - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false): bool + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { } - /** - * @param string $sourceInternalPath - * @param string $targetInternalPath - */ - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function getMetaData($path): ?array + public function getMetaData(string $path): ?array { } - public function acquireLock($path, $type, ILockingProvider $provider): void + public function acquireLock(string $path, int $type, ILockingProvider $provider): void { } - public function releaseLock($path, $type, ILockingProvider $provider): void + public function releaseLock(string $path, int $type, ILockingProvider $provider): void { } - public function changeLock($path, $type, ILockingProvider $provider): void + public function changeLock(string $path, int $type, ILockingProvider $provider): void { } @@ -304,7 +282,7 @@ public function getAvailability(): array { } - public function setAvailability($isAvailable): void + public function setAvailability(bool $isAvailable): void { } @@ -320,7 +298,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int { } - public function getDirectoryContent($directory): \Traversable + public function getDirectoryContent(string $directory): \Traversable { } } diff --git a/tests/stubs/oc_files_storage_local.php b/tests/stubs/oc_files_storage_local.php index 66bacaa23..7f1699d2c 100644 --- a/tests/stubs/oc_files_storage_local.php +++ b/tests/stubs/oc_files_storage_local.php @@ -45,121 +45,116 @@ public function getId(): string { } - public function mkdir($path): bool + public function mkdir(string $path): bool { } - public function rmdir($path): bool + public function rmdir(string $path): bool { } - public function opendir($path) + public function opendir(string $path) { } - public function is_dir($path): bool + public function is_dir(string $path): bool { } - public function is_file($path): bool + public function is_file(string $path): bool { } - public function stat($path): array|false + public function stat(string $path): array|false { } - public function getMetaData($path): ?array + public function getMetaData(string $path): ?array { } - public function filetype($path): string|false + public function filetype(string $path): string|false { } - public function filesize($path): int|float|false + public function filesize(string $path): int|float|false { } - public function isReadable($path): bool + public function isReadable(string $path): bool { } - public function isUpdatable($path): bool + public function isUpdatable(string $path): bool { } - public function file_exists($path): bool + public function file_exists(string $path): bool { } - public function filemtime($path): int|false + public function filemtime(string $path): int|false { } - public function touch($path, $mtime = null): bool + public function touch(string $path, ?int $mtime = null): bool { } - public function file_get_contents($path): string|false + public function file_get_contents(string $path): string|false { } - public function file_put_contents($path, $data): int|float|false + public function file_put_contents(string $path, mixed $data): int|float|false { } - public function unlink($path): bool + public function unlink(string $path): bool { } - public function rename($source, $target): bool + public function rename(string $source, string $target): bool { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } - public function fopen($path, $mode) + public function fopen(string $path, string $mode) { } - public function hash($type, $path, $raw = false): string|false + public function hash(string $type, string $path, bool $raw = false): string|false { } - public function free_space($path): int|float|false + public function free_space(string $path): int|float|false { } - public function search($query): array + public function search(string $query): array { } - public function getLocalFile($path): string|false + public function getLocalFile(string $path): string|false { } - /** - * @param string $query - * @param string $dir - */ - protected function searchInDir($query, $dir = ''): array + protected function searchInDir(string $query, string $dir = ''): array { } - public function hasUpdated($path, $time): bool + public function hasUpdated(string $path, int $time): bool { } /** * Get the source path (on disk) of a given path * - * @param string $path * @throws ForbiddenException */ - public function getSourcePath($path): string + public function getSourcePath(string $path): string { } @@ -167,21 +162,15 @@ public function isLocal(): bool { } - public function getETag($path): string|false + public function getETag(string $path): string|false { } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false): bool + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath, bool $preserveMtime = false): bool { } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } diff --git a/tests/stubs/oc_files_storage_storage.php b/tests/stubs/oc_files_storage_storage.php index c5f0929d4..8afb2fb77 100644 --- a/tests/stubs/oc_files_storage_storage.php +++ b/tests/stubs/oc_files_storage_storage.php @@ -22,41 +22,23 @@ * All paths passed to the storage are relative to the storage and should NOT have a leading slash. */ interface Storage extends IStorage, ILockingStorage { - /** - * @param string $path - * @param ?IStorage $storage - */ - public function getCache($path = '', $storage = null): ICache + public function getCache(string $path = '', ?IStorage $storage = null): ICache { } - /** - * @param string $path - * @param ?IStorage $storage - */ - public function getScanner($path = '', $storage = null): IScanner + public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { } - /** - * @param string $path - * @param ?IStorage $storage - */ - public function getWatcher($path = '', $storage = null): IWatcher + public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { } - /** - * @param ?IStorage $storage - */ - public function getPropagator($storage = null): IPropagator + public function getPropagator(?IStorage $storage = null): IPropagator { } - /** - * @param ?IStorage $storage - */ - public function getUpdater($storage = null): IUpdater + public function getUpdater(?IStorage $storage = null): IUpdater { } @@ -64,18 +46,13 @@ public function getStorageCache(): \OC\Files\Cache\Storage { } - /** - * @param string $path - */ - public function getMetaData($path): ?array + public function getMetaData(string $path): ?array { } /** * Get the contents of a directory with metadata * - * @param string $directory - * * The metadata array will contain the following fields * * - name @@ -86,7 +63,7 @@ public function getMetaData($path): ?array * - storage_mtime * - permissions */ - public function getDirectoryContent($directory): \Traversable + public function getDirectoryContent(string $directory): \Traversable { } } diff --git a/tests/stubs/oc_files_storage_wrapper_jail.php b/tests/stubs/oc_files_storage_wrapper_jail.php index 4ba274ed5..b7d09791c 100644 --- a/tests/stubs/oc_files_storage_wrapper_jail.php +++ b/tests/stubs/oc_files_storage_wrapper_jail.php @@ -39,7 +39,7 @@ public function __construct($arguments) { } - public function getUnjailedPath($path): string + public function getUnjailedPath(string $path): string { } @@ -51,7 +51,7 @@ public function getUnjailedStorage(): IStorage } - public function getJailedPath($path): ?string + public function getJailedPath(string $path): ?string { } @@ -59,168 +59,166 @@ public function getId(): string { } - public function mkdir($path): bool + public function mkdir(string $path): bool { } - public function rmdir($path): bool + public function rmdir(string $path): bool { } - public function opendir($path) + public function opendir(string $path) { } - public function is_dir($path): bool + public function is_dir(string $path): bool { } - public function is_file($path): bool + public function is_file(string $path): bool { } - public function stat($path): array|false + public function stat(string $path): array|false { } - public function filetype($path): string|false + public function filetype(string $path): string|false { } - public function filesize($path): int|float|false + public function filesize(string $path): int|float|false { } - public function isCreatable($path): bool + public function isCreatable(string $path): bool { } - public function isReadable($path): bool + public function isReadable(string $path): bool { } - public function isUpdatable($path): bool + public function isUpdatable(string $path): bool { } - public function isDeletable($path): bool + public function isDeletable(string $path): bool { } - public function isSharable($path): bool + public function isSharable(string $path): bool { } - public function getPermissions($path): int + public function getPermissions(string $path): int { } - public function file_exists($path): bool + public function file_exists(string $path): bool { } - public function filemtime($path): int|false + public function filemtime(string $path): int|false { } - public function file_get_contents($path): string|false + public function file_get_contents(string $path): string|false { } - public function file_put_contents($path, $data): int|float|false + public function file_put_contents(string $path, mixed $data): int|float|false { } - public function unlink($path): bool + public function unlink(string $path): bool { } - public function rename($source, $target): bool + public function rename(string $source, string $target): bool { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } - public function fopen($path, $mode) + public function fopen(string $path, string $mode) { } - public function getMimeType($path): string|false + public function getMimeType(string $path): string|false { } - public function hash($type, $path, $raw = false): string|false + public function hash(string $type, string $path, bool $raw = false): string|false { } - public function free_space($path): int|float|false + public function free_space(string $path): int|float|false { } - public function touch($path, $mtime = null): bool + public function touch(string $path, ?int $mtime = null): bool { } - public function getLocalFile($path): string|false + public function getLocalFile(string $path): string|false { } - public function hasUpdated($path, $time): bool + public function hasUpdated(string $path, int $time): bool { } - public function getCache($path = '', $storage = null): ICache + public function getCache(string $path = '', ?IStorage $storage = null): ICache { } - public function getOwner($path): string|false + public function getOwner(string $path): string|false { } - public function getWatcher($path = '', $storage = null): IWatcher + public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { } - public function getETag($path): string|false + public function getETag(string $path): string|false { } - public function getMetaData($path): ?array + public function getMetaData(string $path): ?array { } - public function acquireLock($path, $type, ILockingProvider $provider): void + public function acquireLock(string $path, int $type, ILockingProvider $provider): void { } - public function releaseLock($path, $type, ILockingProvider $provider): void + public function releaseLock(string $path, int $type, ILockingProvider $provider): void { } - public function changeLock($path, $type, ILockingProvider $provider): void + public function changeLock(string $path, int $type, ILockingProvider $provider): void { } /** * Resolve the path for the source of the share - * - * @param string $path */ - public function resolvePath($path): array + public function resolvePath(string $path): array { } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function getPropagator($storage = null): IPropagator + public function getPropagator(?IStorage $storage = null): IPropagator { } @@ -228,7 +226,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int { } - public function getDirectoryContent($directory): \Traversable + public function getDirectoryContent(string $directory): \Traversable { } } diff --git a/tests/stubs/oc_files_storage_wrapper_permissionsmask.php b/tests/stubs/oc_files_storage_wrapper_permissionsmask.php index 59a780821..467cb6765 100644 --- a/tests/stubs/oc_files_storage_wrapper_permissionsmask.php +++ b/tests/stubs/oc_files_storage_wrapper_permissionsmask.php @@ -9,6 +9,7 @@ use OC\Files\Cache\Wrapper\CachePermissionsMask; use OCP\Constants; +use OCP\Files\Storage\IStorage; /** * Mask the permissions of a storage @@ -28,71 +29,71 @@ public function __construct($arguments) { } - public function isUpdatable($path): bool + public function isUpdatable(string $path): bool { } - public function isCreatable($path): bool + public function isCreatable(string $path): bool { } - public function isDeletable($path): bool + public function isDeletable(string $path): bool { } - public function isSharable($path): bool + public function isSharable(string $path): bool { } - public function getPermissions($path): int + public function getPermissions(string $path): int { } - public function rename($source, $target): bool + public function rename(string $source, string $target): bool { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } - public function touch($path, $mtime = null): bool + public function touch(string $path, ?int $mtime = null): bool { } - public function mkdir($path): bool + public function mkdir(string $path): bool { } - public function rmdir($path): bool + public function rmdir(string $path): bool { } - public function unlink($path): bool + public function unlink(string $path): bool { } - public function file_put_contents($path, $data): int|float|false + public function file_put_contents(string $path, mixed $data): int|float|false { } - public function fopen($path, $mode) + public function fopen(string $path, string $mode) { } - public function getCache($path = '', $storage = null): \OCP\Files\Cache\ICache + public function getCache(string $path = '', ?IStorage $storage = null): \OCP\Files\Cache\ICache { } - public function getMetaData($path): ?array + public function getMetaData(string $path): ?array { } - public function getScanner($path = '', $storage = null): \OCP\Files\Cache\IScanner + public function getScanner(string $path = '', ?IStorage $storage = null): \OCP\Files\Cache\IScanner { } - public function getDirectoryContent($directory): \Traversable + public function getDirectoryContent(string $directory): \Traversable { } } diff --git a/tests/stubs/oc_files_storage_wrapper_quota.php b/tests/stubs/oc_files_storage_wrapper_quota.php index 226cc5e20..8745248ae 100644 --- a/tests/stubs/oc_files_storage_wrapper_quota.php +++ b/tests/stubs/oc_files_storage_wrapper_quota.php @@ -31,43 +31,46 @@ public function getQuota(): int|float { } - /** - * @param string $path - * @param IStorage $storage - */ - protected function getSize($path, $storage = null): int|float + protected function getSize(string $path, ?IStorage $storage = null): int|float { } - public function free_space($path): int|float|false + public function free_space(string $path): int|float|false { } - public function file_put_contents($path, $data): int|float|false + public function file_put_contents(string $path, mixed $data): int|float|false { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } - public function fopen($path, $mode) + public function fopen(string $path, string $mode) + { + } + + /** + * Only apply quota for files, not metadata, trash or others + */ + protected function shouldApplyQuota(string $path): bool { } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function mkdir($path): bool + public function mkdir(string $path): bool { } - public function touch($path, $mtime = null): bool + public function touch(string $path, ?int $mtime = null): bool { } } diff --git a/tests/stubs/oc_files_storage_wrapper_wrapper.php b/tests/stubs/oc_files_storage_wrapper_wrapper.php index 9f5f79038..ad0fcdbff 100644 --- a/tests/stubs/oc_files_storage_wrapper_wrapper.php +++ b/tests/stubs/oc_files_storage_wrapper_wrapper.php @@ -48,139 +48,139 @@ public function getId(): string { } - public function mkdir($path): bool + public function mkdir(string $path): bool { } - public function rmdir($path): bool + public function rmdir(string $path): bool { } - public function opendir($path) + public function opendir(string $path) { } - public function is_dir($path): bool + public function is_dir(string $path): bool { } - public function is_file($path): bool + public function is_file(string $path): bool { } - public function stat($path): array|false + public function stat(string $path): array|false { } - public function filetype($path): string|false + public function filetype(string $path): string|false { } - public function filesize($path): int|float|false + public function filesize(string $path): int|float|false { } - public function isCreatable($path): bool + public function isCreatable(string $path): bool { } - public function isReadable($path): bool + public function isReadable(string $path): bool { } - public function isUpdatable($path): bool + public function isUpdatable(string $path): bool { } - public function isDeletable($path): bool + public function isDeletable(string $path): bool { } - public function isSharable($path): bool + public function isSharable(string $path): bool { } - public function getPermissions($path): int + public function getPermissions(string $path): int { } - public function file_exists($path): bool + public function file_exists(string $path): bool { } - public function filemtime($path): int|false + public function filemtime(string $path): int|false { } - public function file_get_contents($path): string|false + public function file_get_contents(string $path): string|false { } - public function file_put_contents($path, $data): int|float|false + public function file_put_contents(string $path, mixed $data): int|float|false { } - public function unlink($path): bool + public function unlink(string $path): bool { } - public function rename($source, $target): bool + public function rename(string $source, string $target): bool { } - public function copy($source, $target): bool + public function copy(string $source, string $target): bool { } - public function fopen($path, $mode) + public function fopen(string $path, string $mode) { } - public function getMimeType($path): string|false + public function getMimeType(string $path): string|false { } - public function hash($type, $path, $raw = false): string|false + public function hash(string $type, string $path, bool $raw = false): string|false { } - public function free_space($path): int|float|false + public function free_space(string $path): int|float|false { } - public function touch($path, $mtime = null): bool + public function touch(string $path, ?int $mtime = null): bool { } - public function getLocalFile($path): string|false + public function getLocalFile(string $path): string|false { } - public function hasUpdated($path, $time): bool + public function hasUpdated(string $path, int $time): bool { } - public function getCache($path = '', $storage = null): ICache + public function getCache(string $path = '', ?IStorage $storage = null): ICache { } - public function getScanner($path = '', $storage = null): IScanner + public function getScanner(string $path = '', ?IStorage $storage = null): IScanner { } - public function getOwner($path): string|false + public function getOwner(string $path): string|false { } - public function getWatcher($path = '', $storage = null): IWatcher + public function getWatcher(string $path = '', ?IStorage $storage = null): IWatcher { } - public function getPropagator($storage = null): IPropagator + public function getPropagator(?IStorage $storage = null): IPropagator { } - public function getUpdater($storage = null): IUpdater + public function getUpdater(?IStorage $storage = null): IUpdater { } @@ -188,7 +188,7 @@ public function getStorageCache(): \OC\Files\Cache\Storage { } - public function getETag($path): string|false + public function getETag(string $path): string|false { } @@ -200,7 +200,7 @@ public function isLocal(): bool { } - public function instanceOfStorage($class): bool + public function instanceOfStorage(string $class): bool { } @@ -216,15 +216,13 @@ public function getInstanceOfStorage(string $class): ?IStorage /** * Pass any methods custom to specific storage implementations to the wrapped storage * - * @param string $method - * @param array $args * @return mixed */ - public function __call($method, $args) + public function __call(string $method, array $args) { } - public function getDirectDownload($path): array|false + public function getDirectDownload(string $path): array|false { } @@ -232,35 +230,35 @@ public function getAvailability(): array { } - public function setAvailability($isAvailable): void + public function setAvailability(bool $isAvailable): void { } - public function verifyPath($path, $fileName): void + public function verifyPath(string $path, string $fileName): void { } - public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function copyFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool + public function moveFromStorage(IStorage $sourceStorage, string $sourceInternalPath, string $targetInternalPath): bool { } - public function getMetaData($path): ?array + public function getMetaData(string $path): ?array { } - public function acquireLock($path, $type, ILockingProvider $provider): void + public function acquireLock(string $path, int $type, ILockingProvider $provider): void { } - public function releaseLock($path, $type, ILockingProvider $provider): void + public function releaseLock(string $path, int $type, ILockingProvider $provider): void { } - public function changeLock($path, $type, ILockingProvider $provider): void + public function changeLock(string $path, int $type, ILockingProvider $provider): void { } @@ -272,7 +270,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int { } - public function getDirectoryContent($directory): \Traversable + public function getDirectoryContent(string $directory): \Traversable { } diff --git a/tests/stubs/oc_user_user.php b/tests/stubs/oc_user_user.php index 1eccb09aa..c2fcdf7eb 100644 --- a/tests/stubs/oc_user_user.php +++ b/tests/stubs/oc_user_user.php @@ -19,6 +19,8 @@ use OCP\Group\Events\UserRemovedEvent; use OCP\IAvatarManager; use OCP\IConfig; +use OCP\IDBConnection; +use OCP\IGroupManager; use OCP\IImage; use OCP\IURLGenerator; use OCP\IUser; @@ -37,6 +39,8 @@ use OCP\User\Events\UserDeletedEvent; use OCP\User\GetQuotaEvent; use OCP\UserInterface; +use Psr\Log\LoggerInterface; + use function json_decode; use function json_encode; @@ -46,7 +50,7 @@ class User implements IUser { /** @var IAccountManager */ protected $accountManager; - public function __construct(string $uid, ?UserInterface $backend, IEventDispatcher $dispatcher, $emitter = null, ?IConfig $config = null, $urlGenerator = null) + public function __construct(private string $uid, private ?UserInterface $backend, private IEventDispatcher $dispatcher, $emitter = null, ?IConfig $config = null, $urlGenerator = null) { } diff --git a/tests/stubs/symfony_component_console_command_command.php b/tests/stubs/symfony_component_console_command_command.php index c20b9e956..59094f71a 100644 --- a/tests/stubs/symfony_component_console_command_command.php +++ b/tests/stubs/symfony_component_console_command_command.php @@ -15,9 +15,11 @@ use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Completion\CompletionInput; use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Completion\Suggestion; use Symfony\Component\Console\Exception\ExceptionInterface; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\LogicException; +use Symfony\Component\Console\Helper\HelperInterface; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; @@ -39,18 +41,19 @@ class Command /** * @var string|null The default command name + * + * @deprecated since Symfony 6.1, use the AsCommand attribute instead */ protected static $defaultName; /** * @var string|null The default command description + * + * @deprecated since Symfony 6.1, use the AsCommand attribute instead */ protected static $defaultDescription; - /** - * @return string|null - */ - public static function getDefaultName() + public static function getDefaultName(): ?string { } @@ -71,34 +74,38 @@ public function __construct(?string $name = null) * Ignores validation errors. * * This is mainly useful for the help command. + * + * @return void */ public function ignoreValidationErrors() { } + /** + * @return void + */ public function setApplication(?Application $application = null) { } + /** + * @return void + */ public function setHelperSet(HelperSet $helperSet) { } /** * Gets the helper set. - * - * @return HelperSet|null */ - public function getHelperSet() + public function getHelperSet(): ?HelperSet { } /** * Gets the application instance for this command. - * - * @return Application|null */ - public function getApplication() + public function getApplication(): ?Application { } @@ -116,6 +123,8 @@ public function isEnabled() /** * Configures the current command. + * + * @return void */ protected function configure() { @@ -145,6 +154,8 @@ protected function execute(InputInterface $input, OutputInterface $output) * This method is executed before the InputDefinition is validated. * This means that this is the only place where the command can * interactively ask for values of missing required arguments. + * + * @return void */ protected function interact(InputInterface $input, OutputInterface $output) { @@ -159,6 +170,8 @@ protected function interact(InputInterface $input, OutputInterface $output) * * @see InputInterface::bind() * @see InputInterface::validate() + * + * @return void */ protected function initialize(InputInterface $input, OutputInterface $output) { @@ -178,7 +191,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) * @see setCode() * @see execute() */ - public function run(InputInterface $input, OutputInterface $output) + public function run(InputInterface $input, OutputInterface $output): int { } @@ -203,7 +216,7 @@ public function complete(CompletionInput $input, CompletionSuggestions $suggesti * * @see execute() */ - public function setCode(callable $code) + public function setCode(callable $code): static { } @@ -216,27 +229,23 @@ public function setCode(callable $code) * * @internal */ - public function mergeApplicationDefinition(bool $mergeArgs = true) + public function mergeApplicationDefinition(bool $mergeArgs = true): void { } /** * Sets an array of argument and option instances. * - * @param array|InputDefinition $definition An array of argument and option instances or a definition instance - * * @return $this */ - public function setDefinition($definition) + public function setDefinition(array|InputDefinition $definition): static { } /** * Gets the InputDefinition attached to this Command. - * - * @return InputDefinition */ - public function getDefinition() + public function getDefinition(): InputDefinition { } @@ -247,39 +256,39 @@ public function getDefinition() * be changed by merging with the application InputDefinition. * * This method is not part of public API and should not be used directly. - * - * @return InputDefinition */ - public function getNativeDefinition() + public function getNativeDefinition(): InputDefinition { } /** * Adds an argument. * - * @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * @param $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL + * @param $default The default value (for InputArgument::OPTIONAL mode only) + * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion * * @return $this * * @throws InvalidArgumentException When argument mode is not valid */ - public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null) + public function addArgument(string $name, ?int $mode = null, string $description = '', mixed $default = null): static { } /** * Adds an option. * - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants - * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) + * @param $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param $mode The option mode: One of the InputOption::VALUE_* constants + * @param $default The default value (must be null for InputOption::VALUE_NONE) + * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion * * @return $this * * @throws InvalidArgumentException If option mode is invalid or incompatible */ - public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null) + public function addOption(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', mixed $default = null): static { } @@ -295,7 +304,7 @@ public function addOption(string $name, $shortcut = null, ?int $mode = null, str * * @throws InvalidArgumentException When the name is invalid */ - public function setName(string $name) + public function setName(string $name): static { } @@ -307,35 +316,30 @@ public function setName(string $name) * * @return $this */ - public function setProcessTitle(string $title) + public function setProcessTitle(string $title): static { } /** * Returns the command name. - * - * @return string|null */ - public function getName() + public function getName(): ?string { } /** * @param bool $hidden Whether or not the command should be hidden from the list of commands - * The default value will be true in Symfony 6.0 * * @return $this - * - * @final since Symfony 5.1 */ - public function setHidden(bool $hidden) + public function setHidden(bool $hidden = true): static { } /** * @return bool whether the command should be publicly shown or not */ - public function isHidden() + public function isHidden(): bool { } @@ -344,16 +348,14 @@ public function isHidden() * * @return $this */ - public function setDescription(string $description) + public function setDescription(string $description): static { } /** * Returns the description for the command. - * - * @return string */ - public function getDescription() + public function getDescription(): string { } @@ -362,26 +364,22 @@ public function getDescription() * * @return $this */ - public function setHelp(string $help) + public function setHelp(string $help): static { } /** * Returns the help for the command. - * - * @return string */ - public function getHelp() + public function getHelp(): string { } /** * Returns the processed help for the command replacing the %command.name% and * %command.full_name% patterns with the real values dynamically. - * - * @return string */ - public function getProcessedHelp() + public function getProcessedHelp(): string { } @@ -394,16 +392,14 @@ public function getProcessedHelp() * * @throws InvalidArgumentException When an alias is invalid */ - public function setAliases(iterable $aliases) + public function setAliases(iterable $aliases): static { } /** * Returns the aliases for the command. - * - * @return array */ - public function getAliases() + public function getAliases(): array { } @@ -411,10 +407,8 @@ public function getAliases() * Returns the synopsis for the command. * * @param bool $short Whether to show the short version of the synopsis (with options folded) or not - * - * @return string */ - public function getSynopsis(bool $short = false) + public function getSynopsis(bool $short = false): string { } @@ -423,28 +417,26 @@ public function getSynopsis(bool $short = false) * * @return $this */ - public function addUsage(string $usage) + public function addUsage(string $usage): static { } /** * Returns alternative usages of the command. - * - * @return array */ - public function getUsages() + public function getUsages(): array { } /** * Gets a helper instance by name. * - * @return mixed + * @return HelperInterface * * @throws LogicException if no HelperSet is defined * @throws InvalidArgumentException if the helper is not defined */ - public function getHelper(string $name) + public function getHelper(string $name): mixed { } } diff --git a/tests/stubs/symfony_component_console_helper_table.php b/tests/stubs/symfony_component_console_helper_table.php index 5937ca7fc..373b3ffff 100644 --- a/tests/stubs/symfony_component_console_helper_table.php +++ b/tests/stubs/symfony_component_console_helper_table.php @@ -35,6 +35,9 @@ class Table private const SEPARATOR_BOTTOM = 3; private const BORDER_OUTSIDE = 0; private const BORDER_INSIDE = 1; + private const DISPLAY_ORIENTATION_DEFAULT = 'default'; + private const DISPLAY_ORIENTATION_HORIZONTAL = 'horizontal'; + private const DISPLAY_ORIENTATION_VERTICAL = 'vertical'; public function __construct(OutputInterface $output) { @@ -42,6 +45,8 @@ public function __construct(OutputInterface $output) /** * Sets a style definition. + * + * @return void */ public static function setStyleDefinition(string $name, TableStyle $style) { @@ -49,30 +54,24 @@ public static function setStyleDefinition(string $name, TableStyle $style) /** * Gets a style definition by name. - * - * @return TableStyle */ - public static function getStyleDefinition(string $name) + public static function getStyleDefinition(string $name): TableStyle { } /** * Sets table style. * - * @param TableStyle|string $name The style name or a TableStyle instance - * * @return $this */ - public function setStyle($name) + public function setStyle(TableStyle|string $name): static { } /** * Gets the current table style. - * - * @return TableStyle */ - public function getStyle() + public function getStyle(): TableStyle { } @@ -83,7 +82,7 @@ public function getStyle() * * @return $this */ - public function setColumnStyle(int $columnIndex, $name) + public function setColumnStyle(int $columnIndex, TableStyle|string $name): static { } @@ -91,10 +90,8 @@ public function setColumnStyle(int $columnIndex, $name) * Gets the current style for a column. * * If style was not set, it returns the global table style. - * - * @return TableStyle */ - public function getColumnStyle(int $columnIndex) + public function getColumnStyle(int $columnIndex): TableStyle { } @@ -103,7 +100,7 @@ public function getColumnStyle(int $columnIndex) * * @return $this */ - public function setColumnWidth(int $columnIndex, int $width) + public function setColumnWidth(int $columnIndex, int $width): static { } @@ -112,7 +109,7 @@ public function setColumnWidth(int $columnIndex, int $width) * * @return $this */ - public function setColumnWidths(array $widths) + public function setColumnWidths(array $widths): static { } @@ -124,17 +121,20 @@ public function setColumnWidths(array $widths) * * @return $this */ - public function setColumnMaxWidth(int $columnIndex, int $width): self + public function setColumnMaxWidth(int $columnIndex, int $width): static { } /** * @return $this */ - public function setHeaders(array $headers) + public function setHeaders(array $headers): static { } + /** + * @return $this + */ public function setRows(array $rows) { } @@ -142,14 +142,14 @@ public function setRows(array $rows) /** * @return $this */ - public function addRows(array $rows) + public function addRows(array $rows): static { } /** * @return $this */ - public function addRow($row) + public function addRow(TableSeparator|array $row): static { } @@ -158,35 +158,42 @@ public function addRow($row) * * @return $this */ - public function appendRow($row): self + public function appendRow(TableSeparator|array $row): static + { + } + + /** + * @return $this + */ + public function setRow(int|string $column, array $row): static { } /** * @return $this */ - public function setRow($column, array $row) + public function setHeaderTitle(?string $title): static { } /** * @return $this */ - public function setHeaderTitle(?string $title): self + public function setFooterTitle(?string $title): static { } /** * @return $this */ - public function setFooterTitle(?string $title): self + public function setHorizontal(bool $horizontal = true): static { } /** * @return $this */ - public function setHorizontal(bool $horizontal = true): self + public function setVertical(bool $vertical = true): static { } @@ -202,6 +209,8 @@ public function setHorizontal(bool $horizontal = true): self * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | * +---------------+-----------------------+------------------+ + * + * @return void */ public function render() { diff --git a/tests/stubs/symfony_component_console_input_inputargument.php b/tests/stubs/symfony_component_console_input_inputargument.php index 883a94cb4..8a106813a 100644 --- a/tests/stubs/symfony_component_console_input_inputargument.php +++ b/tests/stubs/symfony_component_console_input_inputargument.php @@ -11,6 +11,10 @@ namespace Symfony\Component\Console\Input; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Completion\Suggestion; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\LogicException; @@ -26,23 +30,22 @@ class InputArgument public const IS_ARRAY = 4; /** - * @param string $name The argument name - * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY - * @param string $description A description text - * @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY + * @param string $description A description text + * @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only) + * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion * * @throws InvalidArgumentException When argument mode is not valid */ - public function __construct(string $name, ?int $mode = null, string $description = '', $default = null) + public function __construct(string $name, ?int $mode = null, string $description = '', string|bool|int|float|array|null $default = null, \Closure|array $suggestedValues = []) { } /** * Returns the argument name. - * - * @return string */ - public function getName() + public function getName(): string { } @@ -51,7 +54,7 @@ public function getName() * * @return bool true if parameter mode is self::REQUIRED, false otherwise */ - public function isRequired() + public function isRequired(): bool { } @@ -60,36 +63,45 @@ public function isRequired() * * @return bool true if mode is self::IS_ARRAY, false otherwise */ - public function isArray() + public function isArray(): bool { } /** * Sets the default value. * - * @param string|bool|int|float|array|null $default + * @return void * * @throws LogicException When incorrect default value is given */ - public function setDefault($default = null) + public function setDefault(string|bool|int|float|array|null $default = null) { } /** * Returns the default value. + */ + public function getDefault(): string|bool|int|float|array|null + { + } + + public function hasCompletion(): bool + { + } + + /** + * Adds suggestions to $suggestions for the current completion input. * - * @return string|bool|int|float|array|null + * @see Command::complete() */ - public function getDefault() + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { } /** * Returns the description text. - * - * @return string */ - public function getDescription() + public function getDescription(): string { } } diff --git a/tests/stubs/symfony_component_console_input_inputinterface.php b/tests/stubs/symfony_component_console_input_inputinterface.php index 8e693e352..352937c62 100644 --- a/tests/stubs/symfony_component_console_input_inputinterface.php +++ b/tests/stubs/symfony_component_console_input_inputinterface.php @@ -18,15 +18,16 @@ * InputInterface is the interface implemented by all input classes. * * @author Fabien Potencier + * + * @method string __toString() Returns a stringified representation of the args passed to the command. + * InputArguments MUST be escaped as well as the InputOption values passed to the command. */ interface InputInterface { /** * Returns the first argument from the raw parameters (not parsed). - * - * @return string|null */ - public function getFirstArgument() + public function getFirstArgument(): ?string { } @@ -40,10 +41,8 @@ public function getFirstArgument() * * @param string|array $values The values to look for in the raw parameters (can be an array) * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal - * - * @return bool */ - public function hasParameterOption($values, bool $onlyParams = false) + public function hasParameterOption(string|array $values, bool $onlyParams = false): bool { } @@ -61,13 +60,15 @@ public function hasParameterOption($values, bool $onlyParams = false) * * @return mixed */ - public function getParameterOption($values, $default = false, bool $onlyParams = false) + public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false) { } /** * Binds the current Input instance with the given arguments and options. * + * @return void + * * @throws RuntimeException */ public function bind(InputDefinition $definition) @@ -77,6 +78,8 @@ public function bind(InputDefinition $definition) /** * Validates the input. * + * @return void + * * @throws RuntimeException When not enough arguments are given */ public function validate() @@ -88,7 +91,7 @@ public function validate() * * @return array */ - public function getArguments() + public function getArguments(): array { } @@ -106,20 +109,18 @@ public function getArgument(string $name) /** * Sets an argument value by name. * - * @param mixed $value The argument value + * @return void * * @throws InvalidArgumentException When argument given doesn't exist */ - public function setArgument(string $name, $value) + public function setArgument(string $name, mixed $value) { } /** * Returns true if an InputArgument object exists by name or position. - * - * @return bool */ - public function hasArgument(string $name) + public function hasArgument(string $name): bool { } @@ -128,7 +129,7 @@ public function hasArgument(string $name) * * @return array */ - public function getOptions() + public function getOptions(): array { } @@ -146,34 +147,32 @@ public function getOption(string $name) /** * Sets an option value by name. * - * @param mixed $value The option value + * @return void * * @throws InvalidArgumentException When option given doesn't exist */ - public function setOption(string $name, $value) + public function setOption(string $name, mixed $value) { } /** * Returns true if an InputOption object exists by name. - * - * @return bool */ - public function hasOption(string $name) + public function hasOption(string $name): bool { } /** * Is this input means interactive? - * - * @return bool */ - public function isInteractive() + public function isInteractive(): bool { } /** * Sets the input interactivity. + * + * @return void */ public function setInteractive(bool $interactive) { diff --git a/tests/stubs/symfony_component_console_input_inputoption.php b/tests/stubs/symfony_component_console_input_inputoption.php index 0065acb51..ab5680e57 100644 --- a/tests/stubs/symfony_component_console_input_inputoption.php +++ b/tests/stubs/symfony_component_console_input_inputoption.php @@ -11,6 +11,10 @@ namespace Symfony\Component\Console\Input; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Completion\Suggestion; use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Exception\LogicException; @@ -47,31 +51,28 @@ class InputOption public const VALUE_NEGATABLE = 16; /** - * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int|null $mode The option mode: One of the VALUE_* constants - * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) + * @param array|\Closure(CompletionInput,CompletionSuggestions):list $suggestedValues The values used for input completion * * @throws InvalidArgumentException If option mode is invalid or incompatible */ - public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null) + public function __construct(string $name, string|array|null $shortcut = null, ?int $mode = null, string $description = '', string|bool|int|float|array|null $default = null, array|\Closure $suggestedValues = []) { } /** * Returns the option shortcut. - * - * @return string|null */ - public function getShortcut() + public function getShortcut(): ?string { } /** * Returns the option name. - * - * @return string */ - public function getName() + public function getName(): string { } @@ -80,7 +81,7 @@ public function getName() * * @return bool true if value mode is not self::VALUE_NONE, false otherwise */ - public function acceptValue() + public function acceptValue(): bool { } @@ -89,7 +90,7 @@ public function acceptValue() * * @return bool true if value mode is self::VALUE_REQUIRED, false otherwise */ - public function isValueRequired() + public function isValueRequired(): bool { } @@ -98,7 +99,7 @@ public function isValueRequired() * * @return bool true if value mode is self::VALUE_OPTIONAL, false otherwise */ - public function isValueOptional() + public function isValueOptional(): bool { } @@ -107,7 +108,7 @@ public function isValueOptional() * * @return bool true if mode is self::VALUE_IS_ARRAY, false otherwise */ - public function isArray() + public function isArray(): bool { } @@ -116,36 +117,43 @@ public function isNegatable(): bool } /** - * @param string|bool|int|float|array|null $default + * @return void */ - public function setDefault($default = null) + public function setDefault(string|bool|int|float|array|null $default = null) { } /** * Returns the default value. - * - * @return string|bool|int|float|array|null */ - public function getDefault() + public function getDefault(): string|bool|int|float|array|null { } /** * Returns the description text. + */ + public function getDescription(): string + { + } + + public function hasCompletion(): bool + { + } + + /** + * Adds suggestions to $suggestions for the current completion input. * - * @return string + * @see Command::complete() */ - public function getDescription() + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void { } /** * Checks whether the given option equals this one. - * - * @return bool */ - public function equals(self $option) + public function equals(self $option): bool { } } diff --git a/tests/stubs/symfony_component_console_output_outputinterface.php b/tests/stubs/symfony_component_console_output_outputinterface.php index da0ffce37..f0b0b2f10 100644 --- a/tests/stubs/symfony_component_console_output_outputinterface.php +++ b/tests/stubs/symfony_component_console_output_outputinterface.php @@ -33,26 +33,34 @@ interface OutputInterface /** * Writes a message to the output. * - * @param string|iterable $messages The message as an iterable of strings or a single string - * @param bool $newline Whether to add a newline - * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + * @param bool $newline Whether to add a newline + * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), + * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + * + * @return void */ - public function write($messages, bool $newline = false, int $options = 0) + public function write(string|iterable $messages, bool $newline = false, int $options = 0) { } /** * Writes a message to the output and adds a newline at the end. * - * @param string|iterable $messages The message as an iterable of strings or a single string - * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), + * 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + * + * @return void */ - public function writeln($messages, int $options = 0) + public function writeln(string|iterable $messages, int $options = 0) { } /** * Sets the verbosity of the output. + * + * @param self::VERBOSITY_* $level + * + * @return void */ public function setVerbosity(int $level) { @@ -61,50 +69,44 @@ public function setVerbosity(int $level) /** * Gets the current verbosity of the output. * - * @return int + * @return self::VERBOSITY_* */ - public function getVerbosity() + public function getVerbosity(): int { } /** * Returns whether verbosity is quiet (-q). - * - * @return bool */ - public function isQuiet() + public function isQuiet(): bool { } /** * Returns whether verbosity is verbose (-v). - * - * @return bool */ - public function isVerbose() + public function isVerbose(): bool { } /** * Returns whether verbosity is very verbose (-vv). - * - * @return bool */ - public function isVeryVerbose() + public function isVeryVerbose(): bool { } /** * Returns whether verbosity is debug (-vvv). - * - * @return bool */ - public function isDebug() + public function isDebug(): bool { } /** * Sets the decorated flag. + * + * @return void */ public function setDecorated(bool $decorated) { @@ -112,23 +114,22 @@ public function setDecorated(bool $decorated) /** * Gets the decorated flag. - * - * @return bool */ - public function isDecorated() + public function isDecorated(): bool { } + /** + * @return void + */ public function setFormatter(OutputFormatterInterface $formatter) { } /** * Returns current output formatter instance. - * - * @return OutputFormatterInterface */ - public function getFormatter() + public function getFormatter(): OutputFormatterInterface { } } diff --git a/tests/stubs/symfony_component_console_question_question.php b/tests/stubs/symfony_component_console_question_question.php index b5f9a5168..c04b412b9 100644 --- a/tests/stubs/symfony_component_console_question_question.php +++ b/tests/stubs/symfony_component_console_question_question.php @@ -25,25 +25,21 @@ class Question * @param string $question The question to ask to the user * @param string|bool|int|float|null $default The default answer to return if the user enters nothing */ - public function __construct(string $question, $default = null) + public function __construct(string $question, string|bool|int|float|null $default = null) { } /** * Returns the question. - * - * @return string */ - public function getQuestion() + public function getQuestion(): string { } /** * Returns the default answer. - * - * @return string|bool|int|float|null */ - public function getDefault() + public function getDefault(): string|bool|int|float|null { } @@ -59,16 +55,14 @@ public function isMultiline(): bool * * @return $this */ - public function setMultiline(bool $multiline): self + public function setMultiline(bool $multiline): static { } /** * Returns whether the user response must be hidden. - * - * @return bool */ - public function isHidden() + public function isHidden(): bool { } @@ -79,16 +73,14 @@ public function isHidden() * * @throws LogicException In case the autocompleter is also used */ - public function setHidden(bool $hidden) + public function setHidden(bool $hidden): static { } /** * In case the response cannot be hidden, whether to fallback on non-hidden question or not. - * - * @return bool */ - public function isHiddenFallback() + public function isHiddenFallback(): bool { } @@ -97,16 +89,14 @@ public function isHiddenFallback() * * @return $this */ - public function setHiddenFallback(bool $fallback) + public function setHiddenFallback(bool $fallback): static { } /** * Gets values for the autocompleter. - * - * @return iterable|null */ - public function getAutocompleterValues() + public function getAutocompleterValues(): ?iterable { } @@ -117,7 +107,7 @@ public function getAutocompleterValues() * * @throws LogicException */ - public function setAutocompleterValues(?iterable $values) + public function setAutocompleterValues(?iterable $values): static { } @@ -135,7 +125,7 @@ public function getAutocompleterCallback(): ?callable * * @return $this */ - public function setAutocompleterCallback(?callable $callback = null): self + public function setAutocompleterCallback(?callable $callback = null): static { } @@ -144,16 +134,14 @@ public function setAutocompleterCallback(?callable $callback = null): self * * @return $this */ - public function setValidator(?callable $validator = null) + public function setValidator(?callable $validator = null): static { } /** * Gets the validator for the question. - * - * @return callable|null */ - public function getValidator() + public function getValidator(): ?callable { } @@ -166,7 +154,7 @@ public function getValidator() * * @throws InvalidArgumentException in case the number of attempts is invalid */ - public function setMaxAttempts(?int $attempts) + public function setMaxAttempts(?int $attempts): static { } @@ -174,10 +162,8 @@ public function setMaxAttempts(?int $attempts) * Gets the maximum number of attempts. * * Null means an unlimited number of attempts. - * - * @return int|null */ - public function getMaxAttempts() + public function getMaxAttempts(): ?int { } @@ -188,7 +174,7 @@ public function getMaxAttempts() * * @return $this */ - public function setNormalizer(callable $normalizer) + public function setNormalizer(callable $normalizer): static { } @@ -196,13 +182,14 @@ public function setNormalizer(callable $normalizer) * Gets the normalizer for the response. * * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. - * - * @return callable|null */ - public function getNormalizer() + public function getNormalizer(): ?callable { } + /** + * @return bool + */ protected function isAssoc(array $array) { } @@ -214,7 +201,7 @@ public function isTrimmable(): bool /** * @return $this */ - public function setTrimmable(bool $trimmable): self + public function setTrimmable(bool $trimmable): static { } } diff --git a/tests/stubs/test_traits_usertrait.php b/tests/stubs/test_traits_usertrait.php index 365813948..3c8f511a2 100644 --- a/tests/stubs/test_traits_usertrait.php +++ b/tests/stubs/test_traits_usertrait.php @@ -8,13 +8,16 @@ namespace Test\Traits; use OC\User\User; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IUser; +use OCP\Server; class DummyUser extends User { private string $uid; public function __construct(string $uid) { $this->uid = $uid; + parent::__construct($uid, null, Server::get(IEventDispatcher::class)); } public function getUID(): string {