Skip to content
Draft
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"nextcloud/ocp": "dev-stable29",
"staabm/annotate-pull-request-from-checkstyle": "^1.8.5",
"phpunit/phpunit": "^9",
"psalm/phar": "^5.26.1",
"psalm/phar": "6.7.*",
"bamarni/composer-bin-plugin": "^1.8.2"
},
"config": {
Expand All @@ -35,11 +35,13 @@
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
"cs:check": "php-cs-fixer fix --dry-run --diff",
"cs:fix": "php-cs-fixer fix",
"psalm": "./vendor/bin/psalm.phar --show-info=false --no-cache",
"psalm": "./vendor/bin/psalm.phar --no-cache",
"psalm:update-baseline": "./vendor/bin/psalm.phar --update-baseline",
"psalm:fix": "./vendor/bin/psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
"psalm:fix:dry": "./vendor/bin/psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType --dry-run",
"openapi": "generate-spec --verbose && (npm run typescript:generate || echo 'Please manually regenerate the typescript OpenAPI models')",
"rector:check": "rector --dry-run",
"rector:fix": "rector",
"post-install-cmd": [
"[ $COMPOSER_DEV_MODE -eq 0 ] || composer bin all install --ansi"
],
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 11 additions & 20 deletions lib/Analytics/AnalyticsDatasource.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,32 @@
use Psr\Log\LoggerInterface;

class AnalyticsDatasource implements IDatasource {
private LoggerInterface $logger;
private IL10N $l10n;
private TableService $tableService;
private ViewService $viewService;
private RowService $rowService;
private ColumnService $columnService;

protected ?string $userId;

public function __construct(
IL10N $l10n,
LoggerInterface $logger,
TableService $tableService,
ViewService $viewService,
ColumnService $columnService,
RowService $rowService,
?string $userId,
private LoggerInterface $logger,
private TableService $tableService,
private ViewService $viewService,
private ColumnService $columnService,
private RowService $rowService,
protected ?string $userId,
) {
$this->l10n = $l10n;
$this->logger = $logger;
$this->tableService = $tableService;
$this->viewService = $viewService;
$this->columnService = $columnService;
$this->rowService = $rowService;
$this->userId = $userId;
}

/**
* @return string Display Name of the datasource
*/
#[\Override]
public function getName(): string {
return $this->l10n->t('Nextcloud Tables');
}

/**
* @return int 2 digit unique datasource id
*/
#[\Override]
public function getId(): int {
return 55;
}
Expand Down Expand Up @@ -88,6 +77,7 @@ public function getId(): int {
* @throws NotFoundError
* @throws PermissionError
*/
#[\Override]
public function getTemplate(): array {
$tableString = '';
$template = [];
Expand All @@ -108,7 +98,7 @@ public function getTemplate(): array {
// concatenate the option-string. The format is tableId:viewId-title
$tableString = $tableString . $table->getId() . ':' . $view->getId() . '-' . $view->getTitle() . '/';
}
} catch (PermissionError $e) {
} catch (PermissionError) {
// this is a shared table without shared views;
continue;
}
Expand Down Expand Up @@ -145,6 +135,7 @@ public function getTemplate(): array {
* @throws DoesNotExistException
* @throws MultipleObjectsReturnedException
*/
#[\Override]
public function readData($option): array {
// get the ids which come in the format tableId:viewId
$ids = explode(':', $option['tableId']);
Expand Down
12 changes: 3 additions & 9 deletions lib/Api/V1Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,9 @@
use OCP\AppFramework\Db\MultipleObjectsReturnedException;

class V1Api {
private RowService $rowService;
private ColumnService $columnService;
private ?string $userId;

public function __construct(ColumnService $columnService, RowService $rowService, ?string $userId) {
$this->columnService = $columnService;
$this->rowService = $rowService;
$this->userId = $userId;
}
public function __construct(private ColumnService $columnService, private RowService $rowService, private ?string $userId)
{
}

/**
* @param int $nodeId
Expand Down
2 changes: 2 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function __construct() {
/**
* @throws Exception
*/
#[\Override]
public function register(IRegistrationContext $context): void {
if ((@include_once __DIR__ . '/../../vendor/autoload.php') === false) {
throw new Exception('Cannot include autoload. Did you run install dependencies using composer?');
Expand Down Expand Up @@ -94,6 +95,7 @@ public function register(IRegistrationContext $context): void {
$context->registerMiddleware(PermissionMiddleware::class);
}

#[\Override]
public function boot(IBootContext $context): void {
}
}
9 changes: 2 additions & 7 deletions lib/Capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,11 @@
class Capabilities implements ICapability {
private IAppManager $appManager;

private LoggerInterface $logger;

private IConfig $config;

private CircleHelper $circleHelper;

public function __construct(IAppManager $appManager, LoggerInterface $logger, IConfig $config, CircleHelper $circleHelper) {
public function __construct(IAppManager $appManager, private LoggerInterface $logger, IConfig $config, private CircleHelper $circleHelper) {
$this->appManager = $appManager;
$this->logger = $logger;
$this->config = $config;
$this->circleHelper = $circleHelper;
}

/**
Expand All @@ -40,6 +34,7 @@ public function __construct(IAppManager $appManager, LoggerInterface $logger, IC
*
* @inheritDoc
*/
#[\Override]
public function getCapabilities(): array {
$textColumnVariant = 'text-rich';
if (version_compare($this->config->getSystemValueString('version', '0.0.0'), '26.0.0', '<')) {
Expand Down
7 changes: 1 addition & 6 deletions lib/Command/AddTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
use Symfony\Component\Console\Output\OutputInterface;

class AddTable extends Command {
protected TableService $tableService;
protected LoggerInterface $logger;

public function __construct(TableService $tableService, LoggerInterface $logger) {
public function __construct(protected TableService $tableService, protected LoggerInterface $logger) {
parent::__construct();
$this->tableService = $tableService;
$this->logger = $logger;
}

protected function configure(): void {
Expand Down
7 changes: 1 addition & 6 deletions lib/Command/ChangeOwnershipTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@
use Symfony\Component\Console\Output\OutputInterface;

class ChangeOwnershipTable extends Command {
protected TableService $tableService;
protected LoggerInterface $logger;

public function __construct(TableService $tableService, LoggerInterface $logger) {
public function __construct(protected TableService $tableService, protected LoggerInterface $logger) {
parent::__construct();
$this->tableService = $tableService;
$this->logger = $logger;
}

protected function configure(): void {
Expand Down
15 changes: 2 additions & 13 deletions lib/Command/Clean.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ class Clean extends Command {
public const PRINT_LEVEL_WARNING = 3;
public const PRINT_LEVEL_ERROR = 4;

protected ColumnService $columnService;
protected RowService $rowService;
protected TableService $tableService;
protected LoggerInterface $logger;
protected Row2Mapper $rowMapper;

private bool $dry = false;
private int $truncateLength = 20;

Expand All @@ -42,13 +36,8 @@ class Clean extends Command {

private OutputInterface $output;

public function __construct(LoggerInterface $logger, ColumnService $columnService, RowService $rowService, TableService $tableService, Row2Mapper $rowMapper) {
public function __construct(protected LoggerInterface $logger, protected ColumnService $columnService, protected RowService $rowService, protected TableService $tableService, protected Row2Mapper $rowMapper) {
parent::__construct();
$this->logger = $logger;
$this->columnService = $columnService;
$this->rowService = $rowService;
$this->tableService = $tableService;
$this->rowMapper = $rowMapper;
}

protected function configure(): void {
Expand Down Expand Up @@ -142,7 +131,7 @@ private function checkColumns(): void {
} catch (InternalError $e) {
$this->print('😱️ internal error while looking for column', self::PRINT_LEVEL_ERROR);
$this->logger->error('Following error occurred during executing occ command "' . self::class . '"', ['exception' => $e]);
} catch (NotFoundError $e) {
} catch (NotFoundError) {
if ($this->output->isVerbose()) {
$this->print('corresponding column not found.', self::PRINT_LEVEL_ERROR);
} else {
Expand Down
17 changes: 3 additions & 14 deletions lib/Command/CleanLegacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@ class CleanLegacy extends Command {
public const PRINT_LEVEL_WARNING = 3;
public const PRINT_LEVEL_ERROR = 4;

protected ColumnService $columnService;
protected RowService $rowService;
protected TableService $tableService;
protected LoggerInterface $logger;
protected LegacyRowMapper $rowMapper;

private bool $dry = false;
private int $truncateLength = 20;

Expand All @@ -44,13 +38,8 @@ class CleanLegacy extends Command {

private OutputInterface $output;

public function __construct(LoggerInterface $logger, ColumnService $columnService, RowService $rowService, TableService $tableService, LegacyRowMapper $rowMapper) {
public function __construct(protected LoggerInterface $logger, protected ColumnService $columnService, protected RowService $rowService, protected TableService $tableService, protected LegacyRowMapper $rowMapper) {
parent::__construct();
$this->logger = $logger;
$this->columnService = $columnService;
$this->rowService = $rowService;
$this->tableService = $tableService;
$this->rowMapper = $rowMapper;
}

protected function configure(): void {
Expand Down Expand Up @@ -95,7 +84,7 @@ private function getNextRow():void {
} catch (MultipleObjectsReturnedException|Exception $e) {
$this->print('Error while fetching row', self::PRINT_LEVEL_ERROR);
$this->logger->error('Following error occurred during executing occ command "' . self::class . '"', ['exception' => $e]);
} catch (DoesNotExistException $e) {
} catch (DoesNotExistException) {
$this->print('');
$this->print('No more rows found.', self::PRINT_LEVEL_INFO);
$this->print('');
Expand Down Expand Up @@ -143,7 +132,7 @@ private function checkColumns(): void {
} catch (InternalError $e) {
$this->print('😱️ internal error while looking for column', self::PRINT_LEVEL_ERROR);
$this->logger->error('Following error occurred during executing occ command "' . self::class . '"', ['exception' => $e]);
} catch (NotFoundError $e) {
} catch (NotFoundError) {
if ($this->output->isVerbose()) {
$this->print('corresponding column not found.', self::PRINT_LEVEL_ERROR);
} else {
Expand Down
8 changes: 2 additions & 6 deletions lib/Command/ListContexts.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@
use function json_encode;

class ListContexts extends Base {
protected ContextService $contextService;
protected LoggerInterface $logger;
private IConfig $config;

public function __construct(
ContextService $contextService,
LoggerInterface $logger,
protected ContextService $contextService,
protected LoggerInterface $logger,
IConfig $config,
) {
parent::__construct();
$this->contextService = $contextService;
$this->logger = $logger;
$this->config = $config;
}

Expand Down
7 changes: 1 addition & 6 deletions lib/Command/ListTables.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
use Symfony\Component\Console\Output\OutputInterface;

class ListTables extends Command {
protected TableService $tableService;
protected LoggerInterface $logger;

public function __construct(TableService $tableService, LoggerInterface $logger) {
public function __construct(protected TableService $tableService, protected LoggerInterface $logger) {
parent::__construct();
$this->tableService = $tableService;
$this->logger = $logger;
}

protected function configure(): void {
Expand Down
7 changes: 1 addition & 6 deletions lib/Command/RemoveTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,8 @@
use Symfony\Component\Console\Output\OutputInterface;

class RemoveTable extends Command {
protected TableService $tableService;
protected LoggerInterface $logger;

public function __construct(TableService $tableService, LoggerInterface $logger) {
public function __construct(protected TableService $tableService, protected LoggerInterface $logger) {
parent::__construct();
$this->tableService = $tableService;
$this->logger = $logger;
}

protected function configure(): void {
Expand Down
7 changes: 1 addition & 6 deletions lib/Command/RenameTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,8 @@
use Symfony\Component\Console\Output\OutputInterface;

class RenameTable extends Command {
protected TableService $tableService;
protected LoggerInterface $logger;

public function __construct(TableService $tableService, LoggerInterface $logger) {
public function __construct(protected TableService $tableService, protected LoggerInterface $logger) {
parent::__construct();
$this->tableService = $tableService;
$this->logger = $logger;
}

protected function configure(): void {
Expand Down
Loading
Loading