From 250b2c2f537e30dc1ce6d1faeca8121c905707e3 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 6 Apr 2016 16:37:28 +0200 Subject: [PATCH] PHP7 compatible function definitions. --- app/Export/Collector/AttachmentCollector.php | 5 +- app/Export/Collector/BasicCollector.php | 2 +- app/Export/Collector/CollectorInterface.php | 4 +- app/Export/Collector/UploadCollector.php | 5 +- app/Export/ConfigurationFile.php | 4 +- app/Export/Entry.php | 76 +++++++++---------- app/Export/Exporter/BasicExporter.php | 2 +- app/Export/Exporter/CsvExporter.php | 7 +- app/Export/Exporter/ExporterInterface.php | 8 +- app/Export/Processor.php | 41 +++++++--- .../CategoryChartGeneratorInterface.php | 2 +- app/Handlers/Events/SendRegistrationMail.php | 7 +- app/Handlers/Events/UserConfirmation.php | 10 ++- app/Handlers/Events/UserEventListener.php | 4 +- app/Helpers/Csv/Converter/AmountComma.php | 2 +- .../Csv/Converter/AssetAccountName.php | 2 +- .../Csv/Converter/AssetAccountNumber.php | 2 +- app/Helpers/Csv/Converter/BasicConverter.php | 18 ++--- app/Helpers/Csv/Converter/BillId.php | 2 +- app/Helpers/Csv/Converter/BillName.php | 2 +- app/Helpers/Csv/Converter/BudgetId.php | 2 +- app/Helpers/Csv/Converter/BudgetName.php | 2 +- app/Helpers/Csv/Converter/CategoryId.php | 2 +- app/Helpers/Csv/Converter/CategoryName.php | 2 +- .../Csv/Converter/ConverterInterface.php | 8 +- app/Helpers/Csv/Converter/CurrencyCode.php | 2 +- app/Helpers/Csv/Converter/CurrencyId.php | 2 +- app/Helpers/Csv/Converter/CurrencyName.php | 2 +- app/Helpers/Csv/Converter/CurrencySymbol.php | 2 +- app/Helpers/Csv/Converter/Date.php | 2 +- app/Helpers/Csv/Converter/Description.php | 2 +- app/Helpers/Csv/Converter/INGDebetCredit.php | 2 +- .../Csv/Converter/OpposingAccountId.php | 2 +- .../Csv/Converter/RabobankDebetCredit.php | 2 +- app/Helpers/Csv/Converter/TagsComma.php | 2 +- app/Helpers/Csv/Converter/TagsSpace.php | 2 +- app/Helpers/Csv/Data.php | 26 +++---- app/Helpers/Csv/Importer.php | 15 ++-- app/Helpers/Csv/Mapper/AnyAccount.php | 2 +- app/Helpers/Csv/Mapper/AssetAccount.php | 2 +- app/Helpers/Csv/Mapper/Bill.php | 2 +- app/Helpers/Csv/Mapper/Budget.php | 2 +- app/Helpers/Csv/Mapper/Category.php | 2 +- app/Helpers/Csv/Mapper/MapperInterface.php | 2 +- app/Helpers/Csv/Mapper/Tag.php | 2 +- .../Csv/Mapper/TransactionCurrency.php | 2 +- app/Helpers/Csv/PostProcessing/Amount.php | 2 +- .../Csv/PostProcessing/AssetAccount.php | 2 +- app/Helpers/Csv/PostProcessing/Bill.php | 2 +- app/Helpers/Csv/PostProcessing/Currency.php | 2 +- .../Csv/PostProcessing/Description.php | 2 +- .../Csv/PostProcessing/OpposingAccount.php | 2 +- .../PostProcessing/PostProcessorInterface.php | 2 +- .../Csv/Specifix/AbnAmroDescription.php | 2 +- app/Helpers/Csv/Specifix/Dummy.php | 2 +- .../Csv/Specifix/RabobankDescription.php | 2 +- app/Helpers/Csv/Specifix/Specifix.php | 2 +- .../Csv/Specifix/SpecifixInterface.php | 2 +- app/Helpers/Csv/Wizard.php | 12 +-- app/Helpers/Csv/WizardInterface.php | 12 +-- app/Helpers/FiscalHelper.php | 4 +- app/Helpers/FiscalHelperInterface.php | 4 +- app/Helpers/Report/AccountReportHelper.php | 2 +- .../Report/AccountReportHelperInterface.php | 2 +- app/Helpers/Report/BalanceReportHelper.php | 10 +-- .../Report/BalanceReportHelperInterface.php | 2 +- .../Report/BudgetReportHelperInterface.php | 2 +- app/Helpers/Report/ReportHelper.php | 10 +-- app/Helpers/Report/ReportHelperInterface.php | 10 +-- app/Helpers/Report/ReportQuery.php | 8 +- app/Helpers/Report/ReportQueryInterface.php | 8 +- 71 files changed, 220 insertions(+), 190 deletions(-) diff --git a/app/Export/Collector/AttachmentCollector.php b/app/Export/Collector/AttachmentCollector.php index 9eae15dc6e..ee361b604a 100644 --- a/app/Export/Collector/AttachmentCollector.php +++ b/app/Export/Collector/AttachmentCollector.php @@ -53,9 +53,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface } /** - * + * @return bool */ - public function run() + public function run(): bool { // grab all the users attachments: $attachments = $this->getAttachments(); @@ -70,6 +70,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface $this->exportDisk->put($file, $this->explanationString); Log::debug('Also put explanation file "' . $file . '" in the zip.'); $this->getFiles()->push($file); + return true; } /** diff --git a/app/Export/Collector/BasicCollector.php b/app/Export/Collector/BasicCollector.php index ba597ebe40..fb894e0deb 100644 --- a/app/Export/Collector/BasicCollector.php +++ b/app/Export/Collector/BasicCollector.php @@ -40,7 +40,7 @@ class BasicCollector /** * @return Collection */ - public function getFiles() + public function getFiles(): Collection { return $this->files; } diff --git a/app/Export/Collector/CollectorInterface.php b/app/Export/Collector/CollectorInterface.php index e55d316733..303ffadfab 100644 --- a/app/Export/Collector/CollectorInterface.php +++ b/app/Export/Collector/CollectorInterface.php @@ -22,12 +22,12 @@ interface CollectorInterface /** * @return Collection */ - public function getFiles(); + public function getFiles(): Collection; /** * @return bool */ - public function run(); + public function run(): bool; /** * @param Collection $files diff --git a/app/Export/Collector/UploadCollector.php b/app/Export/Collector/UploadCollector.php index 25bfdf89b0..dc3a741fed 100644 --- a/app/Export/Collector/UploadCollector.php +++ b/app/Export/Collector/UploadCollector.php @@ -47,9 +47,9 @@ class UploadCollector extends BasicCollector implements CollectorInterface } /** - * + * @return bool */ - public function run() + public function run(): bool { // grab upload directory. $files = $this->uploadDisk->files(); @@ -58,6 +58,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface foreach ($files as $entry) { $this->processOldUpload($entry); } + return true; } /** diff --git a/app/Export/ConfigurationFile.php b/app/Export/ConfigurationFile.php index f11fa68912..706b2550d7 100644 --- a/app/Export/ConfigurationFile.php +++ b/app/Export/ConfigurationFile.php @@ -38,9 +38,9 @@ class ConfigurationFile } /** - * @return bool + * @return string */ - public function make() + public function make(): string { $fields = array_keys(get_class_vars(Entry::class)); $types = Entry::getTypes(); diff --git a/app/Export/Entry.php b/app/Export/Entry.php index 59117e9bdb..4d6ea90311 100644 --- a/app/Export/Entry.php +++ b/app/Export/Entry.php @@ -171,7 +171,7 @@ class Entry /** * @return int */ - public function getBillId() + public function getBillId(): int { return $this->billId; } @@ -179,7 +179,7 @@ class Entry /** * @param int $billId */ - public function setBillId($billId) + public function setBillId(int $billId) { $this->billId = $billId; } @@ -187,7 +187,7 @@ class Entry /** * @return string */ - public function getBillName() + public function getBillName(): string { return $this->billName; } @@ -195,7 +195,7 @@ class Entry /** * @param string $billName */ - public function setBillName($billName) + public function setBillName(string $billName) { $this->billName = $billName; } @@ -203,7 +203,7 @@ class Entry /** * @return int */ - public function getBudgetId() + public function getBudgetId(): int { return $this->budgetId; } @@ -211,7 +211,7 @@ class Entry /** * @param int $budgetId */ - public function setBudgetId($budgetId) + public function setBudgetId(int $budgetId) { $this->budgetId = $budgetId; } @@ -219,7 +219,7 @@ class Entry /** * @return string */ - public function getBudgetName() + public function getBudgetName(): string { return $this->budgetName; } @@ -227,7 +227,7 @@ class Entry /** * @param string $budgetName */ - public function setBudgetName($budgetName) + public function setBudgetName(string $budgetName) { $this->budgetName = $budgetName; } @@ -235,7 +235,7 @@ class Entry /** * @return int */ - public function getCategoryId() + public function getCategoryId(): int { return $this->categoryId; } @@ -243,7 +243,7 @@ class Entry /** * @param int $categoryId */ - public function setCategoryId($categoryId) + public function setCategoryId(int $categoryId) { $this->categoryId = $categoryId; } @@ -251,7 +251,7 @@ class Entry /** * @return string */ - public function getCategoryName() + public function getCategoryName(): string { return $this->categoryName; } @@ -259,7 +259,7 @@ class Entry /** * @param string $categoryName */ - public function setCategoryName($categoryName) + public function setCategoryName(string $categoryName) { $this->categoryName = $categoryName; } @@ -267,7 +267,7 @@ class Entry /** * @return string */ - public function getDate() + public function getDate(): string { return $this->date; } @@ -283,7 +283,7 @@ class Entry /** * @return string */ - public function getDescription() + public function getDescription(): string { return $this->description; } @@ -299,7 +299,7 @@ class Entry /** * @return string */ - public function getFromAccountIban() + public function getFromAccountIban(): string { return $this->fromAccountIban; } @@ -307,7 +307,7 @@ class Entry /** * @param string $fromAccountIban */ - public function setFromAccountIban($fromAccountIban) + public function setFromAccountIban(string $fromAccountIban) { $this->fromAccountIban = $fromAccountIban; } @@ -315,7 +315,7 @@ class Entry /** * @return int */ - public function getFromAccountId() + public function getFromAccountId():int { return $this->fromAccountId; } @@ -323,7 +323,7 @@ class Entry /** * @param int $fromAccountId */ - public function setFromAccountId($fromAccountId) + public function setFromAccountId(int $fromAccountId) { $this->fromAccountId = $fromAccountId; } @@ -331,7 +331,7 @@ class Entry /** * @return string */ - public function getFromAccountName() + public function getFromAccountName(): string { return $this->fromAccountName; } @@ -339,23 +339,23 @@ class Entry /** * @param string $fromAccountName */ - public function setFromAccountName($fromAccountName) + public function setFromAccountName(string $fromAccountName) { $this->fromAccountName = $fromAccountName; } /** - * @return mixed + * @return string */ - public function getFromAccountNumber() + public function getFromAccountNumber(): string { return $this->fromAccountNumber; } /** - * @param mixed $fromAccountNumber + * @param string $fromAccountNumber */ - public function setFromAccountNumber($fromAccountNumber) + public function setFromAccountNumber(string $fromAccountNumber) { $this->fromAccountNumber = $fromAccountNumber; } @@ -363,7 +363,7 @@ class Entry /** * @return string */ - public function getFromAccountType() + public function getFromAccountType(): string { return $this->fromAccountType; } @@ -371,7 +371,7 @@ class Entry /** * @param string $fromAccountType */ - public function setFromAccountType($fromAccountType) + public function setFromAccountType(string $fromAccountType) { $this->fromAccountType = $fromAccountType; } @@ -379,7 +379,7 @@ class Entry /** * @return string */ - public function getToAccountIban() + public function getToAccountIban(): string { return $this->toAccountIban; } @@ -387,7 +387,7 @@ class Entry /** * @param string $toAccountIban */ - public function setToAccountIban($toAccountIban) + public function setToAccountIban(string $toAccountIban) { $this->toAccountIban = $toAccountIban; } @@ -395,7 +395,7 @@ class Entry /** * @return int */ - public function getToAccountId() + public function getToAccountId(): int { return $this->toAccountId; } @@ -403,7 +403,7 @@ class Entry /** * @param int $toAccountId */ - public function setToAccountId($toAccountId) + public function setToAccountId(int $toAccountId) { $this->toAccountId = $toAccountId; } @@ -411,7 +411,7 @@ class Entry /** * @return string */ - public function getToAccountName() + public function getToAccountName(): string { return $this->toAccountName; } @@ -419,23 +419,23 @@ class Entry /** * @param string $toAccountName */ - public function setToAccountName($toAccountName) + public function setToAccountName(string $toAccountName) { $this->toAccountName = $toAccountName; } /** - * @return mixed + * @return string */ - public function getToAccountNumber() + public function getToAccountNumber(): string { return $this->toAccountNumber; } /** - * @param mixed $toAccountNumber + * @param string $toAccountNumber */ - public function setToAccountNumber($toAccountNumber) + public function setToAccountNumber(string $toAccountNumber) { $this->toAccountNumber = $toAccountNumber; } @@ -443,7 +443,7 @@ class Entry /** * @return string */ - public function getToAccountType() + public function getToAccountType(): string { return $this->toAccountType; } @@ -451,7 +451,7 @@ class Entry /** * @param string $toAccountType */ - public function setToAccountType($toAccountType) + public function setToAccountType(string $toAccountType) { $this->toAccountType = $toAccountType; } diff --git a/app/Export/Exporter/BasicExporter.php b/app/Export/Exporter/BasicExporter.php index db686ea383..1c847a5ebe 100644 --- a/app/Export/Exporter/BasicExporter.php +++ b/app/Export/Exporter/BasicExporter.php @@ -39,7 +39,7 @@ class BasicExporter /** * @return Collection */ - public function getEntries() + public function getEntries(): Collection { return $this->entries; } diff --git a/app/Export/Exporter/CsvExporter.php b/app/Export/Exporter/CsvExporter.php index d646a36df9..6457b8609b 100644 --- a/app/Export/Exporter/CsvExporter.php +++ b/app/Export/Exporter/CsvExporter.php @@ -39,15 +39,15 @@ class CsvExporter extends BasicExporter implements ExporterInterface /** * @return string */ - public function getFileName() + public function getFileName(): string { return $this->fileName; } /** - * + * @return bool */ - public function run() + public function run(): bool { // create temporary file: $this->tempFile(); @@ -72,6 +72,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface } $writer->insertAll($rows); + return true; } private function tempFile() diff --git a/app/Export/Exporter/ExporterInterface.php b/app/Export/Exporter/ExporterInterface.php index 67097c36df..57d1a174ad 100644 --- a/app/Export/Exporter/ExporterInterface.php +++ b/app/Export/Exporter/ExporterInterface.php @@ -22,17 +22,17 @@ interface ExporterInterface /** * @return Collection */ - public function getEntries(); + public function getEntries(): Collection; /** * @return string */ - public function getFileName(); + public function getFileName(): string; /** - * + * @return bool */ - public function run(); + public function run(): bool; /** * @param Collection $entries diff --git a/app/Export/Processor.php b/app/Export/Processor.php index 6eea9d1910..a5e8b1549b 100644 --- a/app/Export/Processor.php +++ b/app/Export/Processor.php @@ -73,19 +73,20 @@ class Processor } /** - * + * @return bool */ - public function collectAttachments() + public function collectAttachments(): bool { $attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]); $attachmentCollector->run(); $this->files = $this->files->merge($attachmentCollector->getFiles()); + return true; } /** - * + * @return bool */ - public function collectJournals() + public function collectJournals(): bool { $args = [$this->accounts, Auth::user(), $this->settings['startDate'], $this->settings['endDate']]; $journalCollector = app('FireflyIII\Repositories\Journal\JournalCollector', $args); @@ -97,20 +98,25 @@ class Processor $this->settings['endDate']->format('Y-m-d') . ').' ); + return true; } - public function collectOldUploads() + /** + * @return bool + */ + public function collectOldUploads(): bool { $uploadCollector = app('FireflyIII\Export\Collector\UploadCollector', [$this->job]); $uploadCollector->run(); $this->files = $this->files->merge($uploadCollector->getFiles()); + return true; } /** - * + * @return bool */ - public function convertJournals() + public function convertJournals(): bool { $count = 0; /** @var TransactionJournal $journal */ @@ -119,15 +125,24 @@ class Processor $count++; } Log::debug('Converted ' . $count . ' journals to "Entry" objects.'); + return true; } - public function createConfigFile() + /** + * @return bool + */ + public function createConfigFile(): bool { $this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]); $this->files->push($this->configurationMaker->make()); + return true; } - public function createZipFile() + /** + * @return bool + * @throws FireflyException + */ + public function createZipFile(): bool { $zip = new ZipArchive; $file = $this->job->key . '.zip'; @@ -156,12 +171,13 @@ class Processor $disk->delete($file); } Log::debug('Done!'); + return true; } /** - * + * @return bool */ - public function exportJournals() + public function exportJournals(): bool { $exporterClass = Config::get('firefly.export_formats.' . $this->exportFormat); $exporter = app($exporterClass, [$this->job]); @@ -170,12 +186,13 @@ class Processor $exporter->run(); $this->files->push($exporter->getFileName()); Log::debug('Added "' . $exporter->getFileName() . '" to the list of files to include in the zip.'); + return true; } /** * @return Collection */ - public function getFiles() + public function getFiles(): Collection { return $this->files; } diff --git a/app/Generator/Chart/Category/CategoryChartGeneratorInterface.php b/app/Generator/Chart/Category/CategoryChartGeneratorInterface.php index ce02b93031..3533eefec3 100644 --- a/app/Generator/Chart/Category/CategoryChartGeneratorInterface.php +++ b/app/Generator/Chart/Category/CategoryChartGeneratorInterface.php @@ -25,7 +25,7 @@ interface CategoryChartGeneratorInterface * * @return array */ - public function all(Collection $entries); + public function all(Collection $entries): array; /** * @param Collection $categories diff --git a/app/Handlers/Events/SendRegistrationMail.php b/app/Handlers/Events/SendRegistrationMail.php index 92b600acf6..04069d8cf6 100644 --- a/app/Handlers/Events/SendRegistrationMail.php +++ b/app/Handlers/Events/SendRegistrationMail.php @@ -38,13 +38,13 @@ class SendRegistrationMail * * @param UserRegistration $event * - * @return void + * @return bool */ - public function handle(UserRegistration $event) + public function handle(UserRegistration $event): bool { $sendMail = env('SEND_REGISTRATION_MAIL', true); if (!$sendMail) { - return; + return true; } // get the email address $email = $event->user->email; @@ -60,5 +60,6 @@ class SendRegistrationMail } catch (Swift_TransportException $e) { Log::error($e->getMessage()); } + return true; } } diff --git a/app/Handlers/Events/UserConfirmation.php b/app/Handlers/Events/UserConfirmation.php index b90a10e27b..0c68908ca8 100644 --- a/app/Handlers/Events/UserConfirmation.php +++ b/app/Handlers/Events/UserConfirmation.php @@ -39,24 +39,30 @@ class UserConfirmation /** * @param ResendConfirmation $event + * + * @return bool */ - public function resendConfirmation(ResendConfirmation $event) + public function resendConfirmation(ResendConfirmation $event): bool { $user = $event->user; $ipAddress = $event->ipAddress; $this->doConfirm($user, $ipAddress); + return true; } /** * Handle the event. * * @param UserRegistration $event + * + * @return bool */ - public function sendConfirmation(UserRegistration $event) + public function sendConfirmation(UserRegistration $event): bool { $user = $event->user; $ipAddress = $event->ipAddress; $this->doConfirm($user, $ipAddress); + return true; } /** diff --git a/app/Handlers/Events/UserEventListener.php b/app/Handlers/Events/UserEventListener.php index 381edb7196..5f4e9b3029 100644 --- a/app/Handlers/Events/UserEventListener.php +++ b/app/Handlers/Events/UserEventListener.php @@ -21,8 +21,10 @@ class UserEventListener { /** * Handle user logout events. + * + * @return bool */ - public function onUserLogout() + public function onUserLogout(): bool { // dump stuff from the session: Session::forget('twofactor-authenticated'); diff --git a/app/Helpers/Csv/Converter/AmountComma.php b/app/Helpers/Csv/Converter/AmountComma.php index 37b4d95841..1c9c585432 100644 --- a/app/Helpers/Csv/Converter/AmountComma.php +++ b/app/Helpers/Csv/Converter/AmountComma.php @@ -15,7 +15,7 @@ class AmountComma extends BasicConverter implements ConverterInterface /** * @return float|int */ - public function convert() + public function convert(): string { $value = str_replace(',', '.', strval($this->value)); diff --git a/app/Helpers/Csv/Converter/AssetAccountName.php b/app/Helpers/Csv/Converter/AssetAccountName.php index 681e168021..72f4653605 100644 --- a/app/Helpers/Csv/Converter/AssetAccountName.php +++ b/app/Helpers/Csv/Converter/AssetAccountName.php @@ -18,7 +18,7 @@ class AssetAccountName extends BasicConverter implements ConverterInterface /** * @return Account|null */ - public function convert() + public function convert(): Account { /** @var AccountRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/AssetAccountNumber.php b/app/Helpers/Csv/Converter/AssetAccountNumber.php index 9aadeaa4d0..b61e35fb70 100644 --- a/app/Helpers/Csv/Converter/AssetAccountNumber.php +++ b/app/Helpers/Csv/Converter/AssetAccountNumber.php @@ -27,7 +27,7 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface /** * @return Account|null */ - public function convert() + public function convert(): Account { /** @var AccountRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/BasicConverter.php b/app/Helpers/Csv/Converter/BasicConverter.php index b1a262cae8..660202358a 100644 --- a/app/Helpers/Csv/Converter/BasicConverter.php +++ b/app/Helpers/Csv/Converter/BasicConverter.php @@ -23,7 +23,7 @@ class BasicConverter /** * @return array */ - public function getData() + public function getData(): array { return $this->data; } @@ -39,7 +39,7 @@ class BasicConverter /** * @return string */ - public function getField() + public function getField(): string { return $this->field; } @@ -47,7 +47,7 @@ class BasicConverter /** * @param string $field */ - public function setField($field) + public function setField(string $field) { $this->field = $field; } @@ -55,7 +55,7 @@ class BasicConverter /** * @return int */ - public function getIndex() + public function getIndex(): int { return $this->index; } @@ -63,7 +63,7 @@ class BasicConverter /** * @param int $index */ - public function setIndex($index) + public function setIndex(int $index) { $this->index = $index; } @@ -71,7 +71,7 @@ class BasicConverter /** * @return array */ - public function getMapped() + public function getMapped(): array { return $this->mapped; } @@ -79,7 +79,7 @@ class BasicConverter /** * @param array $mapped */ - public function setMapped($mapped) + public function setMapped(array $mapped) { $this->mapped = $mapped; } @@ -87,7 +87,7 @@ class BasicConverter /** * @return string */ - public function getValue() + public function getValue(): string { return $this->value; } @@ -95,7 +95,7 @@ class BasicConverter /** * @param string $value */ - public function setValue($value) + public function setValue(string $value) { $this->value = $value; } diff --git a/app/Helpers/Csv/Converter/BillId.php b/app/Helpers/Csv/Converter/BillId.php index 77e9efa000..b71f7b7fc4 100644 --- a/app/Helpers/Csv/Converter/BillId.php +++ b/app/Helpers/Csv/Converter/BillId.php @@ -16,7 +16,7 @@ class BillId extends BasicConverter implements ConverterInterface /** * @return Bill */ - public function convert() + public function convert(): Bill { /** @var BillRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/BillName.php b/app/Helpers/Csv/Converter/BillName.php index 5f6c008f25..043bf770f7 100644 --- a/app/Helpers/Csv/Converter/BillName.php +++ b/app/Helpers/Csv/Converter/BillName.php @@ -16,7 +16,7 @@ class BillName extends BasicConverter implements ConverterInterface /** * @return Bill */ - public function convert() + public function convert(): Bill { /** @var BillRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/BudgetId.php b/app/Helpers/Csv/Converter/BudgetId.php index 896178e822..f318464ff6 100644 --- a/app/Helpers/Csv/Converter/BudgetId.php +++ b/app/Helpers/Csv/Converter/BudgetId.php @@ -16,7 +16,7 @@ class BudgetId extends BasicConverter implements ConverterInterface /** * @return Budget */ - public function convert() + public function convert(): Budget { /** @var BudgetRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/BudgetName.php b/app/Helpers/Csv/Converter/BudgetName.php index dcf8844d3d..375442d08b 100644 --- a/app/Helpers/Csv/Converter/BudgetName.php +++ b/app/Helpers/Csv/Converter/BudgetName.php @@ -17,7 +17,7 @@ class BudgetName extends BasicConverter implements ConverterInterface /** * @return Budget */ - public function convert() + public function convert(): Budget { /** @var BudgetRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/CategoryId.php b/app/Helpers/Csv/Converter/CategoryId.php index 67c91fdb2b..b702f91a92 100644 --- a/app/Helpers/Csv/Converter/CategoryId.php +++ b/app/Helpers/Csv/Converter/CategoryId.php @@ -16,7 +16,7 @@ class CategoryId extends BasicConverter implements ConverterInterface /** * @return Category */ - public function convert() + public function convert(): Budget { /** @var SingleCategoryRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/CategoryName.php b/app/Helpers/Csv/Converter/CategoryName.php index 8ce036eddc..4ec0dc0ecd 100644 --- a/app/Helpers/Csv/Converter/CategoryName.php +++ b/app/Helpers/Csv/Converter/CategoryName.php @@ -17,7 +17,7 @@ class CategoryName extends BasicConverter implements ConverterInterface /** * @return Category */ - public function convert() + public function convert(): Budget { /** @var SingleCategoryRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/ConverterInterface.php b/app/Helpers/Csv/Converter/ConverterInterface.php index 643d17b6c1..b1b6f2922b 100644 --- a/app/Helpers/Csv/Converter/ConverterInterface.php +++ b/app/Helpers/Csv/Converter/ConverterInterface.php @@ -24,21 +24,21 @@ interface ConverterInterface * @param string $field * */ - public function setField($field); + public function setField(string $field); /** * @param int $index */ - public function setIndex($index); + public function setIndex(int $index); /** * @param array $mapped */ - public function setMapped($mapped); + public function setMapped(array $mapped); /** * @param string $value */ - public function setValue($value); + public function setValue(string $value); } diff --git a/app/Helpers/Csv/Converter/CurrencyCode.php b/app/Helpers/Csv/Converter/CurrencyCode.php index 7054b1f5d5..07e7c170fb 100644 --- a/app/Helpers/Csv/Converter/CurrencyCode.php +++ b/app/Helpers/Csv/Converter/CurrencyCode.php @@ -16,7 +16,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface /** * @return TransactionCurrency */ - public function convert() + public function convert(): TransactionCurrency { /** @var CurrencyRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/CurrencyId.php b/app/Helpers/Csv/Converter/CurrencyId.php index ce21771f12..4ee65e950b 100644 --- a/app/Helpers/Csv/Converter/CurrencyId.php +++ b/app/Helpers/Csv/Converter/CurrencyId.php @@ -16,7 +16,7 @@ class CurrencyId extends BasicConverter implements ConverterInterface /** * @return TransactionCurrency */ - public function convert() + public function convert(): TransactionCurrency { /** @var CurrencyRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/CurrencyName.php b/app/Helpers/Csv/Converter/CurrencyName.php index 336c533e6b..29fa7828c3 100644 --- a/app/Helpers/Csv/Converter/CurrencyName.php +++ b/app/Helpers/Csv/Converter/CurrencyName.php @@ -16,7 +16,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface /** * @return TransactionCurrency */ - public function convert() + public function convert(): TransactionCurrency { /** @var CurrencyRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/CurrencySymbol.php b/app/Helpers/Csv/Converter/CurrencySymbol.php index b27c122db3..4d0de8d70c 100644 --- a/app/Helpers/Csv/Converter/CurrencySymbol.php +++ b/app/Helpers/Csv/Converter/CurrencySymbol.php @@ -16,7 +16,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface /** * @return TransactionCurrency */ - public function convert() + public function convert(): TransactionCurrency { /** @var CurrencyRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/Date.php b/app/Helpers/Csv/Converter/Date.php index ca532738ba..e11338246f 100644 --- a/app/Helpers/Csv/Converter/Date.php +++ b/app/Helpers/Csv/Converter/Date.php @@ -19,7 +19,7 @@ class Date extends BasicConverter implements ConverterInterface * @return Carbon * @throws FireflyException */ - public function convert() + public function convert(): Carbon { $format = session('csv-date-format'); try { diff --git a/app/Helpers/Csv/Converter/Description.php b/app/Helpers/Csv/Converter/Description.php index 98cfd1b4bf..ac12542a46 100644 --- a/app/Helpers/Csv/Converter/Description.php +++ b/app/Helpers/Csv/Converter/Description.php @@ -14,7 +14,7 @@ class Description extends BasicConverter implements ConverterInterface /** * @return string */ - public function convert() + public function convert(): string { $description = $this->data['description'] ?? ''; diff --git a/app/Helpers/Csv/Converter/INGDebetCredit.php b/app/Helpers/Csv/Converter/INGDebetCredit.php index ac36539e22..1b01998232 100644 --- a/app/Helpers/Csv/Converter/INGDebetCredit.php +++ b/app/Helpers/Csv/Converter/INGDebetCredit.php @@ -24,7 +24,7 @@ class INGDebetCredit extends BasicConverter implements ConverterInterface /** * @return int */ - public function convert() + public function convert(): int { if ($this->value === 'Af') { return -1; diff --git a/app/Helpers/Csv/Converter/OpposingAccountId.php b/app/Helpers/Csv/Converter/OpposingAccountId.php index 3c11791fb8..6b6ec84f60 100644 --- a/app/Helpers/Csv/Converter/OpposingAccountId.php +++ b/app/Helpers/Csv/Converter/OpposingAccountId.php @@ -17,7 +17,7 @@ class OpposingAccountId extends BasicConverter implements ConverterInterface /** * @return Account */ - public function convert() + public function convert(): Account { /** @var AccountRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/RabobankDebetCredit.php b/app/Helpers/Csv/Converter/RabobankDebetCredit.php index a0945fcf5e..ac73d9e206 100644 --- a/app/Helpers/Csv/Converter/RabobankDebetCredit.php +++ b/app/Helpers/Csv/Converter/RabobankDebetCredit.php @@ -15,7 +15,7 @@ class RabobankDebetCredit extends BasicConverter implements ConverterInterface /** * @return int */ - public function convert() + public function convert(): int { if ($this->value == 'D') { return -1; diff --git a/app/Helpers/Csv/Converter/TagsComma.php b/app/Helpers/Csv/Converter/TagsComma.php index 6c8715b01c..a38d64cce8 100644 --- a/app/Helpers/Csv/Converter/TagsComma.php +++ b/app/Helpers/Csv/Converter/TagsComma.php @@ -16,7 +16,7 @@ class TagsComma extends BasicConverter implements ConverterInterface /** * @return Collection */ - public function convert() + public function convert(): Collection { /** @var TagRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface'); diff --git a/app/Helpers/Csv/Converter/TagsSpace.php b/app/Helpers/Csv/Converter/TagsSpace.php index 72f41503dc..60eeba8b7d 100644 --- a/app/Helpers/Csv/Converter/TagsSpace.php +++ b/app/Helpers/Csv/Converter/TagsSpace.php @@ -16,7 +16,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface /** * @return Collection */ - public function convert() + public function convert(): Collection { /** @var TagRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface'); diff --git a/app/Helpers/Csv/Data.php b/app/Helpers/Csv/Data.php index b45edd5211..606ae42bbe 100644 --- a/app/Helpers/Csv/Data.php +++ b/app/Helpers/Csv/Data.php @@ -57,7 +57,7 @@ class Data * * @return string */ - public function getCsvFileContent() + public function getCsvFileContent(): string { return $this->csvFileContent ?? ''; } @@ -72,10 +72,10 @@ class Data } /** - * + * FIXME may return null * @return string */ - public function getCsvFileLocation() + public function getCsvFileLocation(): string { return $this->csvFileLocation; } @@ -91,10 +91,10 @@ class Data } /** - * + * FIXME may return null * @return string */ - public function getDateFormat() + public function getDateFormat(): string { return $this->dateFormat; } @@ -110,10 +110,10 @@ class Data } /** - * + * FIXME may return null * @return string */ - public function getDelimiter() + public function getDelimiter(): string { return $this->delimiter; } @@ -132,7 +132,7 @@ class Data * * @return array */ - public function getMap() + public function getMap(): array { return $this->map; } @@ -151,7 +151,7 @@ class Data * * @return array */ - public function getMapped() + public function getMapped(): array { return $this->mapped; } @@ -170,7 +170,7 @@ class Data * * @return Reader */ - public function getReader() + public function getReader(): Reader { if (!is_null($this->csvFileContent) && strlen($this->csvFileContent) === 0) { $this->loadCsvFile(); @@ -188,7 +188,7 @@ class Data * * @return array */ - public function getRoles() + public function getRoles(): array { return $this->roles; } @@ -207,7 +207,7 @@ class Data * * @return array */ - public function getSpecifix() + public function getSpecifix(): array { return is_array($this->specifix) ? $this->specifix : []; } @@ -226,7 +226,7 @@ class Data * * @return bool */ - public function hasHeaders() + public function hasHeaders(): bool { return $this->hasHeaders; } diff --git a/app/Helpers/Csv/Importer.php b/app/Helpers/Csv/Importer.php index 77553dab89..39cedcb6b0 100644 --- a/app/Helpers/Csv/Importer.php +++ b/app/Helpers/Csv/Importer.php @@ -57,7 +57,7 @@ class Importer * * @return array */ - public function getErrors() + public function getErrors(): array { return $this->errors; } @@ -67,7 +67,7 @@ class Importer * * @return int */ - public function getImported() + public function getImported(): int { return $this->imported; } @@ -75,7 +75,7 @@ class Importer /** * @return Collection */ - public function getJournals() + public function getJournals(): Collection { return $this->journals; } @@ -85,7 +85,7 @@ class Importer * * @return int */ - public function getRows() + public function getRows(): int { return $this->rows; } @@ -93,7 +93,7 @@ class Importer /** * @return array */ - public function getSpecifix() + public function getSpecifix(): array { return is_array($this->specifix) ? $this->specifix : []; } @@ -144,10 +144,11 @@ class Importer } /** - * + * FIXME can return text + * * @return TransactionJournal|string */ - protected function createTransactionJournal() + protected function createTransactionJournal(): TransactionJournal { $date = $this->importData['date']; if (is_null($this->importData['date'])) { diff --git a/app/Helpers/Csv/Mapper/AnyAccount.php b/app/Helpers/Csv/Mapper/AnyAccount.php index 573e025f04..f4486d8e8b 100644 --- a/app/Helpers/Csv/Mapper/AnyAccount.php +++ b/app/Helpers/Csv/Mapper/AnyAccount.php @@ -16,7 +16,7 @@ class AnyAccount implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $result = Auth::user()->accounts()->with('accountType')->orderBy('accounts.name', 'ASC')->get(['accounts.*']); diff --git a/app/Helpers/Csv/Mapper/AssetAccount.php b/app/Helpers/Csv/Mapper/AssetAccount.php index 4060bc0055..c2dd12bac7 100644 --- a/app/Helpers/Csv/Mapper/AssetAccount.php +++ b/app/Helpers/Csv/Mapper/AssetAccount.php @@ -17,7 +17,7 @@ class AssetAccount implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $result = Auth::user()->accounts()->with( ['accountmeta' => function (HasMany $query) { diff --git a/app/Helpers/Csv/Mapper/Bill.php b/app/Helpers/Csv/Mapper/Bill.php index d0f9cb8c3d..5c56324df6 100644 --- a/app/Helpers/Csv/Mapper/Bill.php +++ b/app/Helpers/Csv/Mapper/Bill.php @@ -16,7 +16,7 @@ class Bill implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $result = Auth::user()->bills()->get(['bills.*']); $list = []; diff --git a/app/Helpers/Csv/Mapper/Budget.php b/app/Helpers/Csv/Mapper/Budget.php index f5de27f0ff..972a75f5a1 100644 --- a/app/Helpers/Csv/Mapper/Budget.php +++ b/app/Helpers/Csv/Mapper/Budget.php @@ -16,7 +16,7 @@ class Budget implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $result = Auth::user()->budgets()->get(['budgets.*']); $list = []; diff --git a/app/Helpers/Csv/Mapper/Category.php b/app/Helpers/Csv/Mapper/Category.php index cd9af4aba9..48d53135eb 100644 --- a/app/Helpers/Csv/Mapper/Category.php +++ b/app/Helpers/Csv/Mapper/Category.php @@ -16,7 +16,7 @@ class Category implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $result = Auth::user()->categories()->get(['categories.*']); $list = []; diff --git a/app/Helpers/Csv/Mapper/MapperInterface.php b/app/Helpers/Csv/Mapper/MapperInterface.php index a8822163b4..78fd647a99 100644 --- a/app/Helpers/Csv/Mapper/MapperInterface.php +++ b/app/Helpers/Csv/Mapper/MapperInterface.php @@ -12,5 +12,5 @@ interface MapperInterface /** * @return array */ - public function getMap(); + public function getMap(): array; } diff --git a/app/Helpers/Csv/Mapper/Tag.php b/app/Helpers/Csv/Mapper/Tag.php index d0a7feba36..9fff15873e 100644 --- a/app/Helpers/Csv/Mapper/Tag.php +++ b/app/Helpers/Csv/Mapper/Tag.php @@ -16,7 +16,7 @@ class Tag implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $result = Auth::user()->budgets()->get(['tags.*']); $list = []; diff --git a/app/Helpers/Csv/Mapper/TransactionCurrency.php b/app/Helpers/Csv/Mapper/TransactionCurrency.php index 636b19520d..3712b98f5e 100644 --- a/app/Helpers/Csv/Mapper/TransactionCurrency.php +++ b/app/Helpers/Csv/Mapper/TransactionCurrency.php @@ -15,7 +15,7 @@ class TransactionCurrency implements MapperInterface /** * @return array */ - public function getMap() + public function getMap(): array { $currencies = TC::get(); $list = []; diff --git a/app/Helpers/Csv/PostProcessing/Amount.php b/app/Helpers/Csv/PostProcessing/Amount.php index fc5f9b9fc7..b955fca50d 100644 --- a/app/Helpers/Csv/PostProcessing/Amount.php +++ b/app/Helpers/Csv/PostProcessing/Amount.php @@ -17,7 +17,7 @@ class Amount implements PostProcessorInterface /** * @return array */ - public function process() + public function process(): array { $amount = $this->data['amount'] ?? '0'; $modifier = strval($this->data['amount-modifier']); diff --git a/app/Helpers/Csv/PostProcessing/AssetAccount.php b/app/Helpers/Csv/PostProcessing/AssetAccount.php index 7ee7986b76..542c72e0be 100644 --- a/app/Helpers/Csv/PostProcessing/AssetAccount.php +++ b/app/Helpers/Csv/PostProcessing/AssetAccount.php @@ -23,7 +23,7 @@ class AssetAccount implements PostProcessorInterface /** * @return array */ - public function process() + public function process(): array { $result = $this->checkIdNameObject(); // has object in ID or Name? if (!is_null($result)) { diff --git a/app/Helpers/Csv/PostProcessing/Bill.php b/app/Helpers/Csv/PostProcessing/Bill.php index de81b8b3c4..9369fc26ad 100644 --- a/app/Helpers/Csv/PostProcessing/Bill.php +++ b/app/Helpers/Csv/PostProcessing/Bill.php @@ -16,7 +16,7 @@ class Bill implements PostProcessorInterface /** * @return array */ - public function process() + public function process(): array { // get bill id. diff --git a/app/Helpers/Csv/PostProcessing/Currency.php b/app/Helpers/Csv/PostProcessing/Currency.php index 91d34f8677..62b14fb430 100644 --- a/app/Helpers/Csv/PostProcessing/Currency.php +++ b/app/Helpers/Csv/PostProcessing/Currency.php @@ -19,7 +19,7 @@ class Currency implements PostProcessorInterface /** * @return array */ - public function process() + public function process(): array { // fix currency diff --git a/app/Helpers/Csv/PostProcessing/Description.php b/app/Helpers/Csv/PostProcessing/Description.php index 64c0e8ed8b..51ddca637b 100644 --- a/app/Helpers/Csv/PostProcessing/Description.php +++ b/app/Helpers/Csv/PostProcessing/Description.php @@ -16,7 +16,7 @@ class Description implements PostProcessorInterface /** * @return array */ - public function process() + public function process(): array { $description = $this->data['description'] ?? ''; $this->data['description'] = trim($description); diff --git a/app/Helpers/Csv/PostProcessing/OpposingAccount.php b/app/Helpers/Csv/PostProcessing/OpposingAccount.php index 0bc038bba3..dece4bea05 100644 --- a/app/Helpers/Csv/PostProcessing/OpposingAccount.php +++ b/app/Helpers/Csv/PostProcessing/OpposingAccount.php @@ -22,7 +22,7 @@ class OpposingAccount implements PostProcessorInterface /** * @return array */ - public function process() + public function process(): array { // three values: // opposing-account-id, opposing-account-iban, opposing-account-name diff --git a/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php b/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php index a6a793c3d5..bc67b7d9cf 100644 --- a/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php +++ b/app/Helpers/Csv/PostProcessing/PostProcessorInterface.php @@ -14,7 +14,7 @@ interface PostProcessorInterface /** * @return array */ - public function process(); + public function process(): array; /** * @param array $data diff --git a/app/Helpers/Csv/Specifix/AbnAmroDescription.php b/app/Helpers/Csv/Specifix/AbnAmroDescription.php index 19eb273d93..4c3cfce346 100644 --- a/app/Helpers/Csv/Specifix/AbnAmroDescription.php +++ b/app/Helpers/Csv/Specifix/AbnAmroDescription.php @@ -32,7 +32,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface /** * @return array */ - public function fix() + public function fix(): array { // Try to parse the description in known formats. $parsed = $this->parseSepaDescription() || $this->parseTRTPDescription() || $this->parseGEABEADescription() || $this->parseABNAMRODescription(); diff --git a/app/Helpers/Csv/Specifix/Dummy.php b/app/Helpers/Csv/Specifix/Dummy.php index 2e4263a4d5..5d84545619 100644 --- a/app/Helpers/Csv/Specifix/Dummy.php +++ b/app/Helpers/Csv/Specifix/Dummy.php @@ -26,7 +26,7 @@ class Dummy extends Specifix implements SpecifixInterface /** * @return array */ - public function fix() + public function fix(): array { return $this->data; diff --git a/app/Helpers/Csv/Specifix/RabobankDescription.php b/app/Helpers/Csv/Specifix/RabobankDescription.php index 249fc00cfe..19e018b5ec 100644 --- a/app/Helpers/Csv/Specifix/RabobankDescription.php +++ b/app/Helpers/Csv/Specifix/RabobankDescription.php @@ -29,7 +29,7 @@ class RabobankDescription extends Specifix implements SpecifixInterface /** * @return array */ - public function fix() + public function fix(): array { $this->rabobankFixEmptyOpposing(); diff --git a/app/Helpers/Csv/Specifix/Specifix.php b/app/Helpers/Csv/Specifix/Specifix.php index 37c40ccc27..fcceeb3652 100644 --- a/app/Helpers/Csv/Specifix/Specifix.php +++ b/app/Helpers/Csv/Specifix/Specifix.php @@ -24,7 +24,7 @@ class Specifix /** * @return int */ - public function getProcessorType() + public function getProcessorType(): int { return $this->processorType; } diff --git a/app/Helpers/Csv/Specifix/SpecifixInterface.php b/app/Helpers/Csv/Specifix/SpecifixInterface.php index b6534fbe51..79e701d8fc 100644 --- a/app/Helpers/Csv/Specifix/SpecifixInterface.php +++ b/app/Helpers/Csv/Specifix/SpecifixInterface.php @@ -20,7 +20,7 @@ interface SpecifixInterface /** * @return int */ - public function getProcessorType(); + public function getProcessorType(): int; /** * @param array $data diff --git a/app/Helpers/Csv/Wizard.php b/app/Helpers/Csv/Wizard.php index dcb8424dc3..33d76f0499 100644 --- a/app/Helpers/Csv/Wizard.php +++ b/app/Helpers/Csv/Wizard.php @@ -29,7 +29,7 @@ class Wizard implements WizardInterface * * @return array */ - public function getMappableValues(Reader $reader, array $map, bool $hasHeaders) + public function getMappableValues(Reader $reader, array $map, bool $hasHeaders): array { $values = []; /* @@ -59,7 +59,7 @@ class Wizard implements WizardInterface * * @return array */ - public function processSelectedMapping(array $roles, array $map) + public function processSelectedMapping(array $roles, array $map): array { $configRoles = Config::get('csv.roles'); $maps = []; @@ -86,7 +86,7 @@ class Wizard implements WizardInterface * * @return array */ - public function processSelectedRoles(array $input) + public function processSelectedRoles(array $input): array { $roles = []; @@ -110,7 +110,7 @@ class Wizard implements WizardInterface * * @return bool */ - public function sessionHasValues(array $fields) + public function sessionHasValues(array $fields): bool { foreach ($fields as $field) { if (!Session::has($field)) { @@ -129,7 +129,7 @@ class Wizard implements WizardInterface * @return array * @throws FireflyException */ - public function showOptions(array $map) + public function showOptions(array $map): array { $options = []; foreach ($map as $index => $columnRole) { @@ -157,7 +157,7 @@ class Wizard implements WizardInterface * * @return string */ - public function storeCsvFile(string $path) + public function storeCsvFile(string $path): string { $time = str_replace(' ', '-', microtime()); $fileName = 'csv-upload-' . Auth::user()->id . '-' . $time . '.csv.encrypted'; diff --git a/app/Helpers/Csv/WizardInterface.php b/app/Helpers/Csv/WizardInterface.php index 815a432a43..815a800c27 100644 --- a/app/Helpers/Csv/WizardInterface.php +++ b/app/Helpers/Csv/WizardInterface.php @@ -19,7 +19,7 @@ interface WizardInterface * * @return array */ - public function getMappableValues(Reader $reader, array $map, bool $hasHeaders); + public function getMappableValues(Reader $reader, array $map, bool $hasHeaders): array; /** * @param array $roles @@ -27,34 +27,34 @@ interface WizardInterface * * @return array */ - public function processSelectedMapping(array $roles, array $map); + public function processSelectedMapping(array $roles, array $map): array; /** * @param array $input * * @return array */ - public function processSelectedRoles(array $input); + public function processSelectedRoles(array $input): array; /** * @param array $fields * * @return bool */ - public function sessionHasValues(array $fields); + public function sessionHasValues(array $fields): bool; /** * @param array $map * * @return array */ - public function showOptions(array $map); + public function showOptions(array $map): array; /** * @param string $path * * @return string */ - public function storeCsvFile(string $path); + public function storeCsvFile(string $path): string; } diff --git a/app/Helpers/FiscalHelper.php b/app/Helpers/FiscalHelper.php index 0345f3427e..3f5c9eebc9 100644 --- a/app/Helpers/FiscalHelper.php +++ b/app/Helpers/FiscalHelper.php @@ -36,7 +36,7 @@ class FiscalHelper implements FiscalHelperInterface * * @return Carbon date object */ - public function endOfFiscalYear(Carbon $date) + public function endOfFiscalYear(Carbon $date): Carbon { // get start of fiscal year for passed date $endDate = $this->startOfFiscalYear($date); @@ -57,7 +57,7 @@ class FiscalHelper implements FiscalHelperInterface * * @return Carbon date object */ - public function startOfFiscalYear(Carbon $date) + public function startOfFiscalYear(Carbon $date): Carbon { // get start mm-dd. Then create a start date in the year passed. $startDate = clone $date; diff --git a/app/Helpers/FiscalHelperInterface.php b/app/Helpers/FiscalHelperInterface.php index b812fb9324..1d31ad0e18 100644 --- a/app/Helpers/FiscalHelperInterface.php +++ b/app/Helpers/FiscalHelperInterface.php @@ -21,7 +21,7 @@ interface FiscalHelperInterface * * @return Carbon date object */ - public function endOfFiscalYear(Carbon $date); + public function endOfFiscalYear(Carbon $date): Carbon; /** * This method produces a clone of the Carbon date object passed, checks preferences @@ -31,6 +31,6 @@ interface FiscalHelperInterface * * @return Carbon date object */ - public function startOfFiscalYear(Carbon $date); + public function startOfFiscalYear(Carbon $date): Carbon; } diff --git a/app/Helpers/Report/AccountReportHelper.php b/app/Helpers/Report/AccountReportHelper.php index 1a1157d0ec..43d58a136d 100644 --- a/app/Helpers/Report/AccountReportHelper.php +++ b/app/Helpers/Report/AccountReportHelper.php @@ -34,7 +34,7 @@ class AccountReportHelper implements AccountReportHelperInterface * * @return AccountCollection */ - public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts) + public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts): AccountCollection { $startAmount = '0'; $endAmount = '0'; diff --git a/app/Helpers/Report/AccountReportHelperInterface.php b/app/Helpers/Report/AccountReportHelperInterface.php index 02e56274f3..673168b18a 100644 --- a/app/Helpers/Report/AccountReportHelperInterface.php +++ b/app/Helpers/Report/AccountReportHelperInterface.php @@ -32,6 +32,6 @@ interface AccountReportHelperInterface * * @return AccountCollection */ - public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts); + public function getAccountReport(Carbon $start, Carbon $end, Collection $accounts): AccountCollection; } diff --git a/app/Helpers/Report/BalanceReportHelper.php b/app/Helpers/Report/BalanceReportHelper.php index cc5c9c7a0e..a529ac104a 100644 --- a/app/Helpers/Report/BalanceReportHelper.php +++ b/app/Helpers/Report/BalanceReportHelper.php @@ -58,7 +58,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface * * @return Balance */ - public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts) + public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts): Balance { $balance = new Balance; @@ -91,7 +91,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface * * @return BalanceLine */ - private function createBalanceLine(BudgetModel $budget, Collection $accounts, Collection $spentData) + private function createBalanceLine(BudgetModel $budget, Collection $accounts, Collection $spentData): BalanceLine { $line = new BalanceLine; $line->setBudget($budget); @@ -128,7 +128,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface * * @return BalanceLine */ - private function createDifferenceBalanceLine(Collection $accounts, Collection $spentData, Carbon $start, Carbon $end) + private function createDifferenceBalanceLine(Collection $accounts, Collection $spentData, Carbon $start, Carbon $end): BalanceLine { $diff = new BalanceLine; $tagsLeft = $this->tagRepository->allCoveredByBalancingActs($accounts, $start, $end); @@ -173,7 +173,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface * * @return BalanceLine */ - private function createEmptyBalanceLine(Collection $accounts, Collection $spentData) + private function createEmptyBalanceLine(Collection $accounts, Collection $spentData): BalanceLine { $empty = new BalanceLine; @@ -206,7 +206,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface * * @return BalanceLine */ - private function createTagsBalanceLine(Collection $accounts, Carbon $start, Carbon $end) + private function createTagsBalanceLine(Collection $accounts, Carbon $start, Carbon $end): BalanceLine { $tags = new BalanceLine; $tagsLeft = $this->tagRepository->allCoveredByBalancingActs($accounts, $start, $end); diff --git a/app/Helpers/Report/BalanceReportHelperInterface.php b/app/Helpers/Report/BalanceReportHelperInterface.php index d225e94781..9cdcdb19b7 100644 --- a/app/Helpers/Report/BalanceReportHelperInterface.php +++ b/app/Helpers/Report/BalanceReportHelperInterface.php @@ -29,5 +29,5 @@ interface BalanceReportHelperInterface * * @return Balance */ - public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts); + public function getBalanceReport(Carbon $start, Carbon $end, Collection $accounts): Balance; } diff --git a/app/Helpers/Report/BudgetReportHelperInterface.php b/app/Helpers/Report/BudgetReportHelperInterface.php index 1096a1b027..b1cd8fb955 100644 --- a/app/Helpers/Report/BudgetReportHelperInterface.php +++ b/app/Helpers/Report/BudgetReportHelperInterface.php @@ -29,5 +29,5 @@ interface BudgetReportHelperInterface * * @return BudgetCollection */ - public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts); + public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts): BudgetCollection; } diff --git a/app/Helpers/Report/ReportHelper.php b/app/Helpers/Report/ReportHelper.php index 8726299a8c..d1f70d7826 100644 --- a/app/Helpers/Report/ReportHelper.php +++ b/app/Helpers/Report/ReportHelper.php @@ -61,7 +61,7 @@ class ReportHelper implements ReportHelperInterface * * @return BillCollection */ - public function getBillReport(Carbon $start, Carbon $end, Collection $accounts) + public function getBillReport(Carbon $start, Carbon $end, Collection $accounts): BillCollection { /** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */ $repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface'); @@ -108,7 +108,7 @@ class ReportHelper implements ReportHelperInterface * * @return CategoryCollection */ - public function getCategoryReport(Carbon $start, Carbon $end, Collection $accounts) + public function getCategoryReport(Carbon $start, Carbon $end, Collection $accounts): CategoryCollection { $object = new CategoryCollection; @@ -135,7 +135,7 @@ class ReportHelper implements ReportHelperInterface * * @return Expense */ - public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts) + public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts): Expense { $object = new Expense; $set = $this->query->expense($accounts, $start, $end); @@ -157,7 +157,7 @@ class ReportHelper implements ReportHelperInterface * * @return Income */ - public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts) + public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): Income { $object = new Income; $set = $this->query->income($accounts, $start, $end); @@ -175,7 +175,7 @@ class ReportHelper implements ReportHelperInterface * * @return array */ - public function listOfMonths(Carbon $date) + public function listOfMonths(Carbon $date): array { /** @var FiscalHelperInterface $fiscalHelper */ $fiscalHelper = app('FireflyIII\Helpers\FiscalHelperInterface'); diff --git a/app/Helpers/Report/ReportHelperInterface.php b/app/Helpers/Report/ReportHelperInterface.php index e45fd3b56f..33be9fe4e8 100644 --- a/app/Helpers/Report/ReportHelperInterface.php +++ b/app/Helpers/Report/ReportHelperInterface.php @@ -30,7 +30,7 @@ interface ReportHelperInterface * * @return BillCollection */ - public function getBillReport(Carbon $start, Carbon $end, Collection $accounts); + public function getBillReport(Carbon $start, Carbon $end, Collection $accounts): BillCollection; /** * @param Carbon $start @@ -39,7 +39,7 @@ interface ReportHelperInterface * * @return CategoryCollection */ - public function getCategoryReport(Carbon $start, Carbon $end, Collection $accounts); + public function getCategoryReport(Carbon $start, Carbon $end, Collection $accounts): CategoryCollection; /** * Get a full report on the users expenses during the period for a list of accounts. @@ -50,7 +50,7 @@ interface ReportHelperInterface * * @return Expense */ - public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts); + public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts): Expense; /** * Get a full report on the users incomes during the period for the given accounts. @@ -61,14 +61,14 @@ interface ReportHelperInterface * * @return Income */ - public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts); + public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): Income; /** * @param Carbon $date * * @return array */ - public function listOfMonths(Carbon $date); + public function listOfMonths(Carbon $date): array; /** * Returns an array of tags and their comparitive size with amounts bla bla. diff --git a/app/Helpers/Report/ReportQuery.php b/app/Helpers/Report/ReportQuery.php index da7269002f..6910af7b7f 100644 --- a/app/Helpers/Report/ReportQuery.php +++ b/app/Helpers/Report/ReportQuery.php @@ -28,7 +28,7 @@ class ReportQuery implements ReportQueryInterface * * @return array */ - public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end) + public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end): array { $ids = $accounts->pluck('id')->toArray(); $query = Auth::user()->transactionjournals() @@ -72,7 +72,7 @@ class ReportQuery implements ReportQueryInterface * * @return Collection */ - public function expense(Collection $accounts, Carbon $start, Carbon $end) + public function expense(Collection $accounts, Carbon $start, Carbon $end): array { $ids = $accounts->pluck('id')->toArray(); $set = Auth::user()->transactionjournals() @@ -107,7 +107,7 @@ class ReportQuery implements ReportQueryInterface * * @return Collection */ - public function income(Collection $accounts, Carbon $start, Carbon $end) + public function income(Collection $accounts, Carbon $start, Carbon $end): Collection { $ids = $accounts->pluck('id')->toArray(); $set = Auth::user()->transactionjournals() @@ -142,7 +142,7 @@ class ReportQuery implements ReportQueryInterface * * @return array */ - public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end) + public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end): array { $ids = $accounts->pluck('id')->toArray(); $query = Auth::user()->transactionjournals() diff --git a/app/Helpers/Report/ReportQueryInterface.php b/app/Helpers/Report/ReportQueryInterface.php index db1efc6d5a..f746710ffb 100644 --- a/app/Helpers/Report/ReportQueryInterface.php +++ b/app/Helpers/Report/ReportQueryInterface.php @@ -24,7 +24,7 @@ interface ReportQueryInterface * * @return array */ - public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end); + public function earnedPerMonth(Collection $accounts, Carbon $start, Carbon $end): array; /** * This method returns all the "out" transaction journals for the given account and given period. The amount @@ -36,7 +36,7 @@ interface ReportQueryInterface * * @return Collection */ - public function expense(Collection $accounts, Carbon $start, Carbon $end); + public function expense(Collection $accounts, Carbon $start, Carbon $end): Collection; /** * This method returns all the "in" transaction journals for the given account and given period. The amount @@ -48,7 +48,7 @@ interface ReportQueryInterface * * @return Collection */ - public function income(Collection $accounts, Carbon $start, Carbon $end); + public function income(Collection $accounts, Carbon $start, Carbon $end): Collection; /** * Returns an array of the amount of money spent in the given accounts (on withdrawals, opening balances and transfers) @@ -60,7 +60,7 @@ interface ReportQueryInterface * * @return array */ - public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end); + public function spentPerMonth(Collection $accounts, Carbon $start, Carbon $end): array; }