Skip to content

Commit

Permalink
Merge pull request #9907 from shdehnavi/constructor_property_promotio…
Browse files Browse the repository at this point in the history
…n_part3

Use PHP8's constructor property promotion
  • Loading branch information
nickvergessen authored Jul 7, 2023
2 parents ed994b7 + e116b34 commit 61ac7ab
Show file tree
Hide file tree
Showing 20 changed files with 138 additions and 403 deletions.
16 changes: 4 additions & 12 deletions lib/Controller/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,16 @@
use OCP\IUserManager;

class CallController extends AEnvironmentAwareController {
private ParticipantService $participantService;
private RoomService $roomService;
private IUserManager $userManager;
private ITimeFactory $timeFactory;

public function __construct(
string $appName,
IRequest $request,
ParticipantService $participantService,
RoomService $roomService,
IUserManager $userManager,
ITimeFactory $timeFactory,
private ParticipantService $participantService,
private RoomService $roomService,
private IUserManager $userManager,
private ITimeFactory $timeFactory,
) {
parent::__construct($appName, $request);
$this->participantService = $participantService;
$this->roomService = $roomService;
$this->userManager = $userManager;
$this->timeFactory = $timeFactory;
}

#[PublicPage]
Expand Down
89 changes: 22 additions & 67 deletions lib/Controller/ChatController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,81 +71,36 @@
use OCP\UserStatus\IUserStatus;

class ChatController extends AEnvironmentAwareController {
private ?string $userId;
private IUserManager $userManager;
private IAppManager $appManager;
private ChatManager $chatManager;
private ReactionManager $reactionManager;
private ParticipantService $participantService;
private SessionService $sessionService;
protected AttachmentService $attachmentService;
protected avatarService $avatarService;
private GuestManager $guestManager;
/** @var string[] */
protected array $guestNames;
private MessageParser $messageParser;
protected RoomShareProvider $shareProvider;
private IManager $autoCompleteManager;
private IUserStatusManager $statusManager;
protected MatterbridgeManager $matterbridgeManager;
private SearchPlugin $searchPlugin;
private ISearchResult $searchResult;
protected ITimeFactory $timeFactory;
protected IEventDispatcher $eventDispatcher;
protected IValidator $richObjectValidator;
protected ITrustedDomainHelper $trustedDomainHelper;
private IL10N $l;

public function __construct(
string $appName,
?string $UserId,
private ?string $userId,
IRequest $request,
IUserManager $userManager,
IAppManager $appManager,
ChatManager $chatManager,
ReactionManager $reactionManager,
ParticipantService $participantService,
SessionService $sessionService,
AttachmentService $attachmentService,
avatarService $avatarService,
GuestManager $guestManager,
MessageParser $messageParser,
RoomShareProvider $shareProvider,
IManager $autoCompleteManager,
IUserStatusManager $statusManager,
MatterbridgeManager $matterbridgeManager,
SearchPlugin $searchPlugin,
ISearchResult $searchResult,
ITimeFactory $timeFactory,
IEventDispatcher $eventDispatcher,
IValidator $richObjectValidator,
ITrustedDomainHelper $trustedDomainHelper,
IL10N $l,
private IUserManager $userManager,
private IAppManager $appManager,
private ChatManager $chatManager,
private ReactionManager $reactionManager,
private ParticipantService $participantService,
private SessionService $sessionService,
protected AttachmentService $attachmentService,
protected avatarService $avatarService,
private GuestManager $guestManager,
private MessageParser $messageParser,
protected RoomShareProvider $shareProvider,
private IManager $autoCompleteManager,
private IUserStatusManager $statusManager,
protected MatterbridgeManager $matterbridgeManager,
private SearchPlugin $searchPlugin,
private ISearchResult $searchResult,
protected ITimeFactory $timeFactory,
protected IEventDispatcher $eventDispatcher,
protected IValidator $richObjectValidator,
protected ITrustedDomainHelper $trustedDomainHelper,
private IL10N $l,
) {
parent::__construct($appName, $request);

$this->userId = $UserId;
$this->userManager = $userManager;
$this->appManager = $appManager;
$this->chatManager = $chatManager;
$this->reactionManager = $reactionManager;
$this->participantService = $participantService;
$this->sessionService = $sessionService;
$this->attachmentService = $attachmentService;
$this->avatarService = $avatarService;
$this->guestManager = $guestManager;
$this->messageParser = $messageParser;
$this->shareProvider = $shareProvider;
$this->autoCompleteManager = $autoCompleteManager;
$this->statusManager = $statusManager;
$this->matterbridgeManager = $matterbridgeManager;
$this->searchPlugin = $searchPlugin;
$this->searchResult = $searchResult;
$this->timeFactory = $timeFactory;
$this->eventDispatcher = $eventDispatcher;
$this->richObjectValidator = $richObjectValidator;
$this->trustedDomainHelper = $trustedDomainHelper;
$this->l = $l;
}

protected function getActorInfo(string $actorDisplayName = ''): array {
Expand Down
4 changes: 1 addition & 3 deletions lib/Controller/CommandController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,13 @@
use OCP\IRequest;

class CommandController extends OCSController {
protected CommandService $commandService;

public function __construct(
string $appName,
IRequest $request,
CommandService $commandService,
protected CommandService $commandService,
) {
parent::__construct($appName, $request);
$this->commandService = $commandService;
}

public function index(): DataResponse {
Expand Down
14 changes: 3 additions & 11 deletions lib/Controller/FederationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,14 @@
use OCP\IUserSession;

class FederationController extends OCSController {
private FederationManager $federationManager;

private Manager $talkManager;

private IUserSession $userSession;

public function __construct(
IRequest $request,
FederationManager $federationManager,
Manager $talkManager,
IUserSession $userSession,
private FederationManager $federationManager,
private Manager $talkManager,
private IUserSession $userSession,
) {
parent::__construct(Application::APP_ID, $request);
$this->federationManager = $federationManager;
$this->talkManager = $talkManager;
$this->userSession = $userSession;
}

/**
Expand Down
36 changes: 9 additions & 27 deletions lib/Controller/FilesIntegrationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,39 +51,21 @@
use OCP\Share\IManager as IShareManager;

class FilesIntegrationController extends OCSController {
private Manager $manager;
private RoomService $roomService;
private IShareManager $shareManager;
private ISession $session;
private IUserSession $userSession;
private TalkSession $talkSession;
private Util $util;
private IConfig $config;
private IL10N $l;

public function __construct(
string $appName,
IRequest $request,
Manager $manager,
RoomService $roomService,
IShareManager $shareManager,
ISession $session,
IUserSession $userSession,
TalkSession $talkSession,
Util $util,
IConfig $config,
IL10N $l10n,
private Manager $manager,
private RoomService $roomService,
private IShareManager $shareManager,
private ISession $session,
private IUserSession $userSession,
private TalkSession $talkSession,
private Util $util,
private IConfig $config,
private IL10N $l,
) {
parent::__construct($appName, $request);
$this->manager = $manager;
$this->roomService = $roomService;
$this->shareManager = $shareManager;
$this->session = $session;
$this->userSession = $userSession;
$this->talkSession = $talkSession;
$this->util = $util;
$this->config = $config;
$this->l = $l10n;
}

/**
Expand Down
5 changes: 1 addition & 4 deletions lib/Controller/GuestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,13 @@
use OCP\IRequest;

class GuestController extends AEnvironmentAwareController {
private GuestManager $guestManager;

public function __construct(
string $appName,
IRequest $request,
GuestManager $guestManager,
private GuestManager $guestManager,
) {
parent::__construct($appName, $request);

$this->guestManager = $guestManager;
}

#[PublicPage]
Expand Down
20 changes: 5 additions & 15 deletions lib/Controller/HostedSignalingServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,27 +41,17 @@
use Psr\Log\LoggerInterface;

class HostedSignalingServerController extends OCSController {
protected IClientService $clientService;
protected IL10N $l10n;
protected IConfig $config;
protected LoggerInterface $logger;
private HostedSignalingServerService $hostedSignalingServerService;

public function __construct(
string $appName,
IRequest $request,
IClientService $clientService,
IL10N $l10n,
IConfig $config,
LoggerInterface $logger,
HostedSignalingServerService $hostedSignalingServerService,
protected IClientService $clientService,
protected IL10N $l10n,
protected IConfig $config,
protected LoggerInterface $logger,
private HostedSignalingServerService $hostedSignalingServerService,
) {
parent::__construct($appName, $request);
$this->clientService = $clientService;
$this->l10n = $l10n;
$this->config = $config;
$this->logger = $logger;
$this->hostedSignalingServerService = $hostedSignalingServerService;
}

#[PublicPage]
Expand Down
12 changes: 3 additions & 9 deletions lib/Controller/MatterbridgeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,15 @@
use OCP\IRequest;

class MatterbridgeController extends AEnvironmentAwareController {
protected ?string $userId;
protected Manager $manager;
protected MatterbridgeManager $bridgeManager;

public function __construct(
string $appName,
?string $UserId,
protected ?string $userId,
IRequest $request,
Manager $manager,
MatterbridgeManager $bridgeManager,
protected Manager $manager,
protected MatterbridgeManager $bridgeManager,
) {
parent::__construct($appName, $request);
$this->userId = $UserId;
$this->manager = $manager;
$this->bridgeManager = $bridgeManager;
}

/**
Expand Down
4 changes: 1 addition & 3 deletions lib/Controller/MatterbridgeSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,13 @@
use OCP\IRequest;

class MatterbridgeSettingsController extends OCSController {
protected MatterbridgeManager $bridgeManager;

public function __construct(
string $appName,
IRequest $request,
MatterbridgeManager $bridgeManager,
protected MatterbridgeManager $bridgeManager,
) {
parent::__construct($appName, $request);
$this->bridgeManager = $bridgeManager;
}

/**
Expand Down
57 changes: 14 additions & 43 deletions lib/Controller/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,61 +70,32 @@
class PageController extends Controller {
use TInitialState;

private ?string $userId;
private IEventDispatcher $eventDispatcher;
private RoomController $api;
private TalkSession $talkSession;
private IUserSession $userSession;
private LoggerInterface $logger;
private Manager $manager;
private ParticipantService $participantService;
private RoomService $roomService;
private IURLGenerator $url;
private INotificationManager $notificationManager;
private IAppManager $appManager;
private IRootFolder $rootFolder;
private IThrottler $throttler;

public function __construct(
string $appName,
IRequest $request,
IEventDispatcher $eventDispatcher,
RoomController $api,
TalkSession $session,
IUserSession $userSession,
?string $UserId,
LoggerInterface $logger,
Manager $manager,
ParticipantService $participantService,
RoomService $roomService,
IURLGenerator $url,
INotificationManager $notificationManager,
IAppManager $appManager,
private IEventDispatcher $eventDispatcher,
private RoomController $api,
private TalkSession $talkSession,
private IUserSession $userSession,
private ?string $userId,
private LoggerInterface $logger,
private Manager $manager,
private ParticipantService $participantService,
private RoomService $roomService,
private IURLGenerator $url,
private INotificationManager $notificationManager,
private IAppManager $appManager,
IInitialState $initialState,
ICacheFactory $memcacheFactory,
IRootFolder $rootFolder,
IThrottler $throttler,
private IRootFolder $rootFolder,
private IThrottler $throttler,
Config $talkConfig,
IConfig $serverConfig,
IGroupManager $groupManager,
) {
parent::__construct($appName, $request);
$this->eventDispatcher = $eventDispatcher;
$this->api = $api;
$this->talkSession = $session;
$this->userSession = $userSession;
$this->userId = $UserId;
$this->logger = $logger;
$this->manager = $manager;
$this->participantService = $participantService;
$this->roomService = $roomService;
$this->url = $url;
$this->notificationManager = $notificationManager;
$this->appManager = $appManager;
$this->initialState = $initialState;
$this->memcacheFactory = $memcacheFactory;
$this->rootFolder = $rootFolder;
$this->throttler = $throttler;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
$this->groupManager = $groupManager;
Expand Down
Loading

0 comments on commit 61ac7ab

Please sign in to comment.