diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index 4c66e9bc59c..2b5094d0d59 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -75,7 +75,7 @@ class ChatManager { private IEventDispatcher $dispatcher; private IDBConnection $connection; private INotificationManager $notificationManager; - private \OCP\Share\IManager $shareManager; + private IManager $shareManager; private RoomShareProvider $shareProvider; private ParticipantService $participantService; private Notifier $notifier; diff --git a/lib/Chat/Command/Executor.php b/lib/Chat/Command/Executor.php index 3a51239c7a1..ed71f517fcf 100644 --- a/lib/Chat/Command/Executor.php +++ b/lib/Chat/Command/Executor.php @@ -115,7 +115,7 @@ public function exec(Room $room, IComment $message, Command $command, string $ar $message->setVerb('command'); } - protected function execHelp(Room $room, IComment $message, string $arguments, Participant $participant): ?string { + protected function execHelp(Room $room, IComment $message, string $arguments, Participant $participant): string { if ($arguments !== '' && $arguments !== 'help') { return $this->execHelpSingleCommand($room, $message, $arguments); } @@ -160,7 +160,7 @@ protected function execHelp(Room $room, IComment $message, string $arguments, Pa return implode("\n", $helps); } - protected function execHelpSingleCommand(Room $room, IComment $message, string $arguments): ?string { + protected function execHelpSingleCommand(Room $room, IComment $message, string $arguments): string { try { $input = explode(' ', $arguments, 2); if (count($input) === 1) { @@ -186,7 +186,7 @@ protected function execHelpSingleCommand(Room $room, IComment $message, string $ } } - protected function execApp(Room $room, IComment $message, Command $command, string $arguments): ?string { + protected function execApp(Room $room, IComment $message, Command $command, string $arguments): string { $event = $this->createEvent($room, $message, $command, $arguments); $this->dispatcher->dispatch(self::EVENT_APP_EXECUTE, $event); return $event->getOutput(); diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 3cd7f436542..3f213a5856f 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -54,8 +54,7 @@ class SystemMessage { protected GuestManager $guestManager; protected IPreviewManager $previewManager; protected RoomShareProvider $shareProvider; - /** @var PhotoCache */ - protected $photoCache; + protected PhotoCache $photoCache; protected IRootFolder $rootFolder; protected IURLGenerator $url; protected ?IL10N $l = null; diff --git a/lib/Chat/ReactionManager.php b/lib/Chat/ReactionManager.php index be97b84e72b..5306f2d88d9 100644 --- a/lib/Chat/ReactionManager.php +++ b/lib/Chat/ReactionManager.php @@ -39,7 +39,7 @@ class ReactionManager { private ChatManager $chatManager; /** @var ICommentsManager|CommentsManager */ - private $commentsManager; + private ICommentsManager $commentsManager; private IL10N $l; private MessageParser $messageParser; private Notifier $notifier; diff --git a/lib/Command/ActiveCalls.php b/lib/Command/ActiveCalls.php index 62905567e8c..a4ddf508d51 100644 --- a/lib/Command/ActiveCalls.php +++ b/lib/Command/ActiveCalls.php @@ -24,16 +24,13 @@ namespace OCA\Talk\Command; use OC\Core\Command\Base; -use OCA\Talk\Manager; use OCA\Talk\Participant; use OCP\IDBConnection; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; class ActiveCalls extends Base { - public IDBConnection $connection; - - public Manager $manager; + protected IDBConnection $connection; public function __construct(IDBConnection $connection) { parent::__construct(); diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index 3ff75dd716f..39149b036ee 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -82,7 +82,7 @@ class ChatController extends AEnvironmentAwareController { private MessageParser $messageParser; - private \OCP\Collaboration\AutoComplete\IManager $autoCompleteManager; + private IManager $autoCompleteManager; private IUserStatusManager $statusManager; diff --git a/lib/Events/CommandEvent.php b/lib/Events/CommandEvent.php index 3c62182bb62..67281c254f5 100644 --- a/lib/Events/CommandEvent.php +++ b/lib/Events/CommandEvent.php @@ -30,7 +30,7 @@ class CommandEvent extends ChatEvent { protected Command $command; protected string $arguments; - protected ?string $output = null; + protected string $output = ''; public function __construct(Room $room, IComment $message, Command $command, string $arguments) { @@ -51,7 +51,7 @@ public function setOutput(string $output): void { $this->output = $output; } - public function getOutput(): ?string { + public function getOutput(): string { return $this->output; } } diff --git a/lib/Events/EndCallForEveryoneEvent.php b/lib/Events/EndCallForEveryoneEvent.php index 9710e0602de..3dfd1785435 100644 --- a/lib/Events/EndCallForEveryoneEvent.php +++ b/lib/Events/EndCallForEveryoneEvent.php @@ -29,9 +29,9 @@ class EndCallForEveryoneEvent extends ModifyRoomEvent { /** @var string[] */ - protected ?array $sessionIds = null; + protected array $sessionIds = []; /** @var string[] */ - protected ?array $userIds = null; + protected array $userIds = []; public function __construct(Room $room, ?Participant $actor = null) { @@ -49,7 +49,7 @@ public function setSessionIds(array $sessionIds): void { /** * Only available in the after-event */ - public function getSessionIds(): ?array { + public function getSessionIds(): array { return $this->sessionIds; } @@ -64,7 +64,7 @@ public function setUserIds(array $userIds): void { /** * Only available in the after-event */ - public function getUserIds(): ?array { + public function getUserIds(): array { return $this->userIds; } } diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index dd259c1e251..9ec518de2c9 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -53,8 +53,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { private IUserManager $userManager; - /** @var AddressHandler */ - private $addressHandler; + private AddressHandler $addressHandler; private FederationManager $federationManager; diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php index 4c2ff803006..ce569d474d6 100644 --- a/lib/Notification/Notifier.php +++ b/lib/Notification/Notifier.php @@ -66,8 +66,7 @@ class Notifier implements INotifier { protected ICommentsManager $commentManager; protected MessageParser $messageParser; protected Definitions $definitions; - /** @var AddressHandler */ - protected $addressHandler; + protected AddressHandler $addressHandler; /** @var Room[] */ protected array $rooms = []; diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php index 5571cd9552f..63597b1502b 100644 --- a/lib/Signaling/BackendNotifier.php +++ b/lib/Signaling/BackendNotifier.php @@ -43,8 +43,7 @@ class BackendNotifier { private ISecureRandom $secureRandom; private Manager $signalingManager; private ParticipantService $participantService; - /** @var IUrlGenerator */ - private $urlGenerator; + private IURLGenerator $urlGenerator; public function __construct(Config $config, LoggerInterface $logger, diff --git a/tests/php/Chat/AutoComplete/SearchPluginTest.php b/tests/php/Chat/AutoComplete/SearchPluginTest.php index b6e885b4440..a88a0c60559 100644 --- a/tests/php/Chat/AutoComplete/SearchPluginTest.php +++ b/tests/php/Chat/AutoComplete/SearchPluginTest.php @@ -21,7 +21,6 @@ namespace OCA\Talk\Tests\php\Chat\AutoComplete; -use Test\TestCase; use OCA\Talk\Chat\AutoComplete\SearchPlugin; use OCA\Talk\Files\Util; use OCA\Talk\GuestManager; @@ -36,6 +35,7 @@ use OCP\IUser; use OCP\IUserManager; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class SearchPluginTest extends TestCase { diff --git a/tests/php/Chat/AutoComplete/SorterTest.php b/tests/php/Chat/AutoComplete/SorterTest.php index cb165ea0683..d445a806889 100644 --- a/tests/php/Chat/AutoComplete/SorterTest.php +++ b/tests/php/Chat/AutoComplete/SorterTest.php @@ -23,10 +23,10 @@ namespace OCA\Talk\Tests\php\Chat; -use Test\TestCase; use OCA\Talk\Chat\AutoComplete\Sorter; use OCA\Talk\Chat\CommentsManager; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class SorterTest extends TestCase { diff --git a/tests/php/Chat/NotifierTest.php b/tests/php/Chat/NotifierTest.php index 3ee7e45933e..0acec8008a8 100644 --- a/tests/php/Chat/NotifierTest.php +++ b/tests/php/Chat/NotifierTest.php @@ -59,8 +59,6 @@ class NotifierTest extends TestCase { /** @var Util|MockObject */ protected $util; - protected Notifier $notifier; - public function setUp(): void { parent::setUp(); diff --git a/tests/php/Chat/Parser/UserMentionTest.php b/tests/php/Chat/Parser/UserMentionTest.php index d677adf63b7..e72afeed228 100644 --- a/tests/php/Chat/Parser/UserMentionTest.php +++ b/tests/php/Chat/Parser/UserMentionTest.php @@ -24,7 +24,6 @@ namespace OCA\Talk\Tests\php\Chat\Parser; -use Test\TestCase; use OCA\Talk\Chat\Parser\UserMention; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\GuestManager; @@ -38,6 +37,7 @@ use OCP\IUser; use OCP\IUserManager; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class UserMentionTest extends TestCase { diff --git a/tests/php/Collaboration/Collaborators/RoomPluginTest.php b/tests/php/Collaboration/Collaborators/RoomPluginTest.php index 867449be396..f96d235692a 100644 --- a/tests/php/Collaboration/Collaborators/RoomPluginTest.php +++ b/tests/php/Collaboration/Collaborators/RoomPluginTest.php @@ -25,7 +25,6 @@ namespace OCA\Talk\Tests\php\Collaboration\Collaborators; -use Test\TestCase; use OCA\Talk\Collaboration\Collaborators\RoomPlugin; use OCA\Talk\Manager; use OCA\Talk\Room; @@ -34,6 +33,7 @@ use OCP\IUser; use OCP\IUserSession; use OCP\Share\IShare; +use Test\TestCase; class RoomPluginTest extends TestCase { protected ?Manager $manager = null; diff --git a/tests/php/Controller/SignalingControllerTest.php b/tests/php/Controller/SignalingControllerTest.php index ec0851335f6..53234ce4937 100644 --- a/tests/php/Controller/SignalingControllerTest.php +++ b/tests/php/Controller/SignalingControllerTest.php @@ -22,8 +22,6 @@ namespace OCA\Talk\Tests\php\Controller; -use Test\TestCase; -use OCP\IRequest; use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Config; use OCA\Talk\Controller\SignalingController; @@ -47,12 +45,14 @@ use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IL10N; +use OCP\IRequest; use OCP\IUser; use OCP\IUserManager; use OCP\Security\IHasher; use OCP\Security\ISecureRandom; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; +use Test\TestCase; class CustomInputSignalingController extends SignalingController { private $inputStream; @@ -97,7 +97,7 @@ class SignalingControllerTest extends TestCase { /** @var LoggerInterface|MockObject */ private $logger; - private ?\OCA\Talk\Tests\php\Controller\CustomInputSignalingController $controller = null; + private ?CustomInputSignalingController $controller = null; public function setUp(): void { parent::setUp(); diff --git a/tests/php/Notification/NotifierTest.php b/tests/php/Notification/NotifierTest.php index 4527dad1ccb..7148f6e6f79 100644 --- a/tests/php/Notification/NotifierTest.php +++ b/tests/php/Notification/NotifierTest.php @@ -21,7 +21,6 @@ namespace OCA\Talk\Tests\php\Notifications; -use Test\TestCase; use OCA\FederatedFileSharing\AddressHandler; use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Chat\MessageParser; @@ -48,6 +47,7 @@ use OCP\RichObjectStrings\Definitions; use OCP\Share\IManager as IShareManager; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class NotifierTest extends TestCase { diff --git a/tests/php/Settings/Admin/AdminSettingsTest.php b/tests/php/Settings/Admin/AdminSettingsTest.php index a5b81e4b01a..1438c63e451 100644 --- a/tests/php/Settings/Admin/AdminSettingsTest.php +++ b/tests/php/Settings/Admin/AdminSettingsTest.php @@ -23,7 +23,6 @@ namespace OCA\Talk\Tests\php\Settings\Admin; -use Test\TestCase; use OCA\Talk\Config; use OCA\Talk\MatterbridgeManager; use OCA\Talk\Service\CommandService; @@ -36,6 +35,7 @@ use OCP\IUserSession; use OCP\L10N\IFactory; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class AdminSettingsTest extends TestCase { diff --git a/tests/php/Settings/Admin/SectionTest.php b/tests/php/Settings/Admin/SectionTest.php index cfdff1537fc..e1c79169d33 100644 --- a/tests/php/Settings/Admin/SectionTest.php +++ b/tests/php/Settings/Admin/SectionTest.php @@ -23,11 +23,11 @@ namespace OCA\Talk\Tests\php\Settings\Admin; -use Test\TestCase; use OCA\Talk\Settings\Admin\Section; use OCP\IL10N; use OCP\IURLGenerator; use PHPUnit\Framework\MockObject\MockObject; +use Test\TestCase; class SectionTest extends TestCase { diff --git a/tests/php/Signaling/BackendNotifierTest.php b/tests/php/Signaling/BackendNotifierTest.php index eb871389b54..3bb2fc38661 100644 --- a/tests/php/Signaling/BackendNotifierTest.php +++ b/tests/php/Signaling/BackendNotifierTest.php @@ -22,7 +22,6 @@ namespace OCA\Talk\Tests\php\Signaling; -use Test\TestCase; use OCA\Talk\AppInfo\Application; use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Config; @@ -50,6 +49,7 @@ use OCP\Security\ISecureRandom; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; +use Test\TestCase; class CustomBackendNotifier extends BackendNotifier { private array $requests = [];