From ca8f153c6a71300e4e754d99bd22b6b66f9178c9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 23 Dec 2023 06:22:47 +0100 Subject: [PATCH] Small code cleanup. --- .../Data/Bulk/TransactionController.php | 2 +- .../V1/Controllers/Data/DestroyController.php | 4 +- .../Models/Transaction/UpdateRequest.php | 27 ++++++ .../V2/Controllers/Chart/BudgetController.php | 4 +- app/Api/V2/Controllers/Controller.php | 2 +- app/Support/Http/Controllers/AugumentData.php | 2 + composer.lock | 93 ++++++++++--------- 7 files changed, 83 insertions(+), 51 deletions(-) diff --git a/app/Api/V1/Controllers/Data/Bulk/TransactionController.php b/app/Api/V1/Controllers/Data/Bulk/TransactionController.php index 24009d8c1a..f274b8b679 100644 --- a/app/Api/V1/Controllers/Data/Bulk/TransactionController.php +++ b/app/Api/V1/Controllers/Data/Bulk/TransactionController.php @@ -82,7 +82,7 @@ class TransactionController extends Controller } /** - * @param array $params >> + * @param array> $params */ private function isUpdateTransactionAccount(array $params): bool { diff --git a/app/Api/V1/Controllers/Data/DestroyController.php b/app/Api/V1/Controllers/Data/DestroyController.php index 3c11ab9bee..58ff4d3498 100644 --- a/app/Api/V1/Controllers/Data/DestroyController.php +++ b/app/Api/V1/Controllers/Data/DestroyController.php @@ -161,7 +161,7 @@ class DestroyController extends Controller } /** - * @param array $types + * @param array $types */ private function destroyAccounts(array $types): void { @@ -187,7 +187,7 @@ class DestroyController extends Controller } /** - * @param array $types + * @param array $types */ private function destroyTransactions(array $types): void { diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index b7b639454f..99f256c669 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -243,6 +243,9 @@ class UpdateRequest extends FormRequest /** * For each field, add it to the array if a reference is present in the request: + * + * @param array $current + * @param array $transaction */ private function getIntegerData(array $current, array $transaction): array { @@ -255,6 +258,10 @@ class UpdateRequest extends FormRequest return $current; } + /** + * @param array $current + * @param array $transaction + */ private function getStringData(array $current, array $transaction): array { foreach ($this->stringFields as $fieldName) { @@ -266,6 +273,10 @@ class UpdateRequest extends FormRequest return $current; } + /** + * @param array $current + * @param array $transaction + */ private function getNlStringData(array $current, array $transaction): array { foreach ($this->textareaFields as $fieldName) { @@ -277,6 +288,10 @@ class UpdateRequest extends FormRequest return $current; } + /** + * @param array $current + * @param array $transaction + */ private function getDateData(array $current, array $transaction): array { foreach ($this->dateFields as $fieldName) { @@ -290,6 +305,10 @@ class UpdateRequest extends FormRequest return $current; } + /** + * @param array $current + * @param array $transaction + */ private function getBooleanData(array $current, array $transaction): array { foreach ($this->booleanFields as $fieldName) { @@ -301,6 +320,10 @@ class UpdateRequest extends FormRequest return $current; } + /** + * @param array $current + * @param array $transaction + */ private function getArrayData(array $current, array $transaction): array { foreach ($this->arrayFields as $fieldName) { @@ -312,6 +335,10 @@ class UpdateRequest extends FormRequest return $current; } + /** + * @param array $current + * @param array $transaction + */ private function getFloatData(array $current, array $transaction): array { foreach ($this->floatFields as $fieldName) { diff --git a/app/Api/V2/Controllers/Chart/BudgetController.php b/app/Api/V2/Controllers/Chart/BudgetController.php index 678e279d72..20d70cb1df 100644 --- a/app/Api/V2/Controllers/Chart/BudgetController.php +++ b/app/Api/V2/Controllers/Chart/BudgetController.php @@ -169,9 +169,9 @@ class BudgetController extends Controller } /** - * Shared between the "noBudgetLimits" function and "processLimit". + * Shared between the "noBudgetLimits" function and "processLimit". Will take a single set of expenses and return its info. * - * Will take a single set of expenses and return its info. + * @param array> $array * * @throws FireflyException */ diff --git a/app/Api/V2/Controllers/Controller.php b/app/Api/V2/Controllers/Controller.php index 0cf990e6fb..ea9a2b28c5 100644 --- a/app/Api/V2/Controllers/Controller.php +++ b/app/Api/V2/Controllers/Controller.php @@ -88,7 +88,7 @@ class Controller extends BaseController /** * Returns a JSON API object and returns it. * - * @param Model $object + * @param array|Model $object */ final protected function jsonApiObject(string $key, array|Model $object, AbstractTransformer $transformer): array { diff --git a/app/Support/Http/Controllers/AugumentData.php b/app/Support/Http/Controllers/AugumentData.php index 90bcee3fb5..47822de750 100644 --- a/app/Support/Http/Controllers/AugumentData.php +++ b/app/Support/Http/Controllers/AugumentData.php @@ -69,6 +69,8 @@ trait AugumentData /** * Small helper function for the revenue and expense account charts. + * + * @param array $names */ protected function expandNames(array $names): array { diff --git a/composer.lock b/composer.lock index 05a55fa130..0546e1a051 100644 --- a/composer.lock +++ b/composer.lock @@ -2014,16 +2014,16 @@ }, { "name": "laravel/framework", - "version": "v10.37.3", + "version": "v10.38.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "996375dd61f8c6e4ac262b57ed485655d71fcbdc" + "reference": "43da808391da3540d44a8dfeb4e46da4ad8f5723" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/996375dd61f8c6e4ac262b57ed485655d71fcbdc", - "reference": "996375dd61f8c6e4ac262b57ed485655d71fcbdc", + "url": "https://api.github.com/repos/laravel/framework/zipball/43da808391da3540d44a8dfeb4e46da4ad8f5723", + "reference": "43da808391da3540d44a8dfeb4e46da4ad8f5723", "shasum": "" }, "require": { @@ -2069,6 +2069,8 @@ "voku/portable-ascii": "^2.0" }, "conflict": { + "carbonphp/carbon-doctrine-types": ">=3.0", + "doctrine/dbal": ">=4.0", "tightenco/collect": "<5.5.33" }, "provide": { @@ -2180,6 +2182,7 @@ "files": [ "src/Illuminate/Collections/helpers.php", "src/Illuminate/Events/functions.php", + "src/Illuminate/Filesystem/functions.php", "src/Illuminate/Foundation/helpers.php", "src/Illuminate/Support/helpers.php" ], @@ -2212,7 +2215,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-12-13T20:10:58+00:00" + "time": "2023-12-22T14:39:10+00:00" }, { "name": "laravel/passport", @@ -2542,16 +2545,16 @@ }, { "name": "laravel/ui", - "version": "v4.2.3", + "version": "v4.3.0", "source": { "type": "git", "url": "https://github.com/laravel/ui.git", - "reference": "eb532ea096ca1c0298c87c19233daf011fda743a" + "reference": "d166e09cdcb2e23836f694774cba77a32edb6007" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/ui/zipball/eb532ea096ca1c0298c87c19233daf011fda743a", - "reference": "eb532ea096ca1c0298c87c19233daf011fda743a", + "url": "https://api.github.com/repos/laravel/ui/zipball/d166e09cdcb2e23836f694774cba77a32edb6007", + "reference": "d166e09cdcb2e23836f694774cba77a32edb6007", "shasum": "" }, "require": { @@ -2598,9 +2601,9 @@ "ui" ], "support": { - "source": "https://github.com/laravel/ui/tree/v4.2.3" + "source": "https://github.com/laravel/ui/tree/v4.3.0" }, - "time": "2023-11-23T14:44:22+00:00" + "time": "2023-12-19T14:46:09+00:00" }, { "name": "lcobucci/clock", @@ -5879,16 +5882,16 @@ }, { "name": "spatie/laravel-ignition", - "version": "2.3.2", + "version": "2.3.3", "source": { "type": "git", "url": "https://github.com/spatie/laravel-ignition.git", - "reference": "4800661a195e15783477d99f7f8f669a49793996" + "reference": "66499cd3c858642ded56dafb8fa0352057ca20dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/4800661a195e15783477d99f7f8f669a49793996", - "reference": "4800661a195e15783477d99f7f8f669a49793996", + "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/66499cd3c858642ded56dafb8fa0352057ca20dd", + "reference": "66499cd3c858642ded56dafb8fa0352057ca20dd", "shasum": "" }, "require": { @@ -5967,7 +5970,7 @@ "type": "github" } ], - "time": "2023-12-15T13:44:49+00:00" + "time": "2023-12-21T09:43:05+00:00" }, { "name": "spatie/period", @@ -10354,23 +10357,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "10.1.10", + "version": "10.1.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "599109c8ca6bae97b23482d557d2874c25a65e59" + "reference": "78c3b7625965c2513ee96569a4dbb62601784145" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59", - "reference": "599109c8ca6bae97b23482d557d2874c25a65e59", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145", + "reference": "78c3b7625965c2513ee96569a4dbb62601784145", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=8.1", "phpunit/php-file-iterator": "^4.0", "phpunit/php-text-template": "^3.0", @@ -10420,7 +10423,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.10" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.11" }, "funding": [ { @@ -10428,7 +10431,7 @@ "type": "github" } ], - "time": "2023-12-11T06:28:43+00:00" + "time": "2023-12-21T15:38:30+00:00" }, { "name": "phpunit/php-file-iterator", @@ -11020,20 +11023,20 @@ }, { "name": "sebastian/complexity", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "68cfb347a44871f01e33ab0ef8215966432f6957" + "reference": "68ff824baeae169ec9f2137158ee529584553799" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", - "reference": "68cfb347a44871f01e33ab0ef8215966432f6957", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799", + "reference": "68ff824baeae169ec9f2137158ee529584553799", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=8.1" }, "require-dev": { @@ -11042,7 +11045,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.1-dev" + "dev-main": "3.2-dev" } }, "autoload": { @@ -11066,7 +11069,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", "security": "https://github.com/sebastianbergmann/complexity/security/policy", - "source": "https://github.com/sebastianbergmann/complexity/tree/3.1.0" + "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0" }, "funding": [ { @@ -11074,20 +11077,20 @@ "type": "github" } ], - "time": "2023-09-28T11:50:59+00:00" + "time": "2023-12-21T08:37:17+00:00" }, { "name": "sebastian/diff", - "version": "5.0.3", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", - "reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f", + "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f", "shasum": "" }, "require": { @@ -11100,7 +11103,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "5.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -11133,7 +11136,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", "security": "https://github.com/sebastianbergmann/diff/security/policy", - "source": "https://github.com/sebastianbergmann/diff/tree/5.0.3" + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.0" }, "funding": [ { @@ -11141,7 +11144,7 @@ "type": "github" } ], - "time": "2023-05-01T07:48:21+00:00" + "time": "2023-12-22T10:55:06+00:00" }, { "name": "sebastian/environment", @@ -11349,20 +11352,20 @@ }, { "name": "sebastian/lines-of-code", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", - "reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0", + "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0", "shasum": "" }, "require": { - "nikic/php-parser": "^4.10", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=8.1" }, "require-dev": { @@ -11395,7 +11398,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.1" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2" }, "funding": [ { @@ -11403,7 +11406,7 @@ "type": "github" } ], - "time": "2023-08-31T09:25:50+00:00" + "time": "2023-12-21T08:38:20+00:00" }, { "name": "sebastian/object-enumerator",