diff --git a/apps/dav/lib/Settings/AvailabilitySettings.php b/apps/dav/lib/Settings/AvailabilitySettings.php index 37d30eb57e0..092c2a2db4f 100644 --- a/apps/dav/lib/Settings/AvailabilitySettings.php +++ b/apps/dav/lib/Settings/AvailabilitySettings.php @@ -17,6 +17,7 @@ use OCP\AppFramework\Services\IInitialState; use OCP\IConfig; use OCP\Settings\ISettings; use OCP\User\IAvailabilityCoordinator; +use OCP\Util; use Psr\Log\LoggerInterface; class AvailabilitySettings implements ISettings { @@ -56,8 +57,8 @@ class AvailabilitySettings implements ISettings { } } - \OCP\Util::addStyle(Application::APP_ID, 'settings-personal-availability'); - \OCP\Util::addScript(Application::APP_ID, 'settings-personal-availability'); + Util::addStyle(Application::APP_ID, 'settings-personal-availability'); + Util::addScript(Application::APP_ID, 'settings-personal-availability'); return new TemplateResponse(Application::APP_ID, 'settings-personal-availability'); } diff --git a/apps/dav/lib/Settings/CalDAVSettings.php b/apps/dav/lib/Settings/CalDAVSettings.php index 9b71a002538..da48ae5db1b 100644 --- a/apps/dav/lib/Settings/CalDAVSettings.php +++ b/apps/dav/lib/Settings/CalDAVSettings.php @@ -13,6 +13,7 @@ use OCP\AppFramework\Services\IInitialState; use OCP\IConfig; use OCP\IURLGenerator; use OCP\Settings\IDelegatedSettings; +use OCP\Util; class CalDAVSettings implements IDelegatedSettings { @@ -45,8 +46,8 @@ class CalDAVSettings implements IDelegatedSettings { $this->initialState->provideInitialState($key, $value === 'yes'); } - \OCP\Util::addScript(Application::APP_ID, 'settings-admin-caldav'); - \OCP\Util::addStyle(Application::APP_ID, 'settings-admin-caldav'); + Util::addScript(Application::APP_ID, 'settings-admin-caldav'); + Util::addStyle(Application::APP_ID, 'settings-admin-caldav'); return new TemplateResponse(Application::APP_ID, 'settings-admin-caldav'); } diff --git a/apps/dav/lib/Settings/ExampleContentSettings.php b/apps/dav/lib/Settings/ExampleContentSettings.php index a4018ff94b0..c158ce1f13c 100644 --- a/apps/dav/lib/Settings/ExampleContentSettings.php +++ b/apps/dav/lib/Settings/ExampleContentSettings.php @@ -16,6 +16,7 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Services\IInitialState; use OCP\Settings\ISettings; +use OCP\Util; class ExampleContentSettings implements ISettings { public function __construct( @@ -53,8 +54,8 @@ class ExampleContentSettings implements ISettings { ); } - \OCP\Util::addStyle(Application::APP_ID, 'settings-admin-example-content'); - \OCP\Util::addScript(Application::APP_ID, 'settings-admin-example-content'); + Util::addStyle(Application::APP_ID, 'settings-admin-example-content'); + Util::addScript(Application::APP_ID, 'settings-admin-example-content'); return new TemplateResponse(Application::APP_ID, 'settings-admin-example-content'); } diff --git a/apps/dav/tests/unit/Paginate/PaginatePluginTest.php b/apps/dav/tests/unit/Paginate/PaginatePluginTest.php index 2f93b27044d..8d3d4cc9f78 100644 --- a/apps/dav/tests/unit/Paginate/PaginatePluginTest.php +++ b/apps/dav/tests/unit/Paginate/PaginatePluginTest.php @@ -134,7 +134,7 @@ class PaginatePluginTest extends TestCase { private function expectSequentialCalls(MockObject $mock, string $method, array $expectedCalls): void { $mock->expects(self::exactly(\count($expectedCalls))) ->method($method) - ->willReturnCallback(function (...$args) use (&$expectedCalls) { + ->willReturnCallback(function (...$args) use (&$expectedCalls): void { $expected = array_shift($expectedCalls); self::assertNotNull($expected); self::assertSame($expected, $args); diff --git a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php index 30a946c7847..93c9d6e817d 100644 --- a/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareAPIControllerTest.php @@ -5529,8 +5529,8 @@ class ShareAPIControllerTest extends TestCase { $owner = $this->createMock(IUser::class); $storage = $this->createMock(SharedStorage::class); $originalShare = $this->createMock(IShare::class); - $attributes = $this->createMock(\OCP\Share\IAttributes::class); - $shareAttributes = $this->createMock(\OCP\Share\IAttributes::class); + $attributes = $this->createMock(IShareAttributes::class); + $shareAttributes = $this->createMock(IShareAttributes::class); $share->method('getSharedBy')->willReturn('sharedByUser'); $share->method('getNodeId')->willReturn(42); @@ -5565,7 +5565,7 @@ class ShareAPIControllerTest extends TestCase { $node = $this->createMock(File::class); $userFolder = $this->createMock(Folder::class); $owner = $this->createMock(IUser::class); - $storage = $this->createMock(\OCA\Files_Sharing\External\Storage::class); + $storage = $this->createMock(Storage::class); $share->method('getSharedBy')->willReturn('sharedByUser'); $share->method('getNodeId')->willReturn(42); @@ -5575,7 +5575,7 @@ class ShareAPIControllerTest extends TestCase { $node->method('getStorage')->willReturn($storage); $storage->method('instanceOfStorage')->willReturnMap([ [SharedStorage::class, false], - [\OCA\Files_Sharing\External\Storage::class, true] + [Storage::class, true] ]); $userFolder->method('getById')->with(42)->willReturn([$node]); diff --git a/apps/settings/tests/Command/AdminDelegation/AddTest.php b/apps/settings/tests/Command/AdminDelegation/AddTest.php index 9332bf69aca..883da1323b9 100644 --- a/apps/settings/tests/Command/AdminDelegation/AddTest.php +++ b/apps/settings/tests/Command/AdminDelegation/AddTest.php @@ -11,6 +11,7 @@ namespace OCA\Settings\Tests\Command\AdminDelegation; use OC\Settings\AuthorizedGroup; use OCA\Settings\Command\AdminDelegation\Add; use OCA\Settings\Service\AuthorizedGroupService; +use OCA\Settings\Settings\Admin\Server; use OCP\IGroupManager; use OCP\Settings\IManager; use PHPUnit\Framework\MockObject\MockObject; @@ -45,7 +46,7 @@ class AddTest extends TestCase { } public function testExecuteSuccessfulDelegation(): void { - $settingClass = \OCA\Settings\Settings\Admin\Server::class; + $settingClass = Server::class; $groupId = 'testgroup'; // Mock valid delegated settings class @@ -93,7 +94,7 @@ class AddTest extends TestCase { } public function testExecuteNonExistentGroup(): void { - $settingClass = \OCA\Settings\Settings\Admin\Server::class; + $settingClass = Server::class; $groupId = 'nonexistentgroup'; $this->input->expects($this->exactly(2)) diff --git a/apps/sharebymail/lib/Settings/Admin.php b/apps/sharebymail/lib/Settings/Admin.php index af0526e80dc..48592e74ff6 100644 --- a/apps/sharebymail/lib/Settings/Admin.php +++ b/apps/sharebymail/lib/Settings/Admin.php @@ -10,6 +10,7 @@ use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\IL10N; use OCP\Settings\IDelegatedSettings; +use OCP\Util; class Admin implements IDelegatedSettings { public function __construct( @@ -26,8 +27,8 @@ class Admin implements IDelegatedSettings { $this->initialState->provideInitialState('sendPasswordMail', $this->settingsManager->sendPasswordByMail()); $this->initialState->provideInitialState('replyToInitiator', $this->settingsManager->replyToInitiator()); - \OCP\Util::addStyle('sharebymail', 'admin-settings'); - \OCP\Util::addScript('sharebymail', 'admin-settings'); + Util::addStyle('sharebymail', 'admin-settings'); + Util::addScript('sharebymail', 'admin-settings'); return new TemplateResponse('sharebymail', 'settings-admin', [], ''); } diff --git a/apps/twofactor_backupcodes/lib/Settings/Personal.php b/apps/twofactor_backupcodes/lib/Settings/Personal.php index c9405b59b62..77b3b447b48 100644 --- a/apps/twofactor_backupcodes/lib/Settings/Personal.php +++ b/apps/twofactor_backupcodes/lib/Settings/Personal.php @@ -14,11 +14,12 @@ use OCP\Authentication\TwoFactorAuth\IPersonalProviderSettings; use OCP\Server; use OCP\Template\ITemplate; use OCP\Template\ITemplateManager; +use OCP\Util; class Personal implements IPersonalProviderSettings { public function getBody(): ITemplate { - \OCP\Util::addScript(Application::APP_ID, 'settings-personal'); - \OCP\Util::addStyle(Application::APP_ID, 'settings-personal'); + Util::addScript(Application::APP_ID, 'settings-personal'); + Util::addStyle(Application::APP_ID, 'settings-personal'); return Server::get(ITemplateManager::class) ->getTemplate('twofactor_backupcodes', 'personal'); } diff --git a/core/Controller/OCMController.php b/core/Controller/OCMController.php index 851f2c1635a..9ad45ea9d8f 100644 --- a/core/Controller/OCMController.php +++ b/core/Controller/OCMController.php @@ -20,7 +20,6 @@ use OCP\AppFramework\Http\Attribute\PublicPage; use OCP\AppFramework\Http\DataResponse; use OCP\IAppConfig; use OCP\IRequest; -use OCP\Server; use Psr\Log\LoggerInterface; /** diff --git a/core/Listener/PasswordUpdatedListener.php b/core/Listener/PasswordUpdatedListener.php index b88abc06729..4830c767442 100644 --- a/core/Listener/PasswordUpdatedListener.php +++ b/core/Listener/PasswordUpdatedListener.php @@ -19,7 +19,7 @@ use OCP\User\Events\PasswordUpdatedEvent; */ class PasswordUpdatedListener implements IEventListener { public function __construct( - readonly private IVerificationToken $verificationToken, + private readonly IVerificationToken $verificationToken, ) { } diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php index a9aa48a6c21..be701f3da53 100644 --- a/lib/private/AppConfig.php +++ b/lib/private/AppConfig.php @@ -82,7 +82,7 @@ class AppConfig implements IAppConfig { private readonly PresetManager $presetManager, protected LoggerInterface $logger, protected ICrypto $crypto, - readonly CacheFactory $cacheFactory, + public readonly CacheFactory $cacheFactory, ) { if ($config->getSystemValueBool('cache_app_config', true) && $cacheFactory->isLocalCacheAvailable()) { $cacheFactory->withServerVersionPrefix(function (ICacheFactory $factory) { diff --git a/lib/private/Preview/BackgroundCleanupJob.php b/lib/private/Preview/BackgroundCleanupJob.php index f6122fd0e12..70579d3b9d1 100644 --- a/lib/private/Preview/BackgroundCleanupJob.php +++ b/lib/private/Preview/BackgroundCleanupJob.php @@ -22,9 +22,9 @@ class BackgroundCleanupJob extends TimedJob { public function __construct( ITimeFactory $timeFactory, - readonly private IDBConnection $connection, - readonly private PreviewService $previewService, - readonly private bool $isCLI, + private readonly IDBConnection $connection, + private readonly PreviewService $previewService, + private readonly bool $isCLI, ) { parent::__construct($timeFactory); // Run at most once an hour diff --git a/lib/private/Preview/Storage/ObjectStorePreviewStorage.php b/lib/private/Preview/Storage/ObjectStorePreviewStorage.php index 7eab3985eac..713d39f9b0b 100644 --- a/lib/private/Preview/Storage/ObjectStorePreviewStorage.php +++ b/lib/private/Preview/Storage/ObjectStorePreviewStorage.php @@ -36,7 +36,7 @@ class ObjectStorePreviewStorage implements IPreviewStorage { public function __construct( private readonly PrimaryObjectStoreConfig $objectStoreConfig, IConfig $config, - readonly private PreviewMapper $previewMapper, + private readonly PreviewMapper $previewMapper, ) { $this->isMultibucketPreviewDistributionEnabled = $config->getSystemValueBool('objectstore.multibucket.preview-distribution'); } diff --git a/tests/lib/Collaboration/Collaborators/MailPluginTest.php b/tests/lib/Collaboration/Collaborators/MailPluginTest.php index e6580854784..9672bbfcd6b 100644 --- a/tests/lib/Collaboration/Collaborators/MailPluginTest.php +++ b/tests/lib/Collaboration/Collaborators/MailPluginTest.php @@ -1021,7 +1021,7 @@ class MailPluginTest extends TestCase { $this->instantiatePlugin(IShare::TYPE_USER); - /** @var \OCP\IUser | \PHPUnit\Framework\MockObject\MockObject */ + /** @var IUser|\PHPUnit\Framework\MockObject\MockObject */ $currentUser = $this->createMock('\OCP\IUser'); $currentUser->expects($this->any()) @@ -1043,7 +1043,7 @@ class MailPluginTest extends TestCase { $this->groupManager->expects($this->any()) ->method('getUserGroupIds') - ->willReturnCallback(function (\OCP\IUser $user) use ($userToGroupMapping) { + ->willReturnCallback(function (IUser $user) use ($userToGroupMapping) { return $userToGroupMapping[$user->getUID()]; }); diff --git a/tests/lib/Files/Template/TemplateManagerTest.php b/tests/lib/Files/Template/TemplateManagerTest.php index fcd7ca1aa92..be65657aba9 100644 --- a/tests/lib/Files/Template/TemplateManagerTest.php +++ b/tests/lib/Files/Template/TemplateManagerTest.php @@ -13,6 +13,7 @@ use OC\AppFramework\Bootstrap\Coordinator; use OC\AppFramework\Bootstrap\RegistrationContext; use OC\Files\FilenameValidator; use OC\Files\Template\TemplateManager; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Folder; use OCP\Files\GenericFileException; use OCP\Files\IRootFolder; @@ -21,6 +22,9 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; use OCP\IPreview; +use OCP\IServerContainer; +use OCP\IUserManager; +use OCP\IUserSession; use OCP\L10N\IFactory; use Psr\Log\NullLogger; use Test\TestCase; @@ -53,14 +57,14 @@ class TemplateManagerTest extends TestCase { $logger, ); - $serverContainer = $this->createMock(\OCP\IServerContainer::class); - $eventDispatcher = $this->createMock(\OCP\EventDispatcher\IEventDispatcher::class); + $serverContainer = $this->createMock(IServerContainer::class); + $eventDispatcher = $this->createMock(IEventDispatcher::class); $this->bootstrapCoordinator = $this->createMock(Coordinator::class); $this->bootstrapCoordinator->method('getRegistrationContext') ->willReturn(new RegistrationContext($logger)); $this->rootFolder = $this->createMock(IRootFolder::class); - $userSession = $this->createMock(\OCP\IUserSession::class); - $userManager = $this->createMock(\OCP\IUserManager::class); + $userSession = $this->createMock(IUserSession::class); + $userManager = $this->createMock(IUserManager::class); $previewManager = $this->createMock(IPreview::class); $this->templateManager = new TemplateManager(