Skip to content

Commit

Permalink
chore(deps): add json as composer dep and remove all annotations (#656)
Browse files Browse the repository at this point in the history
* chore(deps): add json as composer dep and remove all annotations

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>

* fix indentation

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>

---------

Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
(cherry picked from commit 0bd7821)
  • Loading branch information
Florian committed Nov 9, 2023
1 parent 48295bf commit ec2d6c8
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 48 deletions.
83 changes: 42 additions & 41 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,44 @@
{
"name": "nextcloud/tables",
"description": "This app is for managing data in tables.",
"type": "project",
"license": "AGPL",
"authors": [
{
"name": "Florian Steffens",
"email": "florian@nextcloud.com"
}
],
"require-dev": {
"nextcloud/coding-standard": "^v1.0.0",
"vimeo/psalm": "^5.6.0",
"nextcloud/ocp": "dev-master",
"phan/phan": "5.x",
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
"phpunit/phpunit": "^9"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"platform": {
"php": "7.4"
}
},
"scripts": {
"test": [
"@test:unit"
],
"test:unit": "./vendor/bin/phpunit -c tests/unit/phpunit.xml",
"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 --show-info=true --no-cache",
"psalm:update-baseline": "./vendor/bin/psalm --update-baseline",
"psalm:fix": "./vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
"psalm:fix:dry": "./vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType --dry-run"
},
"require": {
"phpoffice/phpspreadsheet": "^1.28"
}
"name": "nextcloud/tables",
"description": "This app is for managing data in tables.",
"type": "project",
"license": "AGPL",
"authors": [
{
"name": "Florian Steffens",
"email": "florian@nextcloud.com"
}
],
"require-dev": {
"nextcloud/coding-standard": "^v1.0.0",
"vimeo/psalm": "^5.6.0",
"nextcloud/ocp": "dev-master",
"phan/phan": "5.x",
"staabm/annotate-pull-request-from-checkstyle": "^1.8",
"phpunit/phpunit": "^9"
},
"config": {
"optimize-autoloader": true,
"classmap-authoritative": true,
"platform": {
"php": "7.4"
}
},
"scripts": {
"test": [
"@test:unit"
],
"test:unit": "./vendor/bin/phpunit -c tests/unit/phpunit.xml",
"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 --show-info=true --no-cache",
"psalm:update-baseline": "./vendor/bin/psalm --update-baseline",
"psalm:fix": "./vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
"psalm:fix:dry": "./vendor/bin/psalm --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType --dry-run"
},
"require": {
"phpoffice/phpspreadsheet": "^1.28",
"ext-json": "*"
}
}
1 change: 0 additions & 1 deletion lib/Service/ColumnTypes/SelectionCheckBusiness.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class SelectionCheckBusiness extends SuperBusiness implements IColumnTypeBusines

public function parseValue(string $value, ?Column $column = null): string {
$found = in_array($value, self::PATTERN_POSITIVE, true);
/** @noinspection PhpComposerExtensionStubsInspection */
return json_encode($found ? 'true' : 'false');
}

Expand Down
4 changes: 0 additions & 4 deletions lib/Service/ColumnTypes/TextLinkBusiness.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ public function parseValue(string $value, ?Column $column = null): string {
}

// if is json
/** @noinspection PhpComposerExtensionStubsInspection */
$data = json_decode($value, true);
if($data !== null) {
// at least title and resUrl have to be set
if(isset($data['title']) && isset($data['value'])) {
/** @noinspection PhpComposerExtensionStubsInspection */
return json_encode($value);
} else {
$this->logger->warning("Link cell value has incomplete json string.");
Expand All @@ -35,7 +33,6 @@ public function parseValue(string $value, ?Column $column = null): string {
if (empty($matches)) {
return '';
}
/** @noinspection PhpComposerExtensionStubsInspection */
return json_encode(json_encode([
'title' => $matches[0],
'resourceUrl' => $matches[0]
Expand All @@ -49,7 +46,6 @@ public function canBeParsed(string $value, ?Column $column = null): bool {
}

// if is json
/** @noinspection PhpComposerExtensionStubsInspection */
$data = json_decode($value);
if($data != null) {
return true;
Expand Down
1 change: 0 additions & 1 deletion lib/Service/ImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,6 @@ private function createRow(Row $row): void {
continue;
}

/** @noinspection PhpComposerExtensionStubsInspection */
$data[] = [
'columnId' => (int) $this->columns[$i]->getId(),
'value' => json_decode($this->parseValueByColumnType($cell->getValue(), $this->columns[$i])),
Expand Down
1 change: 0 additions & 1 deletion lib/Service/RowService.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ private function parseValueByColumnType(string $value, Column $column) {
$this->logger->warning('Value '.$value.' could not be parsed for column '.$column->getTitle());
return $value;
}
/** @noinspection PhpComposerExtensionStubsInspection */
return json_decode($columnBusiness->parseValue($value, $column));
} catch (NotFoundExceptionInterface|ContainerExceptionInterface $e) {
$this->logger->debug('Column type business class not found', ['exception' => $e]);
Expand Down

0 comments on commit ec2d6c8

Please sign in to comment.