Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump CS Fixer rules to follow latest Nextcloud standards #39271

Merged
merged 3 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
->notPath('composer')
->notPath('node_modules')
->notPath('vendor')
->in('apps')
->in(__DIR__);

// Ignore additional app directories
Expand Down
9 changes: 5 additions & 4 deletions apps/admin_audit/lib/Actions/Action.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

public function __construct(
private IAuditLogger $logger,
) {}
) {
}

/**
* Log a single action with a log level of info
Expand All @@ -45,9 +46,9 @@
* @param bool $obfuscateParameters
*/
public function log(string $text,
array $params,
array $elements,
bool $obfuscateParameters = false): void {
array $params,
array $elements,
bool $obfuscateParameters = false): void {
foreach ($elements as $element) {
if (!isset($params[$element])) {
if ($obfuscateParameters) {
Expand All @@ -59,7 +60,7 @@
$this->logger->critical(
sprintf(
'$params["'.$element.'"] was missing. Transferred value: %s',
print_r($params, true)

Check failure on line 63 in apps/admin_audit/lib/Actions/Action.php

View workflow job for this annotation

GitHub Actions / static-code-analysis-security

TaintedHtml

apps/admin_audit/lib/Actions/Action.php:63:16: TaintedHtml: Detected tainted HTML (see https://psalm.dev/245)
),
['app' => 'admin_audit']
);
Expand Down
2 changes: 1 addition & 1 deletion apps/admin_audit/lib/Actions/UserManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function create(array $params): void {
*/
public function assign(string $uid): void {
$this->log(
'UserID assigned: "%s"',
'UserID assigned: "%s"',
[ 'uid' => $uid ],
[ 'uid' ]
);
Expand Down
14 changes: 7 additions & 7 deletions apps/admin_audit/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function boot(IBootContext $context): void {
* Register hooks in order to log them
*/
private function registerHooks(IAuditLogger $logger,
ContainerInterface $serverContainer): void {
ContainerInterface $serverContainer): void {
$this->userManagementHooks($logger, $serverContainer->get(IUserSession::class));
$this->groupHooks($logger, $serverContainer->get(IGroupManager::class));
$this->authHooks($logger);
Expand All @@ -122,7 +122,7 @@ private function registerHooks(IAuditLogger $logger,
}

private function userManagementHooks(IAuditLogger $logger,
IUserSession $userSession): void {
IUserSession $userSession): void {
$userActions = new UserManagement($logger);

Util::connectHook('OC_User', 'post_createUser', $userActions, 'create');
Expand All @@ -136,7 +136,7 @@ private function userManagementHooks(IAuditLogger $logger,
}

private function groupHooks(IAuditLogger $logger,
IGroupManager $groupManager): void {
IGroupManager $groupManager): void {
$groupActions = new GroupManagement($logger);

assert($groupManager instanceof GroupManager);
Expand Down Expand Up @@ -167,7 +167,7 @@ private function authHooks(IAuditLogger $logger): void {
}

private function appHooks(IAuditLogger $logger,
IEventDispatcher $eventDispatcher): void {
IEventDispatcher $eventDispatcher): void {
$eventDispatcher->addListener(ManagerEvent::EVENT_APP_ENABLE, function (ManagerEvent $event) use ($logger) {
$appActions = new AppManagement($logger);
$appActions->enableApp($event->getAppID());
Expand All @@ -183,15 +183,15 @@ private function appHooks(IAuditLogger $logger,
}

private function consoleHooks(IAuditLogger $logger,
IEventDispatcher $eventDispatcher): void {
IEventDispatcher $eventDispatcher): void {
$eventDispatcher->addListener(ConsoleEvent::class, function (ConsoleEvent $event) use ($logger) {
$appActions = new Console($logger);
$appActions->runCommand($event->getArguments());
});
}

private function fileHooks(IAuditLogger $logger,
IEventDispatcher $eventDispatcher): void {
IEventDispatcher $eventDispatcher): void {
$fileActions = new Files($logger);
$eventDispatcher->addListener(
BeforePreviewFetchedEvent::class,
Expand Down Expand Up @@ -264,7 +264,7 @@ private function trashbinHooks(IAuditLogger $logger): void {
}

private function securityHooks(IAuditLogger $logger,
IEventDispatcher $eventDispatcher): void {
IEventDispatcher $eventDispatcher): void {
$eventDispatcher->addListener(TwoFactorProviderChallengePassed::class, function (TwoFactorProviderChallengePassed $event) use ($logger) {
$security = new Security($logger);
$security->twofactorSuccess($event->getUser(), $event->getProvider());
Expand Down
2 changes: 1 addition & 1 deletion apps/admin_audit/lib/BackgroundJobs/Rotate.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
*/
namespace OCA\AdminAudit\BackgroundJobs;

use OCP\BackgroundJob\TimedJob;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use OCP\IConfig;
use OCP\Log\RotationTrait;

Expand Down
12 changes: 6 additions & 6 deletions apps/cloud_federation_api/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@
'verb' => 'POST',
'root' => '/ocm',
],
// [
// 'name' => 'RequestHandler#inviteAccepted',
// 'url' => '/invite-accepted',
// 'verb' => 'POST',
// 'root' => '/ocm',
// ]
// [
// 'name' => 'RequestHandler#inviteAccepted',
// 'url' => '/invite-accepted',
// 'verb' => 'POST',
// 'root' => '/ocm',
// ]
],
];
1 change: 1 addition & 0 deletions apps/cloud_federation_api/lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/**
Expand Down
4 changes: 2 additions & 2 deletions apps/comments/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
use OCA\Comments\Listener\LoadSidebarScripts;
use OCA\Comments\MaxAutoCompleteResultsInitialState;
use OCA\Comments\Notification\Notifier;
use OCA\Comments\Search\LegacyProvider;
use OCA\Comments\Search\CommentsSearchProvider;
use OCA\Comments\Search\LegacyProvider;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\ICommentsManager;
use OCP\ISearch;
use OCP\IServerContainer;
use OCP\Comments\ICommentsManager;

class Application extends App implements IBootstrap {
public const APP_ID = 'comments';
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Controller/NotificationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
namespace OCA\Comments\Controller;

use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\IgnoreOpenAPI;
use OCP\AppFramework\Http\NotFoundResponse;
use OCP\AppFramework\Http\RedirectResponse;
use OCP\AppFramework\Http;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\Files\IRootFolder;
Expand Down
2 changes: 1 addition & 1 deletion apps/comments/lib/Search/LegacyProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
namespace OCA\Comments\Search;

use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\Files\Folder;
use OCP\Files\Node;
use OCP\Files\NotFoundException;
use OCP\IUser;
use OCP\Search\Provider;
use OCP\Comments\ICommentsManager;
use function count;

class LegacyProvider extends Provider {
Expand Down
6 changes: 3 additions & 3 deletions apps/contactsinteraction/lib/Db/CardSearchDao.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ public function __construct(IDBConnection $db) {
}

public function findExisting(IUser $user,
?string $uid,
?string $email,
?string $cloudId): ?string {
?string $uid,
?string $email,
?string $cloudId): ?string {
$addressbooksQuery = $this->db->getQueryBuilder();
$cardQuery = $this->db->getQueryBuilder();
$propQuery = $this->db->getQueryBuilder();
Expand Down
6 changes: 3 additions & 3 deletions apps/contactsinteraction/lib/Db/RecentContactMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ public function find(string $uid, int $id): RecentContact {
* @return RecentContact[]
*/
public function findMatch(IUser $user,
?string $uid,
?string $email,
?string $cloudId): array {
?string $uid,
?string $email,
?string $cloudId): array {
$qb = $this->db->getQueryBuilder();

$or = $qb->expr()->orX();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
use OCP\IUserManager;
use Psr\Log\LoggerInterface;
use Sabre\VObject\Component\VCard;
use Sabre\VObject\Reader;
use Sabre\VObject\UUIDUtil;
use Throwable;

class ContactInteractionListener implements IEventListener {

Expand Down
13 changes: 6 additions & 7 deletions apps/dashboard/lib/Controller/DashboardApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,24 @@
namespace OCA\Dashboard\Controller;

use OCA\Dashboard\ResponseDefinitions;
use OCP\AppFramework\OCSController;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\OCSController;
use OCP\Dashboard\IAPIWidget;
use OCP\Dashboard\IAPIWidgetV2;
use OCP\Dashboard\IButtonWidget;
use OCP\Dashboard\IIconWidget;
use OCP\Dashboard\IOptionWidget;
use OCP\Dashboard\IManager;
use OCP\Dashboard\IOptionWidget;
use OCP\Dashboard\IReloadableWidget;
use OCP\Dashboard\IWidget;
use OCP\Dashboard\Model\WidgetButton;
use OCP\Dashboard\Model\WidgetItem;

use OCP\Dashboard\Model\WidgetOptions;
use OCP\IConfig;
use OCP\IRequest;

use OCP\Dashboard\IAPIWidget;
use OCP\Dashboard\IAPIWidgetV2;
use OCP\Dashboard\Model\WidgetItem;
use OCP\Dashboard\Model\WidgetItems;

/**
* @psalm-import-type DashboardWidget from ResponseDefinitions
* @psalm-import-type DashboardWidgetItem from ResponseDefinitions
Expand Down
1 change: 1 addition & 0 deletions apps/dashboard/lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/**
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/appinfo/v1/caldav.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
// Backends
use OC\KnownUser\KnownUserService;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\Connector\LegacyDAVACL;
use OCA\DAV\CalDAV\CalendarRoot;
use OCA\DAV\Connector\LegacyDAVACL;
use OCA\DAV\Connector\Sabre\Auth;
use OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin;
use OCA\DAV\Connector\Sabre\MaintenancePlugin;
Expand Down
26 changes: 13 additions & 13 deletions apps/dav/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@
use OCA\DAV\Events\CardUpdatedEvent;
use OCA\DAV\Events\SubscriptionCreatedEvent;
use OCA\DAV\Events\SubscriptionDeletedEvent;
use OCA\DAV\Listener\OutOfOfficeListener;
use OCP\Accounts\UserUpdatedEvent;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\Events\TrustedServerRemovedEvent;
use OCA\DAV\HookManager;
use OCA\DAV\Listener\ActivityUpdaterListener;
use OCA\DAV\Listener\AddressbookListener;
Expand All @@ -84,6 +80,7 @@
use OCA\DAV\Listener\CalendarShareUpdateListener;
use OCA\DAV\Listener\CardListener;
use OCA\DAV\Listener\ClearPhotoCacheListener;
use OCA\DAV\Listener\OutOfOfficeListener;
use OCA\DAV\Listener\SubscriptionListener;
use OCA\DAV\Listener\TrustedServerRemovedListener;
use OCA\DAV\Listener\UserPreferenceListener;
Expand All @@ -93,6 +90,7 @@
use OCA\DAV\SetupChecks\NeedsSystemAddressBookSync;
use OCA\DAV\UserMigration\CalendarMigrator;
use OCA\DAV\UserMigration\ContactsMigrator;
use OCP\Accounts\UserUpdatedEvent;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand All @@ -102,6 +100,8 @@
use OCP\Config\BeforePreferenceDeletedEvent;
use OCP\Config\BeforePreferenceSetEvent;
use OCP\Contacts\IManager as IContactsManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Federation\Events\TrustedServerRemovedEvent;
use OCP\Files\AppData\IAppDataFactory;
use OCP\IUser;
use OCP\User\Events\OutOfOfficeChangedEvent;
Expand Down Expand Up @@ -224,8 +224,8 @@
}

public function registerHooks(HookManager $hm,
IEventDispatcher $dispatcher,
IAppContainer $container) {
IEventDispatcher $dispatcher,
IAppContainer $container) {

Check notice

Code scanning / Psalm

DeprecatedInterface

Interface OCP\AppFramework\IAppContainer is marked as deprecated
$hm->setup();

// first time login event setup
Expand Down Expand Up @@ -268,24 +268,24 @@
}

private function setupContactsProvider(IContactsManager $contactsManager,
IAppContainer $container,
string $userID): void {
IAppContainer $container,

Check notice

Code scanning / Psalm

DeprecatedInterface

Interface OCP\AppFramework\IAppContainer is marked as deprecated
string $userID): void {
/** @var ContactsManager $cm */
$cm = $container->query(ContactsManager::class);
$urlGenerator = $container->getServer()->getURLGenerator();
$cm->setupContactsProvider($contactsManager, $userID, $urlGenerator);
}

private function setupSystemContactsProvider(IContactsManager $contactsManager,
IAppContainer $container): void {
IAppContainer $container): void {

Check notice

Code scanning / Psalm

DeprecatedInterface

Interface OCP\AppFramework\IAppContainer is marked as deprecated
/** @var ContactsManager $cm */
$cm = $container->query(ContactsManager::class);
$urlGenerator = $container->getServer()->getURLGenerator();
$cm->setupSystemContactsProvider($contactsManager, $urlGenerator);
}

public function registerCalendarManager(ICalendarManager $calendarManager,
IAppContainer $container): void {
IAppContainer $container): void {

Check notice

Code scanning / Psalm

DeprecatedInterface

Interface OCP\AppFramework\IAppContainer is marked as deprecated
$calendarManager->register(function () use ($container, $calendarManager) {
$user = \OC::$server->getUserSession()->getUser();
if ($user !== null) {
Expand All @@ -295,14 +295,14 @@
}

private function setupCalendarProvider(ICalendarManager $calendarManager,
IAppContainer $container,
$userId) {
IAppContainer $container,

Check notice

Code scanning / Psalm

DeprecatedInterface

Interface OCP\AppFramework\IAppContainer is marked as deprecated
$userId) {

Check notice

Code scanning / Psalm

MissingParamType

Parameter $userId has no provided type
$cm = $container->query(CalendarManager::class);
$cm->setupCalendarProvider($calendarManager, $userId);
}

public function registerCalendarReminders(NotificationProviderManager $manager,
LoggerInterface $logger): void {
LoggerInterface $logger): void {
try {
$manager->registerProvider(AudioProvider::class);
$manager->registerProvider(EmailProvider::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ class BuildReminderIndexBackgroundJob extends QueuedJob {
* BuildReminderIndexBackgroundJob constructor.
*/
public function __construct(IDBConnection $db,
ReminderService $reminderService,
LoggerInterface $logger,
IJobList $jobList,
ITimeFactory $timeFactory) {
ReminderService $reminderService,
LoggerInterface $logger,
IJobList $jobList,
ITimeFactory $timeFactory) {
parent::__construct($timeFactory);
$this->db = $db;
$this->reminderService = $reminderService;
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/BackgroundJob/CalendarRetentionJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CalendarRetentionJob extends TimedJob {
private $service;

public function __construct(ITimeFactory $time,
RetentionService $service) {
RetentionService $service) {
parent::__construct($time);
$this->service = $service;

Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/BackgroundJob/EventReminderJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ class EventReminderJob extends TimedJob {
private $config;

public function __construct(ITimeFactory $time,
ReminderService $reminderService,
IConfig $config) {
ReminderService $reminderService,
IConfig $config) {
parent::__construct($time);
$this->reminderService = $reminderService;
$this->config = $config;
Expand Down
Loading
Loading