diff --git a/composer.lock b/composer.lock index 89dd8304f64..b4a5db09dfe 100644 --- a/composer.lock +++ b/composer.lock @@ -138,16 +138,16 @@ }, { "name": "nextcloud/coding-standard", - "version": "v1.1.1", + "version": "v1.2.1", "source": { "type": "git", "url": "https://github.com/nextcloud/coding-standard.git", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb" + "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/55def702fb9a37a219511e1d8c6fe8e37164c1fb", - "reference": "55def702fb9a37a219511e1d8c6fe8e37164c1fb", + "url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", + "reference": "cf5f18d989ec62fb4cdc7fc92a36baf34b3d829e", "shasum": "" }, "require": { @@ -173,9 +173,9 @@ "description": "Nextcloud coding standards for the php cs fixer", "support": { "issues": "https://github.com/nextcloud/coding-standard/issues", - "source": "https://github.com/nextcloud/coding-standard/tree/v1.1.1" + "source": "https://github.com/nextcloud/coding-standard/tree/v1.2.1" }, - "time": "2023-06-01T12:05:01+00:00" + "time": "2024-02-01T14:54:37+00:00" }, { "name": "nextcloud/ocp", @@ -393,16 +393,16 @@ }, { "name": "php-cs-fixer/shim", - "version": "v3.17.0", + "version": "v3.49.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/shim.git", - "reference": "f51b4aed90565c447136f1d015798f6f7c82490f" + "reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f51b4aed90565c447136f1d015798f6f7c82490f", - "reference": "f51b4aed90565c447136f1d015798f6f7c82490f", + "url": "https://api.github.com/repos/PHP-CS-Fixer/shim/zipball/f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", + "reference": "f7d3219cac46632f12362c9aa7c2ac0d2fe92c52", "shasum": "" }, "require": { @@ -439,9 +439,9 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/PHP-CS-Fixer/shim/issues", - "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.17.0" + "source": "https://github.com/PHP-CS-Fixer/shim/tree/v3.49.0" }, - "time": "2023-05-22T20:00:38+00:00" + "time": "2024-02-02T00:42:09+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/lib/Controller/PublicSessionController.php b/lib/Controller/PublicSessionController.php index 4f01142784d..3d0da080e8c 100644 --- a/lib/Controller/PublicSessionController.php +++ b/lib/Controller/PublicSessionController.php @@ -80,7 +80,7 @@ protected function isPasswordProtected(): bool { #[NoAdminRequired] #[PublicPage] - public function create(string $token, string $file = null, ?string $guestName = null): DataResponse { + public function create(string $token, ?string $file = null, ?string $guestName = null): DataResponse { return $this->apiService->create(null, $file, $token, $guestName); } @@ -107,7 +107,7 @@ public function sync(string $token, int $version = 0): DataResponse { #[NoAdminRequired] #[PublicPage] #[RequireDocumentSession] - public function save(string $token, int $version = 0, string $autosaveContent = null, string $documentState = null, bool $force = false, bool $manualSave = false): DataResponse { + public function save(string $token, int $version = 0, ?string $autosaveContent = null, ?string $documentState = null, bool $force = false, bool $manualSave = false): DataResponse { return $this->apiService->save($this->getSession(), $this->getDocument(), $version, $autosaveContent, $documentState, $force, $manualSave, $token); } diff --git a/lib/Controller/SessionController.php b/lib/Controller/SessionController.php index 9de585d394b..aa935f57879 100644 --- a/lib/Controller/SessionController.php +++ b/lib/Controller/SessionController.php @@ -57,7 +57,7 @@ public function __construct( } #[NoAdminRequired] - public function create(int $fileId = null, string $file = null): DataResponse { + public function create(?int $fileId = null, ?string $file = null): DataResponse { return $this->apiService->create($fileId, $file, null, null); } @@ -94,7 +94,7 @@ public function sync(int $version = 0): DataResponse { #[NoAdminRequired] #[PublicPage] #[RequireDocumentSession] - public function save(int $version = 0, string $autosaveContent = null, string $documentState = null, bool $force = false, bool $manualSave = false): DataResponse { + public function save(int $version = 0, ?string $autosaveContent = null, ?string $documentState = null, bool $force = false, bool $manualSave = false): DataResponse { try { $this->loginSessionUser(); return $this->apiService->save($this->getSession(), $this->getDocument(), $version, $autosaveContent, $documentState, $force, $manualSave); diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index fa3c34e5b8d..d6c8edbe98b 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -26,7 +26,7 @@ namespace OCA\Text\Service; -use \InvalidArgumentException; +use InvalidArgumentException; use OCA\Text\AppInfo\Application; use OCA\Text\Db\Document; use OCA\Text\Db\DocumentMapper; diff --git a/lib/Service/SessionService.php b/lib/Service/SessionService.php index e24204e201d..744b763cbf6 100644 --- a/lib/Service/SessionService.php +++ b/lib/Service/SessionService.php @@ -85,7 +85,7 @@ public function __construct( $this->cache = $cacheFactory->createDistributed('text_sessions'); } - public function initSession(int $documentId, string $guestName = null): Session { + public function initSession(int $documentId, ?string $guestName = null): Session { $session = new Session(); $session->setDocumentId($documentId); $userName = $this->userId ? $this->userId : $guestName; @@ -236,7 +236,7 @@ public function updateSessionAwareness(Session $session, string $message): Sessi return $this->sessionMapper->update($session); } - private function getColorForGuestName(string $guestName = null): string { + private function getColorForGuestName(?string $guestName = null): string { $guestName = $this->userId ?? $guestName; $uniqueGuestId = !empty($guestName) ? $guestName : $this->secureRandom->generate(12); $color = $this->avatarManager->getGuestAvatar($uniqueGuestId)->avatarBackgroundColor($uniqueGuestId); diff --git a/tests/unit/Controller/UserApiControllerTest.php b/tests/unit/Controller/UserApiControllerTest.php index 14db310e38e..9d4c3bfc8ba 100644 --- a/tests/unit/Controller/UserApiControllerTest.php +++ b/tests/unit/Controller/UserApiControllerTest.php @@ -2,11 +2,11 @@ namespace OCA\Text\Controller; -use \OCP\IRequest; use OCA\Text\Db\Session; use OCA\Text\Service\SessionService; use OCP\AppFramework\Http\DataResponse; use OCP\Collaboration\Collaborators\ISearch; +use OCP\IRequest; use OCP\IUserManager; use OCP\IUserSession; use Test\TestCase;