refactor: simplify constructor property declarations

Signed-off-by: ailkiv <a.ilkiv.ye@gmail.com>
This commit is contained in:
ailkiv 2025-01-03 03:29:11 +02:00
Родитель 2a16ccadbe
Коммит 0c0bf64e5d
7 изменённых файлов: 44 добавлений и 116 удалений

Просмотреть файл

@ -15,30 +15,19 @@ use OCP\IL10N;
use OCP\IURLGenerator;
class DetailsProvider implements IProvider {
/** @var IURLGenerator */
private $urlGenerator;
/** @var IActionFactory */
private $actionFactory;
/** @var IL10N */
private $l10n;
/** @var IManager */
private $manager;
/**
* @param IURLGenerator $urlGenerator
* @param IActionFactory $actionFactory
* @param IL10N $l10n
* @param IManager $manager
*/
public function __construct(IURLGenerator $urlGenerator,
IActionFactory $actionFactory,
IL10N $l10n,
IManager $manager) {
$this->actionFactory = $actionFactory;
$this->urlGenerator = $urlGenerator;
$this->l10n = $l10n;
$this->manager = $manager;
public function __construct(
private IURLGenerator $urlGenerator,
private IActionFactory $actionFactory,
private IL10N $l10n,
private IManager $manager,
) {
}
/**

Просмотреть файл

@ -14,19 +14,13 @@ use OCP\IRequest;
use OCP\IURLGenerator;
class ContactsController extends Controller {
/** @var IL10N */
private $l10n;
/** @var IURLGenerator */
private $urlGenerator;
public function __construct(IRequest $request,
IL10N $l10n,
IURLGenerator $urlGenerator) {
public function __construct(
IRequest $request,
private IL10N $l10n,
private IURLGenerator $urlGenerator,
) {
parent::__construct(Application::APP_ID, $request);
$this->l10n = $l10n;
$this->urlGenerator = $urlGenerator;
}

Просмотреть файл

@ -18,25 +18,15 @@ use OCP\IUserSession;
class SocialApiController extends ApiController {
protected $appName;
/** @var IConfig */
private $config;
/** @var IUserSession */
private $userSession;
/** @var SocialApiService */
private $socialApiService;
public function __construct(IRequest $request,
IConfig $config,
IUserSession $userSession,
SocialApiService $socialApiService) {
public function __construct(
IRequest $request,
private IConfig $config,
private IUserSession $userSession,
private SocialApiService $socialApiService,
) {
parent::__construct(Application::APP_ID, $request);
$this->config = $config;
$this->appName = Application::APP_ID;
$this->userSession = $userSession;
$this->socialApiService = $socialApiService;
}

Просмотреть файл

@ -18,21 +18,14 @@ use OCP\BackgroundJob\QueuedJob;
use OCP\IUserManager;
class SocialUpdate extends QueuedJob {
/** @var SocialApiService */
private $social;
/** @var IJobList */
private $jobList;
/** @var IUserManager */
private $userManager;
public function __construct(ITimeFactory $time,
SocialApiService $social,
IJobList $jobList,
IUserManager $userManager) {
public function __construct(
ITimeFactory $time,
private SocialApiService $social,
private IJobList $jobList,
private IUserManager $userManager,
) {
parent::__construct($time);
$this->social = $social;
$this->jobList = $jobList;
$this->userManager = $userManager;
}
protected function run($argument) {

Просмотреть файл

@ -22,27 +22,20 @@ use function method_exists;
class SocialUpdateRegistration extends TimedJob {
private $appName;
/** @var IUserManager */
private $userManager;
/** @var IJobList */
private $jobList;
/** @var IConfig */
private $config;
/**
* RegisterSocialUpdate constructor.
*
* @param ITimeFactory $time
* @param IUserManager $userManager
* @param IConfig $config
* @param IJobList $jobList
*/
public function __construct(
ITimeFactory $time,
IUserManager $userManager,
IConfig $config,
IJobList $jobList) {
private IUserManager $userManager,
private IConfig $config,
private IJobList $jobList,
) {
parent::__construct($time);
$this->appName = Application::APP_ID;

Просмотреть файл

@ -27,45 +27,19 @@ use OCP\IURLGenerator;
class SocialApiService {
private $appName;
/** @var CompositeSocialProvider */
private $socialProvider;
/** @var IManager */
private $manager;
/** @var IConfig */
private $config;
/** @var IClientService */
private $clientService;
/** @var IL10N */
private $l10n;
/** @var IURLGenerator */
private $urlGen;
/** @var CardDavBackend */
private $davBackend;
/** @var ITimeFactory */
private $timeFactory;
/** @var ImageResizer */
private $imageResizer;
public function __construct(
CompositeSocialProvider $socialProvider,
IManager $manager,
IConfig $config,
IClientService $clientService,
IL10N $l10n,
IURLGenerator $urlGen,
CardDavBackend $davBackend,
ITimeFactory $timeFactory,
ImageResizer $imageResizer) {
private CompositeSocialProvider $socialProvider,
private IManager $manager,
private IConfig $config,
private IClientService $clientService,
private IL10N $l10n,
private IURLGenerator $urlGen,
private CardDavBackend $davBackend,
private ITimeFactory $timeFactory,
private ImageResizer $imageResizer,
) {
$this->appName = Application::APP_ID;
$this->socialProvider = $socialProvider;
$this->manager = $manager;
$this->config = $config;
$this->clientService = $clientService;
$this->l10n = $l10n;
$this->urlGen = $urlGen;
$this->davBackend = $davBackend;
$this->timeFactory = $timeFactory;
$this->imageResizer = $imageResizer;
}

Просмотреть файл

@ -15,22 +15,17 @@ use OCP\Settings\ISettings;
class AdminSettings implements ISettings {
protected $appName;
/** @var IConfig */
private $config;
/** @var IInitialStateService */
private $initialStateService;
/**
* Admin constructor.
*
* @param IConfig $config
* @param IL10N $l
*/
public function __construct(IConfig $config, IInitialStateService $initialStateService) {
public function __construct(
private IConfig $config,
private IInitialStateService $initialStateService,
) {
$this->appName = Application::APP_ID;
$this->config = $config;
$this->initialStateService = $initialStateService;
}
/**