diff --git a/apps/comments/lib/Search/Result.php b/apps/comments/lib/Search/Result.php index 13907757954..2931ff4113b 100644 --- a/apps/comments/lib/Search/Result.php +++ b/apps/comments/lib/Search/Result.php @@ -34,10 +34,6 @@ class Result extends BaseResult { * @deprecated 20.0.0 */ public $fileName; - /** - * @deprecated 20.0.0 - */ - public int $fileId; /** * @throws NotFoundException @@ -51,7 +47,10 @@ class Result extends BaseResult { */ public string $authorName, string $path, - int $fileId, + /** + * @deprecated 20.0.0 + */ + public int $fileId, ) { parent::__construct( $comment->getId(), @@ -63,7 +62,6 @@ class Result extends BaseResult { $this->authorId = $comment->getActorId(); $this->fileName = basename($path); $this->path = $this->getVisiblePath($path); - $this->fileId = $fileId; } /** diff --git a/apps/dav/appinfo/v1/caldav.php b/apps/dav/appinfo/v1/caldav.php index ff66274909d..6cfb712984f 100644 --- a/apps/dav/appinfo/v1/caldav.php +++ b/apps/dav/appinfo/v1/caldav.php @@ -24,6 +24,7 @@ use OCA\DAV\Connector\Sabre\Principal; use OCP\Accounts\IAccountManager; use OCP\App\IAppManager; use OCP\EventDispatcher\IEventDispatcher; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IDBConnection; use OCP\IGroupManager; @@ -78,7 +79,7 @@ $calDavBackend = new CalDavBackend( $config, Server::get(\OCA\DAV\CalDAV\Sharing\Backend::class), Server::get(FederatedCalendarMapper::class), - Server::get(\OCP\ICacheFactory::class), + Server::get(ICacheFactory::class), true ); diff --git a/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php b/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php index de5f5b987d2..05d9ea9d6ec 100644 --- a/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php +++ b/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php @@ -11,6 +11,7 @@ namespace OCA\DAV\CalDAV\Federation; use OCA\DAV\BackgroundJob\FederatedCalendarSyncJob; use OCA\DAV\CalDAV\Federation\Protocol\CalendarFederationProtocolV1; +use OCA\DAV\CalDAV\Federation\Protocol\CalendarProtocolParseException; use OCA\DAV\CalDAV\Federation\Protocol\ICalendarFederationProtocol; use OCA\DAV\DAV\Sharing\Backend as DavSharingBackend; use OCP\AppFramework\Http; @@ -74,7 +75,7 @@ class CalendarFederationProvider implements ICloudFederationProvider { case CalendarFederationProtocolV1::VERSION: try { $protocol = CalendarFederationProtocolV1::parse($rawProtocol); - } catch (Protocol\CalendarProtocolParseException $e) { + } catch (CalendarProtocolParseException $e) { throw new ProviderCouldNotAddShareException( 'Invalid protocol data (v1)', '', diff --git a/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php b/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php index ec9874427ba..20fbd0194ce 100644 --- a/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php +++ b/apps/dav/lib/DAV/RemoteUserPrincipalBackend.php @@ -10,6 +10,7 @@ declare(strict_types=1); namespace OCA\DAV\DAV; use OCA\DAV\DAV\Sharing\SharingMapper; +use OCP\Federation\ICloudId; use OCP\Federation\ICloudIdManager; use Sabre\DAVACL\PrincipalBackend\BackendInterface; @@ -102,7 +103,7 @@ class RemoteUserPrincipalBackend implements BackendInterface { } /** - * @return array{'{DAV:}displayname': string, '{http://nextcloud.com/ns}cloud-id': \OCP\Federation\ICloudId, uri: string} + * @return array{'{DAV:}displayname': string, '{http://nextcloud.com/ns}cloud-id': ICloudId, uri: string} */ private function principalUriToPrincipal(string $principalUri): array { [, $name] = \Sabre\Uri\split($principalUri); diff --git a/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php b/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php index 9d22befa201..60b162116cd 100644 --- a/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php +++ b/apps/dav/tests/unit/Connector/Sabre/PropFindMonitorPluginTest.php @@ -105,9 +105,7 @@ class PropFindMonitorPluginTest extends TestCase { ]; } - /** - * @dataProvider dataTest - */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataTest')] public function test(array $queries, $expectedLogCalls): void { $this->plugin->initialize($this->server); $this->server->expects($this->once())->method('getPluginQueries') diff --git a/apps/files_sharing/tests/ApiTest.php b/apps/files_sharing/tests/ApiTest.php index 960f29224bb..abb72793bc0 100644 --- a/apps/files_sharing/tests/ApiTest.php +++ b/apps/files_sharing/tests/ApiTest.php @@ -240,8 +240,8 @@ class ApiTest extends TestCase { /** * @group RoutingWeirdness - * @dataProvider dataAllowFederationOnPublicShares */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')] public function testCreateShareLinkPublicUpload(array $appConfig, int $permissions): void { $this->appConfig->method('getValueBool') ->willReturnMap([$appConfig]); @@ -1016,8 +1016,8 @@ class ApiTest extends TestCase { /** * @medium - * @dataProvider dataAllowFederationOnPublicShares */ + #[\PHPUnit\Framework\Attributes\DataProvider('dataAllowFederationOnPublicShares')] public function testUpdateShareUpload(array $appConfig, int $permissions): void { $this->appConfig->method('getValueBool')->willReturnMap([ $appConfig, diff --git a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php index bbdf0b899bd..9a2186d79a4 100644 --- a/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php +++ b/apps/files_trashbin/lib/BackgroundJob/ExpireTrash.php @@ -19,6 +19,7 @@ use OCP\IAppConfig; use OCP\IUser; use OCP\IUserManager; use OCP\Lock\ILockingProvider; +use OCP\Lock\LockedException; use Psr\Log\LoggerInterface; class ExpireTrash extends TimedJob { @@ -111,7 +112,7 @@ class ExpireTrash extends TimedJob { } private function resetOffset() { - $this->runMutexOperation(function () { + $this->runMutexOperation(function (): void { $this->appConfig->setValueInt(Application::APP_ID, self::OFFSET_CONFIG_KEY_NAME, 0); }); } @@ -123,7 +124,7 @@ class ExpireTrash extends TimedJob { try { $this->lockingProvider->acquireLock(self::OFFSET_CONFIG_KEY_NAME, ILockingProvider::LOCK_EXCLUSIVE, 'Expire trashbin background job offset'); $acquired = true; - } catch (\OCP\Lock\LockedException $e) { + } catch (LockedException $e) { // wait a bit and try again usleep(100000); } diff --git a/apps/files_trashbin/tests/Command/ExpireTrashTest.php b/apps/files_trashbin/tests/Command/ExpireTrashTest.php index 0d0ee98ca7a..edad8bfbd95 100644 --- a/apps/files_trashbin/tests/Command/ExpireTrashTest.php +++ b/apps/files_trashbin/tests/Command/ExpireTrashTest.php @@ -64,9 +64,7 @@ class ExpireTrashTest extends TestCase { parent::tearDown(); } - /** - * @dataProvider retentionObligationProvider - */ + #[\PHPUnit\Framework\Attributes\DataProvider('retentionObligationProvider')] public function testRetentionObligation(string $obligation, string $quota, int $elapsed, int $fileSize, bool $shouldExpire): void { $this->config->setSystemValues(['trashbin_retention_obligation' => $obligation]); $this->expiration->setRetentionObligation($obligation); diff --git a/build/psalm-baseline.xml b/build/psalm-baseline.xml index 950aaf92acb..8f95f1415a1 100644 --- a/build/psalm-baseline.xml +++ b/build/psalm-baseline.xml @@ -71,8 +71,6 @@ authorId]]> authorId]]> authorId]]> - fileId]]> - fileId]]> name]]> path]]> @@ -111,7 +109,6 @@ authorId]]> comment]]> - fileId]]> fileName]]> path]]> diff --git a/console.php b/console.php index 10de07dd489..b5a000e8873 100644 --- a/console.php +++ b/console.php @@ -3,6 +3,7 @@ declare(strict_types=1); use OCP\IConfig; +use OCP\IURLGenerator; use OCP\Server; /** @@ -100,7 +101,7 @@ try { $profile->setUrl(implode(' ', $argv)); $profiler->saveProfile($profile); - $urlGenerator = Server::get(\OCP\IURLGenerator::class); + $urlGenerator = Server::get(IURLGenerator::class); $url = $urlGenerator->linkToRouteAbsolute('profiler.main.profiler', [ 'profiler' => 'db', 'token' => $profile->getToken(), diff --git a/core/Command/Base.php b/core/Command/Base.php index 8f94c1d473a..138f3ca613b 100644 --- a/core/Command/Base.php +++ b/core/Command/Base.php @@ -8,6 +8,8 @@ namespace OC\Core\Command; use OC\Core\Command\User\ListCommand; +use OCP\Defaults; +use OCP\Server; use Stecman\Component\Symfony\Console\BashCompletion\Completion\CompletionAwareInterface; use Stecman\Component\Symfony\Console\BashCompletion\CompletionContext; use Symfony\Component\Console\Command\Command; @@ -27,7 +29,7 @@ class Base extends Command implements CompletionAwareInterface { protected function configure() { // Some of our commands do not extend this class; and some of those that do do not call parent::configure() - $defaultHelp = 'More extensive and thorough documentation may be found at ' . \OCP\Server::get(\OCP\Defaults::class)->getDocBaseUrl() . PHP_EOL; + $defaultHelp = 'More extensive and thorough documentation may be found at ' . Server::get(Defaults::class)->getDocBaseUrl() . PHP_EOL; $this ->setHelp($defaultHelp) ->addOption( diff --git a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php index a2107a7491f..a1c3ae3d905 100644 --- a/tests/lib/DB/QueryBuilder/QueryBuilderTest.php +++ b/tests/lib/DB/QueryBuilder/QueryBuilderTest.php @@ -189,7 +189,7 @@ class QueryBuilderTest extends \Test\TestCase { array_walk_recursive( $selectArguments, - function (string &$arg) { + function (string &$arg): void { if (\str_starts_with($arg, 'l::')) { $arg = $this->queryBuilder->expr()->literal(substr($arg, 3)); } @@ -357,7 +357,7 @@ class QueryBuilderTest extends \Test\TestCase { array_walk_recursive( $selectArguments, - function (string &$arg) { + function (string &$arg): void { if (\str_starts_with($arg, 'l::')) { $arg = $this->queryBuilder->expr()->literal(substr($arg, 3)); } diff --git a/tests/lib/SystemTag/SystemTagObjectMapperTest.php b/tests/lib/SystemTag/SystemTagObjectMapperTest.php index ed51dd3ffd6..e459b81512d 100644 --- a/tests/lib/SystemTag/SystemTagObjectMapperTest.php +++ b/tests/lib/SystemTag/SystemTagObjectMapperTest.php @@ -212,7 +212,7 @@ class SystemTagObjectMapperTest extends TestCase { public function testAssignUnassignTags(): void { $event = null; - $this->dispatcher->expects($this->any())->method('dispatchTyped')->willReturnCallback(function (Event $e) use (&$event) { + $this->dispatcher->expects($this->any())->method('dispatchTyped')->willReturnCallback(function (Event $e) use (&$event): void { $event = $e; });