From 44104b9ab6b642785a8ffa5428f927c8f07c5898 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 7 Apr 2022 09:03:12 +0200 Subject: [PATCH] Fix type handling Signed-off-by: Joas Schilling --- lib/Chat/ChatManager.php | 2 +- lib/Chat/Parser/SystemMessage.php | 3 +-- lib/Chat/ReactionManager.php | 2 +- lib/Command/ActiveCalls.php | 5 +---- lib/Controller/ChatController.php | 2 +- lib/Events/EndCallForEveryoneEvent.php | 8 ++++---- lib/Federation/CloudFederationProviderTalk.php | 3 +-- lib/Notification/Notifier.php | 3 +-- lib/Signaling/BackendNotifier.php | 3 +-- tests/php/Chat/AutoComplete/SearchPluginTest.php | 2 +- tests/php/Chat/AutoComplete/SorterTest.php | 2 +- tests/php/Chat/NotifierTest.php | 2 -- tests/php/Chat/Parser/UserMentionTest.php | 2 +- tests/php/Collaboration/Collaborators/RoomPluginTest.php | 2 +- tests/php/Controller/SignalingControllerTest.php | 6 +++--- tests/php/Notification/NotifierTest.php | 2 +- tests/php/Settings/Admin/AdminSettingsTest.php | 2 +- tests/php/Settings/Admin/SectionTest.php | 2 +- tests/php/Signaling/BackendNotifierTest.php | 2 +- 19 files changed, 23 insertions(+), 32 deletions(-) diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index 4c66e9bc5..2b5094d0d 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/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index 3cd7f4365..3f213a585 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 be97b84e7..5306f2d88 100644 --- a/lib/Chat/ReactionManager.php +++ b/lib/Chat/ReactionManager.php @@ -39,7 +39,7 @@ use OCP\IL10N; 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 62905567e..a4ddf508d 100644 --- a/lib/Command/ActiveCalls.php +++ b/lib/Command/ActiveCalls.php @@ -24,16 +24,13 @@ declare(strict_types=1); 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 3ff75dd71..39149b036 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/EndCallForEveryoneEvent.php b/lib/Events/EndCallForEveryoneEvent.php index 9710e0602..3dfd17854 100644 --- a/lib/Events/EndCallForEveryoneEvent.php +++ b/lib/Events/EndCallForEveryoneEvent.php @@ -29,9 +29,9 @@ use OCA\Talk\Room; 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 @@ class EndCallForEveryoneEvent extends ModifyRoomEvent { /** * Only available in the after-event */ - public function getSessionIds(): ?array { + public function getSessionIds(): array { return $this->sessionIds; } @@ -64,7 +64,7 @@ class EndCallForEveryoneEvent extends ModifyRoomEvent { /** * 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 dd259c1e2..9ec518de2 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -53,8 +53,7 @@ use OCP\Share\Exceptions\ShareNotFound; 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 4c2ff8030..ce569d474 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 5571cd955..63597b150 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 b6e885b44..a88a0c605 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\IL10N; 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 cb165ea06..d445a8068 100644 --- a/tests/php/Chat/AutoComplete/SorterTest.php +++ b/tests/php/Chat/AutoComplete/SorterTest.php @@ -23,10 +23,10 @@ declare(strict_types=1); 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 3ee7e4593..0acec8008 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 d677adf63..e72afeed2 100644 --- a/tests/php/Chat/Parser/UserMentionTest.php +++ b/tests/php/Chat/Parser/UserMentionTest.php @@ -24,7 +24,6 @@ declare(strict_types=1); 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\IL10N; 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 867449be3..f96d23569 100644 --- a/tests/php/Collaboration/Collaborators/RoomPluginTest.php +++ b/tests/php/Collaboration/Collaborators/RoomPluginTest.php @@ -25,7 +25,6 @@ declare(strict_types=1); 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\Collaboration\Collaborators\SearchResultType; 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 ec0851335..53234ce49 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\Http\Client\IClientService; 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 4527dad1c..7148f6e6f 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\Notification\INotification; 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 a5b81e4b0..1438c63e4 100644 --- a/tests/php/Settings/Admin/AdminSettingsTest.php +++ b/tests/php/Settings/Admin/AdminSettingsTest.php @@ -23,7 +23,6 @@ declare(strict_types=1); 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\IL10N; 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 cfdff1537..e1c79169d 100644 --- a/tests/php/Settings/Admin/SectionTest.php +++ b/tests/php/Settings/Admin/SectionTest.php @@ -23,11 +23,11 @@ declare(strict_types=1); 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 eb871389b..3bb2fc386 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\IHasher; use OCP\Security\ISecureRandom; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; +use Test\TestCase; class CustomBackendNotifier extends BackendNotifier { private array $requests = [];