Skip to content

Firefly III: a personal finances manager

Various code cleanup

James Coleb1135cee609d
diff --git a/app/Console/Commands/CreateExport.php b/app/Console/Commands/CreateExport.php
index 89c691a5ab..0b94db7880 100644
--- a/app/Console/Commands/CreateExport.php
+++ b/app/Console/Commands/CreateExport.php
@@ -54,7 +54,6 @@ class CreateExport extends Command
/**
* Create a new command instance.
*
- * @return void
*/
public function __construct()
{
diff --git a/app/Console/Commands/VerifiesAccessToken.php b/app/Console/Commands/VerifiesAccessToken.php
index c77afaf57d..d051d68f69 100644
--- a/app/Console/Commands/VerifiesAccessToken.php
+++ b/app/Console/Commands/VerifiesAccessToken.php
@@ -18,6 +18,13 @@ use Preferences;
trait VerifiesAccessToken
{
+ /**
+ * @param null $key
+ *
+ * @return mixed
+ */
+ abstract public function option($key = null);
+
/**
* @return bool
*/
diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php
index 741797c47d..2be137ec13 100644
--- a/app/Console/Kernel.php
+++ b/app/Console/Kernel.php
@@ -49,7 +49,5 @@ class Kernel extends ConsoleKernel
*/
protected function schedule(Schedule $schedule)
{
- // $schedule->command('inspire')
- // ->hourly();
}
}
diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php
index b299e51e9a..4d497d63c4 100644
--- a/app/Http/Controllers/Auth/ForgotPasswordController.php
+++ b/app/Http/Controllers/Auth/ForgotPasswordController.php
@@ -34,10 +34,11 @@ class ForgotPasswordController extends Controller
/**
* Create a new controller instance.
*
- * @return void
*/
public function __construct()
{
+ parent::__construct();
$this->middleware('guest');
+
}
}
diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php
index 8cf4961eb4..d975ec5adc 100644
--- a/app/Http/Controllers/Auth/LoginController.php
+++ b/app/Http/Controllers/Auth/LoginController.php
@@ -46,7 +46,6 @@ class LoginController extends Controller
/**
* Create a new controller instance.
*
- * @return void
*/
public function __construct()
{
diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php
index c154d4af5b..4957935a8d 100644
--- a/app/Http/Controllers/Auth/ResetPasswordController.php
+++ b/app/Http/Controllers/Auth/ResetPasswordController.php
@@ -41,10 +41,10 @@ class ResetPasswordController extends Controller
/**
* Create a new controller instance.
*
- * @return void
*/
public function __construct()
{
+ parent::__construct();
$this->middleware('guest');
}
}
diff --git a/app/Http/Controllers/CategoryController.php b/app/Http/Controllers/CategoryController.php
index 5e3184f7a9..b243b88de6 100644
--- a/app/Http/Controllers/CategoryController.php
+++ b/app/Http/Controllers/CategoryController.php
@@ -239,6 +239,7 @@ class CategoryController extends Controller
if ($moment === 'all') {
$subTitle = trans('firefly.all_journals_for_category', ['name' => $category->name]);
$first = $repository->firstUseDate($category);
+ /** @var Carbon $start */
$start = is_null($first) ? new Carbon : $first;
$end = new Carbon;
}
@@ -257,7 +258,9 @@ class CategoryController extends Controller
// prep for current period
if (strlen($moment) === 0) {
+ /** @var Carbon $start */
$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));
+ /** @var Carbon $end */
$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));
$periods = $this->getPeriodOverview($category);
$subTitle = trans(
diff --git a/app/Http/Controllers/Import/BankController.php b/app/Http/Controllers/Import/BankController.php
index 661da55a77..3e2d59b9c3 100644
--- a/app/Http/Controllers/Import/BankController.php
+++ b/app/Http/Controllers/Import/BankController.php
@@ -79,7 +79,6 @@ class BankController extends Controller
return redirect(route('import.bank.form', [$bank]));
}
$remoteAccounts = array_keys($remoteAccounts);
-
$class = config(sprintf('firefly.import_pre.%s', $bank));
// get import file
diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php
index f4ecb7f429..2ba789f0c8 100644
--- a/app/Http/Controllers/TagController.php
+++ b/app/Http/Controllers/TagController.php
@@ -225,7 +225,9 @@ class TagController extends Controller
// prep for current period
if (strlen($moment) === 0) {
+ /** @var Carbon $start */
$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));
+ /** @var Carbon $end */
$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));
$periods = $this->getPeriodOverview($tag);
$sum = $repository->sumOfTag($tag, $start, $end);
diff --git a/app/Import/Storage/ImportSupport.php b/app/Import/Storage/ImportSupport.php
index 22a2ab88ef..fbae32575e 100644
--- a/app/Import/Storage/ImportSupport.php
+++ b/app/Import/Storage/ImportSupport.php
@@ -23,6 +23,7 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
+use FireflyIII\Models\ImportJob;
use FireflyIII\Models\Rule;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
@@ -39,6 +40,12 @@ trait ImportSupport
/** @var int */
protected $defaultCurrencyId = 1;
+ /** @var Collection */
+ protected $rules;
+
+ /** @var ImportJob */
+ protected $job;
+
/**
* @param TransactionJournal $journal
*
diff --git a/app/Models/Transaction.php b/app/Models/Transaction.php
index cb3938ddde..49203aa784 100644
--- a/app/Models/Transaction.php
+++ b/app/Models/Transaction.php
@@ -29,7 +29,7 @@ use Watson\Validating\ValidatingTrait;
* @property-read string $transaction_foreign_amount
* @property-read string $transaction_type_type
*
- * @property-read int $account_id
+ * @property int $account_id
* @property-read string $account_name
* @property string $account_iban
* @property string $account_number
diff --git a/app/Services/Bunq/Object/MonetaryAccountBank.php b/app/Services/Bunq/Object/MonetaryAccountBank.php
index 858e0176a9..75d1e81790 100644
--- a/app/Services/Bunq/Object/MonetaryAccountBank.php
+++ b/app/Services/Bunq/Object/MonetaryAccountBank.php
@@ -93,8 +93,9 @@ class MonetaryAccountBank extends BunqObject
foreach ($data['alias'] as $alias) {
$this->aliases[] = new Alias($alias);
}
+ /** @var array $filter */
foreach ($data['notification_filters'] as $filter) {
- $this->notificationFilters = new NotificationFilter($filter);
+ $this->notificationFilters[] = new NotificationFilter($filter);
}
return;
diff --git a/app/Services/Bunq/Request/BunqRequest.php b/app/Services/Bunq/Request/BunqRequest.php
index b54cbd8890..7ee19f807c 100644
--- a/app/Services/Bunq/Request/BunqRequest.php
+++ b/app/Services/Bunq/Request/BunqRequest.php
@@ -28,14 +28,14 @@ abstract class BunqRequest
{
/** @var string */
protected $secret = '';
+ /** @var ServerPublicKey */
+ protected $serverPublicKey;
/** @var string */
private $privateKey = '';
/** @var string */
private $server = '';
- /** @var ServerPublicKey */
- private $serverPublicKey;
private $upperCaseHeaders
- = [
+ = [
'x-bunq-client-response-id' => 'X-Bunq-Client-Response-Id',
'x-bunq-client-request-id' => 'X-Bunq-Client-Request-Id',
];
@@ -203,7 +203,7 @@ abstract class BunqRequest
$body = $response->body;
$array = json_decode($body, true);
$responseHeaders = $response->headers->getAll();
- $statusCode = $response->status_code;
+ $statusCode = intval($response->status_code);
$array['ResponseHeaders'] = $responseHeaders;
$array['ResponseStatusCode'] = $statusCode;
@@ -247,7 +247,7 @@ abstract class BunqRequest
$body = $response->body;
$array = json_decode($body, true);
$responseHeaders = $response->headers->getAll();
- $statusCode = $response->status_code;
+ $statusCode = intval($response->status_code);
$array['ResponseHeaders'] = $responseHeaders;
$array['ResponseStatusCode'] = $statusCode;
@@ -285,7 +285,7 @@ abstract class BunqRequest
$body = $response->body;
$array = json_decode($body, true);
$responseHeaders = $response->headers->getAll();
- $statusCode = $response->status_code;
+ $statusCode = intval($response->status_code);
$array['ResponseHeaders'] = $responseHeaders;
$array['ResponseStatusCode'] = $statusCode;
diff --git a/app/Services/Bunq/Request/InstallationTokenRequest.php b/app/Services/Bunq/Request/InstallationTokenRequest.php
index 829c5986e3..6873306782 100644
--- a/app/Services/Bunq/Request/InstallationTokenRequest.php
+++ b/app/Services/Bunq/Request/InstallationTokenRequest.php
@@ -30,8 +30,6 @@ class InstallationTokenRequest extends BunqRequest
private $installationToken;
/** @var string */
private $publicKey = '';
- /** @var ServerPublicKey */
- private $serverPublicKey;
/**
*
@@ -87,22 +85,6 @@ class InstallationTokenRequest extends BunqRequest
$this->publicKey = $publicKey;
}
- /**
- * @return ServerPublicKey
- */
- public function getServerPublicKey(): ServerPublicKey
- {
- return $this->serverPublicKey;
- }
-
- /**
- * @param bool $fake
- */
- public function setFake(bool $fake)
- {
- $this->fake = $fake;
- }
-
/**
* @param array $response
*
diff --git a/app/Support/Import/Prerequisites/BunqPrerequisites.php b/app/Support/Import/Prerequisites/BunqPrerequisites.php
index a83d4ec4c8..ce0150cbb3 100644
--- a/app/Support/Import/Prerequisites/BunqPrerequisites.php
+++ b/app/Support/Import/Prerequisites/BunqPrerequisites.php
@@ -119,9 +119,9 @@ class BunqPrerequisites implements PrerequisitesInterface
{
Log::debug('Generate new key pair for user.');
$keyConfig = [
- "digest_alg" => "sha512",
- "private_key_bits" => 2048,
- "private_key_type" => OPENSSL_KEYTYPE_RSA,
+ 'digest_alg' => 'sha512',
+ 'private_key_bits' => 2048,
+ 'private_key_type' => OPENSSL_KEYTYPE_RSA,
];
// Create the private and public key
$res = openssl_pkey_new($keyConfig);
diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php
index 5fb59cbeca..c25bd003ae 100644
--- a/app/Validation/FireflyValidator.php
+++ b/app/Validation/FireflyValidator.php
@@ -278,11 +278,10 @@ class FireflyValidator extends Validator
/**
* @param $attribute
* @param $value
- * @param $parameters
*
* @return bool
*/
- public function validateSecurePassword($attribute, $value, $parameters): bool
+ public function validateSecurePassword($attribute, $value): bool
{
$verify = false;
if (isset($this->data['verify_password'])) {
diff --git a/public/js/ff/budgets/index.js b/public/js/ff/budgets/index.js
index df5c8f55e1..e855f441c7 100644
--- a/public/js/ff/budgets/index.js
+++ b/public/js/ff/budgets/index.js
@@ -8,7 +8,7 @@
* See the LICENSE file for details.
*/
-/** global: spent, budgeted, available, currencySymbol, budgetIndexURI, accounting */
+/** global: spent, budgeted, available, currencySymbol, budgetIndexUri, updateIncomeUri, periodStart, periodEnd, budgetAmountUri, accounting */
function drawSpentBar() {
"use strict";
diff --git a/public/js/ff/export/index.js b/public/js/ff/export/index.js
index 4cb60463a2..c44ad0c81e 100644
--- a/public/js/ff/export/index.js
+++ b/public/js/ff/export/index.js
@@ -104,7 +104,7 @@ function callExport() {
// show download
showDownload();
- }).fail(function (jqXHR, textStatus, errorThrown) {
+ }).fail(function (jqXHR) {
// show error.
// show form again.
var response = jqXHR.responseJSON;