PHP7 compatible function definitions.

This commit is contained in:
James Cole 2016-04-06 16:37:28 +02:00
parent c8440af9a5
commit 250b2c2f53
71 changed files with 220 additions and 190 deletions

View File

@ -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;
}
/**

View File

@ -40,7 +40,7 @@ class BasicCollector
/**
* @return Collection
*/
public function getFiles()
public function getFiles(): Collection
{
return $this->files;
}

View File

@ -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

View File

@ -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;
}
/**

View File

@ -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();

View File

@ -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;
}

View File

@ -39,7 +39,7 @@ class BasicExporter
/**
* @return Collection
*/
public function getEntries()
public function getEntries(): Collection
{
return $this->entries;
}

View File

@ -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()

View File

@ -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

View File

@ -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;
}

View File

@ -25,7 +25,7 @@ interface CategoryChartGeneratorInterface
*
* @return array
*/
public function all(Collection $entries);
public function all(Collection $entries): array;
/**
* @param Collection $categories

View File

@ -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;
}
}

View File

@ -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;
}
/**

View File

@ -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');

View File

@ -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));

View File

@ -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');

View File

@ -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');

View File

@ -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;
}

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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);
}

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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');

View File

@ -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 {

View File

@ -14,7 +14,7 @@ class Description extends BasicConverter implements ConverterInterface
/**
* @return string
*/
public function convert()
public function convert(): string
{
$description = $this->data['description'] ?? '';

View File

@ -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;

View File

@ -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');

View File

@ -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;

View File

@ -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');

View File

@ -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');

View File

@ -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;
}

View File

@ -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'])) {

View File

@ -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.*']);

View File

@ -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) {

View File

@ -16,7 +16,7 @@ class Bill implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$result = Auth::user()->bills()->get(['bills.*']);
$list = [];

View File

@ -16,7 +16,7 @@ class Budget implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$result = Auth::user()->budgets()->get(['budgets.*']);
$list = [];

View File

@ -16,7 +16,7 @@ class Category implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$result = Auth::user()->categories()->get(['categories.*']);
$list = [];

View File

@ -12,5 +12,5 @@ interface MapperInterface
/**
* @return array
*/
public function getMap();
public function getMap(): array;
}

View File

@ -16,7 +16,7 @@ class Tag implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$result = Auth::user()->budgets()->get(['tags.*']);
$list = [];

View File

@ -15,7 +15,7 @@ class TransactionCurrency implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$currencies = TC::get();
$list = [];

View File

@ -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']);

View File

@ -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)) {

View File

@ -16,7 +16,7 @@ class Bill implements PostProcessorInterface
/**
* @return array
*/
public function process()
public function process(): array
{
// get bill id.

View File

@ -19,7 +19,7 @@ class Currency implements PostProcessorInterface
/**
* @return array
*/
public function process()
public function process(): array
{
// fix currency

View File

@ -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);

View File

@ -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

View File

@ -14,7 +14,7 @@ interface PostProcessorInterface
/**
* @return array
*/
public function process();
public function process(): array;
/**
* @param array $data

View File

@ -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();

View File

@ -26,7 +26,7 @@ class Dummy extends Specifix implements SpecifixInterface
/**
* @return array
*/
public function fix()
public function fix(): array
{
return $this->data;

View File

@ -29,7 +29,7 @@ class RabobankDescription extends Specifix implements SpecifixInterface
/**
* @return array
*/
public function fix()
public function fix(): array
{
$this->rabobankFixEmptyOpposing();

View File

@ -24,7 +24,7 @@ class Specifix
/**
* @return int
*/
public function getProcessorType()
public function getProcessorType(): int
{
return $this->processorType;
}

View File

@ -20,7 +20,7 @@ interface SpecifixInterface
/**
* @return int
*/
public function getProcessorType();
public function getProcessorType(): int;
/**
* @param array $data

View File

@ -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';

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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';

View File

@ -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;
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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');

View File

@ -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.

View File

@ -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()

View File

@ -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;
}