mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-07 06:31:22 +00:00
Fixed all problems related to strict types.
This commit is contained in:
@@ -23,7 +23,7 @@ class Steam
|
||||
* @param \Carbon\Carbon $date
|
||||
* @param bool $ignoreVirtualBalance
|
||||
*
|
||||
* @return float
|
||||
* @return string
|
||||
*/
|
||||
public function balance(Account $account, Carbon $date, $ignoreVirtualBalance = false)
|
||||
{
|
||||
@@ -45,11 +45,11 @@ class Steam
|
||||
)->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount');
|
||||
|
||||
if (!$ignoreVirtualBalance) {
|
||||
$balance = bcadd($balance, $account->virtual_balance);
|
||||
$balance = bcadd(strval($balance), $account->virtual_balance);
|
||||
}
|
||||
$cache->store(round($balance, 2));
|
||||
$cache->store($balance);
|
||||
|
||||
return round($balance, 2);
|
||||
return $balance;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,14 +177,14 @@ class Steam
|
||||
|
||||
if (!(strpos($string, 'k') === false)) {
|
||||
// has a K in it, remove the K and multiply by 1024.
|
||||
$bytes = bcmul(rtrim($string, 'k'), 1024);
|
||||
$bytes = bcmul(rtrim($string, 'k'), '1024');
|
||||
|
||||
return intval($bytes);
|
||||
}
|
||||
|
||||
if (!(strpos($string, 'm') === false)) {
|
||||
// has a M in it, remove the M and multiply by 1048576.
|
||||
$bytes = bcmul(rtrim($string, 'm'), 1048576);
|
||||
$bytes = bcmul(rtrim($string, 'm'),'1048576');
|
||||
|
||||
return intval($bytes);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ use Twig_SimpleFunction;
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class TwigSupport
|
||||
* @todo these functions should be parameterized.
|
||||
*
|
||||
* @package FireflyIII\Support
|
||||
*/
|
||||
@@ -164,13 +165,14 @@ class General extends Twig_Extension
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Twig_SimpleFilter
|
||||
*/
|
||||
protected function formatAmount()
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatAmount', function ($string) {
|
||||
$value = is_null($string) ? '0' : $string;
|
||||
$value = is_null($string) ? '0' : strval($string);
|
||||
|
||||
return app('amount')->format($value);
|
||||
}, ['is_safe' => ['html']]
|
||||
@@ -184,7 +186,9 @@ class General extends Twig_Extension
|
||||
{
|
||||
return new Twig_SimpleFilter(
|
||||
'formatAmountPlain', function ($string) {
|
||||
return app('amount')->format($string, false);
|
||||
$value = is_null($string) ? '0' : strval($string);
|
||||
|
||||
return app('amount')->format($value, false);
|
||||
}, ['is_safe' => ['html']]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user