fix psalm issues and run cs:fix

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
Julien Veyssier
2024-10-20 23:29:51 +02:00
parent bab0a6f771
commit 21e4a4d84e
14 changed files with 69 additions and 69 deletions

72
composer.lock generated
View File

@@ -255,16 +255,16 @@
},
{
"name": "nextcloud/coding-standard",
"version": "v1.3.1",
"version": "v1.3.2",
"source": {
"type": "git",
"url": "https://github.com/nextcloud/coding-standard.git",
"reference": "e88acb0df6217b808d1632286ddfec9267a102e4"
"reference": "9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/e88acb0df6217b808d1632286ddfec9267a102e4",
"reference": "e88acb0df6217b808d1632286ddfec9267a102e4",
"url": "https://api.github.com/repos/nextcloud/coding-standard/zipball/9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d",
"reference": "9c719c4747fa26efc12f2e8b21c14a9a75c6ba6d",
"shasum": ""
},
"require": {
@@ -291,9 +291,9 @@
"description": "Nextcloud coding standards for the php cs fixer",
"support": {
"issues": "https://github.com/nextcloud/coding-standard/issues",
"source": "https://github.com/nextcloud/coding-standard/tree/v1.3.1"
"source": "https://github.com/nextcloud/coding-standard/tree/v1.3.2"
},
"time": "2024-09-19T09:07:10+00:00"
"time": "2024-10-14T16:49:05+00:00"
},
{
"name": "nextcloud/ocp",
@@ -301,12 +301,12 @@
"source": {
"type": "git",
"url": "https://github.com/nextcloud-deps/ocp.git",
"reference": "4f352c7125d27dc08f08a05a108bf9920536acaf"
"reference": "d97f2772e1a68957dce48ba857b80f4b17641bbb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/4f352c7125d27dc08f08a05a108bf9920536acaf",
"reference": "4f352c7125d27dc08f08a05a108bf9920536acaf",
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/d97f2772e1a68957dce48ba857b80f4b17641bbb",
"reference": "d97f2772e1a68957dce48ba857b80f4b17641bbb",
"shasum": ""
},
"require": {
@@ -314,7 +314,7 @@
"psr/clock": "^1.0",
"psr/container": "^2.0.2",
"psr/event-dispatcher": "^1.0",
"psr/log": "^1.1.4"
"psr/log": "^3.0.2"
},
"default-branch": true,
"type": "library",
@@ -338,7 +338,7 @@
"issues": "https://github.com/nextcloud-deps/ocp/issues",
"source": "https://github.com/nextcloud-deps/ocp/tree/master"
},
"time": "2024-09-20T00:41:25+00:00"
"time": "2024-10-20T00:47:55+00:00"
},
{
"name": "nextcloud/openapi-extractor",
@@ -346,12 +346,12 @@
"source": {
"type": "git",
"url": "https://github.com/nextcloud/openapi-extractor.git",
"reference": "08123750b840942afb17f9b901b047de9005bb0c"
"reference": "e36607030a8edf71b2324999003c1f5a04eb6053"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud/openapi-extractor/zipball/08123750b840942afb17f9b901b047de9005bb0c",
"reference": "08123750b840942afb17f9b901b047de9005bb0c",
"url": "https://api.github.com/repos/nextcloud/openapi-extractor/zipball/e36607030a8edf71b2324999003c1f5a04eb6053",
"reference": "e36607030a8edf71b2324999003c1f5a04eb6053",
"shasum": ""
},
"require": {
@@ -398,20 +398,20 @@
"source": "https://github.com/nextcloud/openapi-extractor/tree/main",
"issues": "https://github.com/nextcloud/openapi-extractor/issues"
},
"time": "2024-09-15T14:47:07+00:00"
"time": "2024-10-19T05:55:38+00:00"
},
{
"name": "nikic/php-parser",
"version": "v5.2.0",
"version": "v5.3.1",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb"
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"reference": "23c79fbbfb725fb92af9bcf41065c8e9a0d49ddb",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/8eea230464783aa9671db8eea6f8c6ac5285794b",
"reference": "8eea230464783aa9671db8eea6f8c6ac5285794b",
"shasum": ""
},
"require": {
@@ -454,9 +454,9 @@
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.2.0"
"source": "https://github.com/nikic/PHP-Parser/tree/v5.3.1"
},
"time": "2024-09-15T16:40:33+00:00"
"time": "2024-10-08T18:51:32+00:00"
},
{
"name": "phar-io/manifest",
@@ -630,16 +630,16 @@
},
{
"name": "phpstan/phpdoc-parser",
"version": "1.30.1",
"version": "1.33.0",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpdoc-parser.git",
"reference": "51b95ec8670af41009e2b2b56873bad96682413e"
"reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/51b95ec8670af41009e2b2b56873bad96682413e",
"reference": "51b95ec8670af41009e2b2b56873bad96682413e",
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/82a311fd3690fb2bf7b64d5c98f912b3dd746140",
"reference": "82a311fd3690fb2bf7b64d5c98f912b3dd746140",
"shasum": ""
},
"require": {
@@ -671,9 +671,9 @@
"description": "PHPDoc parser with support for nullable, intersection and generic types",
"support": {
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.30.1"
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.33.0"
},
"time": "2024-09-07T20:13:05+00:00"
"time": "2024-10-13T11:25:22+00:00"
},
{
"name": "phpunit/php-code-coverage",
@@ -1285,30 +1285,30 @@
},
{
"name": "psr/log",
"version": "1.1.4",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/php-fig/log.git",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11"
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
"reference": "d49695b909c3b7628b6289db5479a1c204601f11",
"url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
"php": ">=8.0.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
"dev-master": "3.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Log\\": "Psr/Log/"
"Psr\\Log\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -1329,9 +1329,9 @@
"psr-3"
],
"support": {
"source": "https://github.com/php-fig/log/tree/1.1.4"
"source": "https://github.com/php-fig/log/tree/3.0.2"
},
"time": "2021-05-03T11:20:27+00:00"
"time": "2024-09-11T13:17:53+00:00"
},
{
"name": "sebastian/cli-parser",

View File

@@ -41,14 +41,14 @@ class CospendProvider implements IProvider {
private array $projectNames;
public function __construct(
private IURLGenerator $urlGenerator,
private ActivityManager $activityManager,
private IUserManager $userManager,
private IGroupManager $groupManager,
private IAppManager $appManager,
private IL10N $l10n,
private IURLGenerator $urlGenerator,
private ActivityManager $activityManager,
private IUserManager $userManager,
private IGroupManager $groupManager,
private IAppManager $appManager,
private IL10N $l10n,
private LocalProjectService $projectService,
private ?string $userId,
private ?string $userId,
) {
$this->projectNames = [];
if (!is_null($userId)) {

View File

@@ -214,7 +214,7 @@ class ApiController extends OCSController {
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT, tags: ['Projects'])]
#[SupportFederatedProject]
public function editProject(
string $projectId, ?string $name = null,
string $projectId, ?string $name = null,
?string $autoExport = null, ?string $currencyName = null, ?bool $deletionDisabled = null,
?string $categorySort = null, ?string $paymentModeSort = null, ?int $archivedTs = null,
): DataResponse {

View File

@@ -311,7 +311,7 @@ class OldApiController extends ApiController {
#[CospendPublicAuth(minimumLevel: Application::ACCESS_LEVEL_MAINTAINER)]
#[BruteForceProtection(action: 'CospendPublicAddMember')]
public function apiAddMember(string $token, string $name,
float $weight = 1, int $active = 1, ?string $color = null): DataResponse {
float $weight = 1, int $active = 1, ?string $color = null): DataResponse {
$publicShareInfo = $this->localProjectService->getLinkShareInfoFromShareToken($token);
try {
$member = $this->localProjectService->createMember(
@@ -404,7 +404,7 @@ class OldApiController extends ApiController {
#[CORS]
#[NoCSRFRequired]
#[CospendUserPermissions(minimumLevel: Application::ACCESS_LEVEL_PARTICIPANT)]
public function apiPrivAddBill(string $projectId, ?string $date = null, ?string $what = null, ?int $payer = null,
public function apiPrivAddBill(string $projectId, ?string $date = null, ?string $what = null, ?int $payer = null,
?string $payed_for = null, ?float $amount = null, string $repeat = 'n',
?string $paymentmode = null, ?int $paymentmodeid = null,
?int $categoryid = null, int $repeatallactive = 0, ?string $repeatuntil = null, ?int $timestamp = null,
@@ -448,7 +448,7 @@ class OldApiController extends ApiController {
#[CospendPublicAuth(minimumLevel: Application::ACCESS_LEVEL_PARTICIPANT)]
#[BruteForceProtection(action: 'CospendPublicEditBill')]
public function apiEditBill(
string $token, int $billid, ?string $date = null, ?string $what = null,
string $token, int $billid, ?string $date = null, ?string $what = null,
?int $payer = null, ?string $payed_for = null, ?float $amount = null, string $repeat = 'n',
?string $paymentmode = null, ?int $paymentmodeid = null,
?int $categoryid = null, ?int $repeatallactive = null,

View File

@@ -45,15 +45,15 @@ use OCP\PreConditionNotMetException;
class PageController extends Controller {
public function __construct(
string $appName,
IRequest $request,
private IL10N $trans,
string $appName,
IRequest $request,
private IL10N $trans,
private LocalProjectService $projectService,
private IInitialState $initialStateService,
private IAppManager $appManager,
private IEventDispatcher $eventDispatcher,
private IConfig $config,
private ?string $userId,
private IInitialState $initialStateService,
private IAppManager $appManager,
private IEventDispatcher $eventDispatcher,
private IConfig $config,
private ?string $userId,
) {
parent::__construct($appName, $request);
}

View File

@@ -257,7 +257,7 @@ class PublicApiController extends OCSController {
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT, tags: ['Public-API_Projects'])]
public function publicGetProjectStatistics(
string $token, ?int $tsMin = null, ?int $tsMax = null,
?int $paymentModeId = null, ?int $categoryId = null,
?int $paymentModeId = null, ?int $categoryId = null,
?float $amountMin = null, ?float $amountMax = null,
string $showDisabled = '1', ?int $currencyId = null, ?int $payerId = null,
): DataResponse {
@@ -894,7 +894,7 @@ class PublicApiController extends OCSController {
#[BruteForceProtection(action: 'CospendPublicEditCat')]
#[OpenAPI(scope: OpenAPI::SCOPE_DEFAULT, tags: ['Public-API_Categories'])]
public function publicEditCategory(
string $token, int $categoryId,
string $token, int $categoryId,
?string $name = null, ?string $icon = null, ?string $color = null,
): DataResponse {
try {

View File

@@ -316,7 +316,7 @@ class BillMapper extends QBMapper {
* @throws \OCP\DB\Exception
*/
public function getBillsClassic(
string $projectId, ?int $tsMin = null, ?int $tsMax = null,
string $projectId, ?int $tsMin = null, ?int $tsMax = null,
?string $paymentMode = null, ?int $paymentModeId = null,
?int $category = null, ?float $amountMin = null, ?float $amountMax = null,
?int $lastchanged = null, ?int $limit = null,

View File

@@ -35,7 +35,7 @@ class Category extends Entity implements \JsonSerializable {
$this->addType('name', 'string');
$this->addType('color', 'string');
$this->addType('encoded_icon', 'string');
$this->addType('order', 'int');
$this->addType('order', 'integer');
}
public function jsonSerialize(): array {

View File

@@ -44,7 +44,7 @@ class Invitation extends Entity implements \JsonSerializable {
public function __construct() {
$this->addType('userId', 'string');
$this->addType('state', 'int');
$this->addType('state', 'integer');
$this->addType('accessToken', 'string');
$this->addType('remoteProjectId', 'string');
$this->addType('remoteProjectName', 'string');

View File

@@ -38,7 +38,7 @@ class PaymentMode extends Entity implements \JsonSerializable {
$this->addType('name', 'string');
$this->addType('color', 'string');
$this->addType('encoded_icon', 'string');
$this->addType('order', 'int');
$this->addType('order', 'integer');
$this->addType('old_id', 'string');
}

View File

@@ -42,12 +42,12 @@ use OCP\Search\SearchResultEntry;
class CospendSearchProvider implements IProvider {
public function __construct(
private IAppManager $appManager,
private IL10N $l10n,
private IURLGenerator $urlGenerator,
private IDateTimeFormatter $dateFormatter,
private IAppManager $appManager,
private IL10N $l10n,
private IURLGenerator $urlGenerator,
private IDateTimeFormatter $dateFormatter,
private LocalProjectService $projectService,
private BillMapper $billMapper,
private BillMapper $billMapper,
) {
}

View File

@@ -294,7 +294,7 @@ class FederatedProjectService implements IProjectService {
}
public function editProject(
string $projectId, ?string $name = null, ?string $contact_email = null,
string $projectId, ?string $name = null, ?string $contact_email = null,
?string $autoExport = null, ?string $currencyName = null, ?bool $deletionDisabled = null,
?string $categorySort = null, ?string $paymentModeSort = null, ?int $archivedTs = null,
): void {

View File

@@ -110,7 +110,7 @@ interface IProjectService {
* @return void
*/
public function editProject(
string $projectId, ?string $name = null, ?string $contact_email = null,
string $projectId, ?string $name = null, ?string $contact_email = null,
?string $autoExport = null, ?string $currencyName = null, ?bool $deletionDisabled = null,
?string $categorySort = null, ?string $paymentModeSort = null, ?int $archivedTs = null,
): void;

View File

@@ -1396,7 +1396,7 @@ class LocalProjectService implements IProjectService {
}
public function editProject(
string $projectId, ?string $name = null, ?string $contact_email = null,
string $projectId, ?string $name = null, ?string $contact_email = null,
?string $autoExport = null, ?string $currencyName = null, ?bool $deletionDisabled = null,
?string $categorySort = null, ?string $paymentModeSort = null, ?int $archivedTs = null,
): void {