Small code cleanup.

This commit is contained in:
James Cole
2023-12-23 06:22:47 +01:00
parent 581e5d7330
commit ca8f153c6a
7 changed files with 83 additions and 51 deletions

View File

@@ -82,7 +82,7 @@ class TransactionController extends Controller
} }
/** /**
* @param array $params <array<string, array<string, int|string>>> * @param array<string, array<string, string>> $params
*/ */
private function isUpdateTransactionAccount(array $params): bool private function isUpdateTransactionAccount(array $params): bool
{ {

View File

@@ -161,7 +161,7 @@ class DestroyController extends Controller
} }
/** /**
* @param array $types <int, string> * @param array<int, string> $types
*/ */
private function destroyAccounts(array $types): void private function destroyAccounts(array $types): void
{ {
@@ -187,7 +187,7 @@ class DestroyController extends Controller
} }
/** /**
* @param array $types <int, string> * @param array<int, string> $types
*/ */
private function destroyTransactions(array $types): void private function destroyTransactions(array $types): void
{ {

View File

@@ -243,6 +243,9 @@ class UpdateRequest extends FormRequest
/** /**
* For each field, add it to the array if a reference is present in the request: * For each field, add it to the array if a reference is present in the request:
*
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/ */
private function getIntegerData(array $current, array $transaction): array private function getIntegerData(array $current, array $transaction): array
{ {
@@ -255,6 +258,10 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/
private function getStringData(array $current, array $transaction): array private function getStringData(array $current, array $transaction): array
{ {
foreach ($this->stringFields as $fieldName) { foreach ($this->stringFields as $fieldName) {
@@ -266,6 +273,10 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/
private function getNlStringData(array $current, array $transaction): array private function getNlStringData(array $current, array $transaction): array
{ {
foreach ($this->textareaFields as $fieldName) { foreach ($this->textareaFields as $fieldName) {
@@ -277,6 +288,10 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/
private function getDateData(array $current, array $transaction): array private function getDateData(array $current, array $transaction): array
{ {
foreach ($this->dateFields as $fieldName) { foreach ($this->dateFields as $fieldName) {
@@ -290,6 +305,10 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/
private function getBooleanData(array $current, array $transaction): array private function getBooleanData(array $current, array $transaction): array
{ {
foreach ($this->booleanFields as $fieldName) { foreach ($this->booleanFields as $fieldName) {
@@ -301,6 +320,10 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/
private function getArrayData(array $current, array $transaction): array private function getArrayData(array $current, array $transaction): array
{ {
foreach ($this->arrayFields as $fieldName) { foreach ($this->arrayFields as $fieldName) {
@@ -312,6 +335,10 @@ class UpdateRequest extends FormRequest
return $current; return $current;
} }
/**
* @param array<string, string> $current
* @param array<string, mixed> $transaction
*/
private function getFloatData(array $current, array $transaction): array private function getFloatData(array $current, array $transaction): array
{ {
foreach ($this->floatFields as $fieldName) { foreach ($this->floatFields as $fieldName) {

View File

@@ -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<int, array<int, string>> $array
* *
* @throws FireflyException * @throws FireflyException
*/ */

View File

@@ -88,7 +88,7 @@ class Controller extends BaseController
/** /**
* Returns a JSON API object and returns it. * Returns a JSON API object and returns it.
* *
* @param Model $object * @param array<int, mixed>|Model $object
*/ */
final protected function jsonApiObject(string $key, array|Model $object, AbstractTransformer $transformer): array final protected function jsonApiObject(string $key, array|Model $object, AbstractTransformer $transformer): array
{ {

View File

@@ -69,6 +69,8 @@ trait AugumentData
/** /**
* Small helper function for the revenue and expense account charts. * Small helper function for the revenue and expense account charts.
*
* @param array<array> $names
*/ */
protected function expandNames(array $names): array protected function expandNames(array $names): array
{ {

93
composer.lock generated
View File

@@ -2014,16 +2014,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v10.37.3", "version": "v10.38.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "996375dd61f8c6e4ac262b57ed485655d71fcbdc" "reference": "43da808391da3540d44a8dfeb4e46da4ad8f5723"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/996375dd61f8c6e4ac262b57ed485655d71fcbdc", "url": "https://api.github.com/repos/laravel/framework/zipball/43da808391da3540d44a8dfeb4e46da4ad8f5723",
"reference": "996375dd61f8c6e4ac262b57ed485655d71fcbdc", "reference": "43da808391da3540d44a8dfeb4e46da4ad8f5723",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2069,6 +2069,8 @@
"voku/portable-ascii": "^2.0" "voku/portable-ascii": "^2.0"
}, },
"conflict": { "conflict": {
"carbonphp/carbon-doctrine-types": ">=3.0",
"doctrine/dbal": ">=4.0",
"tightenco/collect": "<5.5.33" "tightenco/collect": "<5.5.33"
}, },
"provide": { "provide": {
@@ -2180,6 +2182,7 @@
"files": [ "files": [
"src/Illuminate/Collections/helpers.php", "src/Illuminate/Collections/helpers.php",
"src/Illuminate/Events/functions.php", "src/Illuminate/Events/functions.php",
"src/Illuminate/Filesystem/functions.php",
"src/Illuminate/Foundation/helpers.php", "src/Illuminate/Foundation/helpers.php",
"src/Illuminate/Support/helpers.php" "src/Illuminate/Support/helpers.php"
], ],
@@ -2212,7 +2215,7 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "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", "name": "laravel/passport",
@@ -2542,16 +2545,16 @@
}, },
{ {
"name": "laravel/ui", "name": "laravel/ui",
"version": "v4.2.3", "version": "v4.3.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/ui.git", "url": "https://github.com/laravel/ui.git",
"reference": "eb532ea096ca1c0298c87c19233daf011fda743a" "reference": "d166e09cdcb2e23836f694774cba77a32edb6007"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/ui/zipball/eb532ea096ca1c0298c87c19233daf011fda743a", "url": "https://api.github.com/repos/laravel/ui/zipball/d166e09cdcb2e23836f694774cba77a32edb6007",
"reference": "eb532ea096ca1c0298c87c19233daf011fda743a", "reference": "d166e09cdcb2e23836f694774cba77a32edb6007",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2598,9 +2601,9 @@
"ui" "ui"
], ],
"support": { "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", "name": "lcobucci/clock",
@@ -5879,16 +5882,16 @@
}, },
{ {
"name": "spatie/laravel-ignition", "name": "spatie/laravel-ignition",
"version": "2.3.2", "version": "2.3.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/spatie/laravel-ignition.git", "url": "https://github.com/spatie/laravel-ignition.git",
"reference": "4800661a195e15783477d99f7f8f669a49793996" "reference": "66499cd3c858642ded56dafb8fa0352057ca20dd"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/4800661a195e15783477d99f7f8f669a49793996", "url": "https://api.github.com/repos/spatie/laravel-ignition/zipball/66499cd3c858642ded56dafb8fa0352057ca20dd",
"reference": "4800661a195e15783477d99f7f8f669a49793996", "reference": "66499cd3c858642ded56dafb8fa0352057ca20dd",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -5967,7 +5970,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-12-15T13:44:49+00:00" "time": "2023-12-21T09:43:05+00:00"
}, },
{ {
"name": "spatie/period", "name": "spatie/period",
@@ -10354,23 +10357,23 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "10.1.10", "version": "10.1.11",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "599109c8ca6bae97b23482d557d2874c25a65e59" "reference": "78c3b7625965c2513ee96569a4dbb62601784145"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/599109c8ca6bae97b23482d557d2874c25a65e59", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/78c3b7625965c2513ee96569a4dbb62601784145",
"reference": "599109c8ca6bae97b23482d557d2874c25a65e59", "reference": "78c3b7625965c2513ee96569a4dbb62601784145",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-dom": "*", "ext-dom": "*",
"ext-libxml": "*", "ext-libxml": "*",
"ext-xmlwriter": "*", "ext-xmlwriter": "*",
"nikic/php-parser": "^4.15", "nikic/php-parser": "^4.18 || ^5.0",
"php": ">=8.1", "php": ">=8.1",
"phpunit/php-file-iterator": "^4.0", "phpunit/php-file-iterator": "^4.0",
"phpunit/php-text-template": "^3.0", "phpunit/php-text-template": "^3.0",
@@ -10420,7 +10423,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", "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": [ "funding": [
{ {
@@ -10428,7 +10431,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-12-11T06:28:43+00:00" "time": "2023-12-21T15:38:30+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@@ -11020,20 +11023,20 @@
}, },
{ {
"name": "sebastian/complexity", "name": "sebastian/complexity",
"version": "3.1.0", "version": "3.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git", "url": "https://github.com/sebastianbergmann/complexity.git",
"reference": "68cfb347a44871f01e33ab0ef8215966432f6957" "reference": "68ff824baeae169ec9f2137158ee529584553799"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68cfb347a44871f01e33ab0ef8215966432f6957", "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799",
"reference": "68cfb347a44871f01e33ab0ef8215966432f6957", "reference": "68ff824baeae169ec9f2137158ee529584553799",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"nikic/php-parser": "^4.10", "nikic/php-parser": "^4.18 || ^5.0",
"php": ">=8.1" "php": ">=8.1"
}, },
"require-dev": { "require-dev": {
@@ -11042,7 +11045,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "3.1-dev" "dev-main": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@@ -11066,7 +11069,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues", "issues": "https://github.com/sebastianbergmann/complexity/issues",
"security": "https://github.com/sebastianbergmann/complexity/security/policy", "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": [ "funding": [
{ {
@@ -11074,20 +11077,20 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-09-28T11:50:59+00:00" "time": "2023-12-21T08:37:17+00:00"
}, },
{ {
"name": "sebastian/diff", "name": "sebastian/diff",
"version": "5.0.3", "version": "5.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/diff.git", "url": "https://github.com/sebastianbergmann/diff.git",
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b" "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"reference": "912dc2fbe3e3c1e7873313cc801b100b6c68c87b", "reference": "fbf413a49e54f6b9b17e12d900ac7f6101591b7f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -11100,7 +11103,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-main": "5.0-dev" "dev-main": "5.1-dev"
} }
}, },
"autoload": { "autoload": {
@@ -11133,7 +11136,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/diff/issues", "issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy", "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": [ "funding": [
{ {
@@ -11141,7 +11144,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-05-01T07:48:21+00:00" "time": "2023-12-22T10:55:06+00:00"
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
@@ -11349,20 +11352,20 @@
}, },
{ {
"name": "sebastian/lines-of-code", "name": "sebastian/lines-of-code",
"version": "2.0.1", "version": "2.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git", "url": "https://github.com/sebastianbergmann/lines-of-code.git",
"reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d" "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/649e40d279e243d985aa8fb6e74dd5bb28dc185d", "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0",
"reference": "649e40d279e243d985aa8fb6e74dd5bb28dc185d", "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"nikic/php-parser": "^4.10", "nikic/php-parser": "^4.18 || ^5.0",
"php": ">=8.1" "php": ">=8.1"
}, },
"require-dev": { "require-dev": {
@@ -11395,7 +11398,7 @@
"support": { "support": {
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues", "issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
"security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", "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": [ "funding": [
{ {
@@ -11403,7 +11406,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2023-08-31T09:25:50+00:00" "time": "2023-12-21T08:38:20+00:00"
}, },
{ {
"name": "sebastian/object-enumerator", "name": "sebastian/object-enumerator",