Skip to content

Commit

Permalink
chore: Bump php-cs-fixer config and apply
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <[email protected]>
  • Loading branch information
juliusknorr committed Sep 19, 2024
1 parent 62c6c04 commit 9ca8814
Show file tree
Hide file tree
Showing 45 changed files with 234 additions and 105 deletions.
136 changes: 95 additions & 41 deletions composer.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion lib/Backgroundjobs/Cleanup.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
use OCP\IDBConnection;

class Cleanup extends TimedJob {
public function __construct(ITimeFactory $time, private IDBConnection $db, private WopiMapper $wopiMapper) {
public function __construct(
ITimeFactory $time,
private IDBConnection $db,
private WopiMapper $wopiMapper,
) {
parent::__construct($time);

$this->setInterval(60 * 60);
Expand Down
2 changes: 1 addition & 1 deletion lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function __construct(
private PermissionManager $permissionManager,
private IAppManager $appManager,
private ?string $userId,
private IURLGenerator $urlGenerator
private IURLGenerator $urlGenerator,
) {
}

Expand Down
4 changes: 3 additions & 1 deletion lib/Command/ConvertToBigInt.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;

class ConvertToBigInt extends Command {
public function __construct(private Connection $connection) {
public function __construct(
private Connection $connection,
) {
parent::__construct();
}

Expand Down
4 changes: 3 additions & 1 deletion lib/Command/InstallDefaultFonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class InstallDefaultFonts extends Command {
public function __construct(private FontService $fontService) {
public function __construct(
private FontService $fontService,
) {
parent::__construct();
}

Expand Down
4 changes: 3 additions & 1 deletion lib/Command/UpdateEmptyTemplates.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
use Symfony\Component\Console\Output\OutputInterface;

class UpdateEmptyTemplates extends Command {
public function __construct(private TemplateManager $templateManager) {
public function __construct(
private TemplateManager $templateManager,
) {
parent::__construct();
}

Expand Down
6 changes: 4 additions & 2 deletions lib/Controller/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
use OCP\IURLGenerator;

class AssetsController extends Controller {
public function __construct($appName,
public function __construct(
$appName,
IRequest $request,
private AssetMapper $assetMapper,
private IRootFolder $rootFolder,
private ?string $userId,
private UserScopeService $userScopeService,
private IURLGenerator $urlGenerator) {
private IURLGenerator $urlGenerator,
) {
parent::__construct($appName, $request);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/DirectViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
private AppConfig $appConfig,
private TemplateManager $templateManager,
private FederationService $federationService,
private LoggerInterface $logger
private LoggerInterface $logger,
) {
parent::__construct($appName, $request);
}
Expand Down
11 changes: 10 additions & 1 deletion lib/Controller/DocumentAPIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@
use Throwable;

class DocumentAPIController extends \OCP\AppFramework\OCSController {
public function __construct(IRequest $request, private IRootFolder $rootFolder, private IManager $shareManager, private TemplateManager $templateManager, private IL10N $l10n, private LoggerInterface $logger, private ILockManager $lockManager, private $userId) {
public function __construct(
IRequest $request,
private IRootFolder $rootFolder,
private IManager $shareManager,
private TemplateManager $templateManager,
private IL10N $l10n,
private LoggerInterface $logger,
private ILockManager $lockManager,
private $userId,
) {
parent::__construct(Application::APPNAME, $request);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/DocumentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function __construct(
private TemplateManager $templateManager,
private FederationService $federationService,
private InitialStateService $initialState,
private IURLGenerator $urlGenerator
private IURLGenerator $urlGenerator,
) {
parent::__construct($appName, $request);
}
Expand Down Expand Up @@ -144,7 +144,7 @@ public function index($fileId, ?string $path = null): RedirectResponse|TemplateR
if ($encryptionManager->isEnabled()) {
// Update the current file to be accessible with system public shared key
$owner = $file->getOwner()->getUID();
$absPath = '/' . $owner . '/' . $file->getInternalPath();
$absPath = '/' . $owner . '/' . $file->getInternalPath();
$accessList = OC::$server->getEncryptionFilesHelper()->getAccessList($absPath);
$accessList['public'] = true;
$encryptionManager->getEncryptionModule()->update($absPath, $owner, $accessList);
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/FederationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct(
private LoggerInterface $logger,
private WopiMapper $wopiMapper,
private IUserManager $userManager,
private IURLGenerator $urlGenerator
private IURLGenerator $urlGenerator,
) {
parent::__construct($appName, $request);
}
Expand Down
9 changes: 5 additions & 4 deletions lib/Controller/OCSController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ class OCSController extends \OCP\AppFramework\OCSController {
/**
* @param string $userId
*/
public function __construct(string $appName,
public function __construct(
string $appName,
IRequest $request,
private IRootFolder $rootFolder,
private $userId,
Expand All @@ -43,7 +44,7 @@ public function __construct(string $appName,
private TokenManager $tokenManager,
private IManager $shareManager,
private FederationService $federationService,
private LoggerInterface $logger
private LoggerInterface $logger,
) {
parent::__construct($appName, $request);
}
Expand Down Expand Up @@ -94,7 +95,7 @@ public function createPublic(
string $shareToken,
?string $host = null,
string $path = '',
?string $password = null
?string $password = null,
): DataResponse {
if ($host) {
$remoteCollabora = $this->federationService->getRemoteCollaboraURL($host);
Expand Down Expand Up @@ -182,7 +183,7 @@ public function createPublicFromInitiator(
string $initiatorToken,
string $shareToken,
string $path = '',
?string $password = null
?string $password = null,
): DataResponse {
try {
$share = $this->shareManager->getShareByToken($shareToken);
Expand Down
7 changes: 4 additions & 3 deletions lib/Controller/SettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class SettingsController extends Controller {
'application/vnd.ms-opentype',
];

public function __construct($appName,
public function __construct(
$appName,
IRequest $request,
private IL10N $l10n,
private AppConfig $appConfig,
Expand All @@ -54,7 +55,7 @@ public function __construct($appName,
private DemoService $demoService,
private FontService $fontService,
private LoggerInterface $logger,
private ?string $userId
private ?string $userId,
) {
parent::__construct($appName, $request);
}
Expand Down Expand Up @@ -120,7 +121,7 @@ public function setSettings(
?string $use_groups,
?string $doc_format,
?string $external_apps,
?string $canonical_webroot
?string $canonical_webroot,
): JSONResponse {
if ($wopi_url !== null) {
$this->appConfig->setAppValue('wopi_url', $wopi_url);
Expand Down
5 changes: 3 additions & 2 deletions lib/Controller/TemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ class TemplatesController extends Controller {
* @param TemplateManager $manager
* @param IPreview $preview
*/
public function __construct($appName,
public function __construct(
$appName,
IRequest $request,
private IL10N $l10n,
private TemplateManager $manager,
private IPreview $preview,
private IMimeTypeDetector $mimeTypeDetector,
private LoggerInterface $logger
private LoggerInterface $logger,
) {
parent::__construct($appName, $request);

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/WopiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function __construct(
private IEncryptionManager $encryptionManager,
private IGroupManager $groupManager,
private ILockManager $lockManager,
private IEventDispatcher $eventDispatcher
private IEventDispatcher $eventDispatcher,
) {
parent::__construct($appName, $request);
}
Expand Down
6 changes: 5 additions & 1 deletion lib/Db/AssetMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class AssetMapper extends QBMapper {
/** @var int Lifetime of a token is 10 minutes */
public const TOKEN_TTL = 600;

public function __construct(IDBConnection $db, private ISecureRandom $random, private ITimeFactory $time) {
public function __construct(
IDBConnection $db,
private ISecureRandom $random,
private ITimeFactory $time,
) {
parent::__construct($db, 'richdocuments_assets', Asset::class);
}

Expand Down
6 changes: 4 additions & 2 deletions lib/Db/DirectMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,11 @@ class DirectMapper extends QBMapper {
/** @var int Lifetime of a token is 10 minutes */
public const TOKEN_TTL = 600;

public function __construct(IDBConnection $db,
public function __construct(
IDBConnection $db,
protected ISecureRandom $random,
protected ITimeFactory $timeFactory) {
protected ITimeFactory $timeFactory,
) {
parent::__construct($db, 'richdocuments_direct', Direct::class);
}

Expand Down
10 changes: 6 additions & 4 deletions lib/Db/WopiMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@

/** @template-extends QBMapper<Wopi> */
class WopiMapper extends QBMapper {
public function __construct(IDBConnection $db,
public function __construct(
IDBConnection $db,
private ISecureRandom $random,
private LoggerInterface $logger,
private ITimeFactory $timeFactory,
private AppConfig $appConfig) {
private AppConfig $appConfig,
) {
parent::__construct($db, 'richdocuments_wopi', Wopi::class);
}

Expand Down Expand Up @@ -89,7 +91,7 @@ public function generateInitiatorToken($uid, $remoteServer) {
*/
public function getPathForToken(
#[\SensitiveParameter]
$token
$token,
): Wopi {
return $this->getWopiForToken($token);
}
Expand All @@ -106,7 +108,7 @@ public function getPathForToken(
*/
public function getWopiForToken(
#[\SensitiveParameter]
string $token
string $token,
): Wopi {
$qb = $this->db->getQueryBuilder();
$qb->select('*')
Expand Down
6 changes: 5 additions & 1 deletion lib/Events/BeforeFederationRedirectEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class BeforeFederationRedirectEvent extends Event {
* @param string $relativePath
* @param string $remote
*/
public function __construct(private $node, private $relativePath, private $remote) {
public function __construct(
private $node,
private $relativePath,
private $remote,
) {
parent::__construct();
}

Expand Down
5 changes: 4 additions & 1 deletion lib/Events/DocumentOpenedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
use OCP\Files\Node;

class DocumentOpenedEvent extends \OCP\EventDispatcher\Event {
public function __construct(private ?string $userId, private Node $node) {
public function __construct(
private ?string $userId,
private Node $node,
) {
}

public function getUserId(): ?string {
Expand Down
4 changes: 3 additions & 1 deletion lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class Helper {
/**
* @param string|null $userId
*/
public function __construct(private $userId) {
public function __construct(
private $userId,
) {
}

/**
Expand Down
7 changes: 6 additions & 1 deletion lib/Listener/BeforeFetchPreviewListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@

/** @template-implements IEventListener<Event|BeforePreviewFetchedEvent> */
class BeforeFetchPreviewListener implements IEventListener {
public function __construct(private PermissionManager $permissionManager, private IUserSession $userSession, private IRequest $request, private IManager $shareManager) {
public function __construct(
private PermissionManager $permissionManager,
private IUserSession $userSession,
private IRequest $request,
private IManager $shareManager,
) {
}

public function handle(Event $event): void {
Expand Down
4 changes: 2 additions & 2 deletions lib/Listener/BeforeGetTemplatesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/** @template-implements IEventListener<BeforeGetTemplatesEvent|Event> */
class BeforeGetTemplatesListener implements IEventListener {
public function __construct(
private TemplateFieldService $templateFieldService
private TemplateFieldService $templateFieldService,
) {
}

Expand All @@ -24,7 +24,7 @@ public function handle(Event $event): void {
return;
}

foreach($event->getTemplates() as $template) {
foreach ($event->getTemplates() as $template) {
$templateFileId = $template->jsonSerialize()['fileid'];
$fields = $this->templateFieldService->extractFields($templateFileId);

Expand Down
4 changes: 3 additions & 1 deletion lib/Listener/BeforeTemplateRenderedListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

/** @template-implements IEventListener<BeforeTemplateRenderedEvent|Event> */
class BeforeTemplateRenderedListener implements IEventListener {
public function __construct(private CapabilitiesService $capabilitiesService) {
public function __construct(
private CapabilitiesService $capabilitiesService,
) {
}

public function handle(Event $event): void {
Expand Down
6 changes: 5 additions & 1 deletion lib/Listener/LoadViewerListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

/** @template-implements IEventListener<Event|LoadViewer> */
class LoadViewerListener implements IEventListener {
public function __construct(private PermissionManager $permissionManager, private InitialStateService $initialStateService, private ?string $userId) {
public function __construct(
private PermissionManager $permissionManager,
private InitialStateService $initialStateService,
private ?string $userId,
) {
}

public function handle(Event $event): void {
Expand Down
5 changes: 4 additions & 1 deletion lib/Listener/ShareLinkListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

/** @template-implements IEventListener<Event|ShareLinkAccessedEvent> */
class ShareLinkListener implements \OCP\EventDispatcher\IEventListener {
public function __construct(private PermissionManager $permissionManager, private InitialStateService $initialStateService) {
public function __construct(
private PermissionManager $permissionManager,
private InitialStateService $initialStateService,
) {
}

public function handle(Event $event): void {
Expand Down
2 changes: 1 addition & 1 deletion lib/Middleware/WOPIMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
private IConfig $config,
private IRequest $request,
private WopiMapper $wopiMapper,
private LoggerInterface $logger
private LoggerInterface $logger,
) {
}

Expand Down
Loading

0 comments on commit 9ca8814

Please sign in to comment.