mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 01:06:46 +00:00
Added PHP7 return type statements.
This commit is contained in:
@@ -24,7 +24,7 @@ class Amount
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function format(string $amount, bool $coloured = true)
|
public function format(string $amount, bool $coloured = true): string
|
||||||
{
|
{
|
||||||
return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
|
return $this->formatAnything($this->getDefaultCurrency(), $amount, $coloured);
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ class Amount
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true)
|
public function formatAnything(TransactionCurrency $format, string $amount, bool $coloured = true): string
|
||||||
{
|
{
|
||||||
$locale = setlocale(LC_MONETARY, 0);
|
$locale = setlocale(LC_MONETARY, 0);
|
||||||
$float = floatval($amount);
|
$float = floatval($amount);
|
||||||
|
@@ -25,7 +25,7 @@ class Steam
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function balance(Account $account, Carbon $date, $ignoreVirtualBalance = false)
|
public function balance(Account $account, Carbon $date, $ignoreVirtualBalance = false): string
|
||||||
{
|
{
|
||||||
|
|
||||||
// abuse chart properties:
|
// abuse chart properties:
|
||||||
|
@@ -99,7 +99,7 @@ class General extends Twig_Extension
|
|||||||
protected function activeRoutePartialWhat(): Twig_SimpleFunction
|
protected function activeRoutePartialWhat(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'activeRoutePartialWhat', function ($context) {
|
'activeRoutePartialWhat', function ($context) : string {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$route = $args[1]; // name of the route.
|
$route = $args[1]; // name of the route.
|
||||||
$what = $args[2]; // name of the route.
|
$what = $args[2]; // name of the route.
|
||||||
@@ -123,7 +123,7 @@ class General extends Twig_Extension
|
|||||||
protected function activeRouteStrict(): Twig_SimpleFunction
|
protected function activeRouteStrict(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'activeRouteStrict', function () {
|
'activeRouteStrict', function () : string {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
$route = $args[0]; // name of the route.
|
$route = $args[0]; // name of the route.
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ class General extends Twig_Extension
|
|||||||
protected function balance(): Twig_SimpleFilter
|
protected function balance(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'balance', function (Account $account = null) {
|
'balance', function (Account $account = null) : string {
|
||||||
if (is_null($account)) {
|
if (is_null($account)) {
|
||||||
return 'NULL';
|
return 'NULL';
|
||||||
}
|
}
|
||||||
@@ -159,7 +159,7 @@ class General extends Twig_Extension
|
|||||||
protected function env(): Twig_SimpleFunction
|
protected function env(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'env', function (string $name, string $default) {
|
'env', function (string $name, string $default) : string {
|
||||||
return env($name, $default);
|
return env($name, $default);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -172,7 +172,7 @@ class General extends Twig_Extension
|
|||||||
protected function formatAmount(): Twig_SimpleFilter
|
protected function formatAmount(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'formatAmount', function (string $string) {
|
'formatAmount', function (string $string) : string {
|
||||||
|
|
||||||
return app('amount')->format($string);
|
return app('amount')->format($string);
|
||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
@@ -185,7 +185,7 @@ class General extends Twig_Extension
|
|||||||
protected function formatAmountPlain(): Twig_SimpleFilter
|
protected function formatAmountPlain(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'formatAmountPlain', function (string $string) {
|
'formatAmountPlain', function (string $string) : string {
|
||||||
|
|
||||||
return app('amount')->format($string, false);
|
return app('amount')->format($string, false);
|
||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
@@ -198,7 +198,7 @@ class General extends Twig_Extension
|
|||||||
protected function formatFilesize(): Twig_SimpleFilter
|
protected function formatFilesize(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'filesize', function (int $size) {
|
'filesize', function (int $size) : string {
|
||||||
|
|
||||||
// less than one GB, more than one MB
|
// less than one GB, more than one MB
|
||||||
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) {
|
||||||
@@ -221,7 +221,7 @@ class General extends Twig_Extension
|
|||||||
protected function formatJournal(): Twig_SimpleFilter
|
protected function formatJournal(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'formatJournal', function (TransactionJournal $journal) {
|
'formatJournal', function (TransactionJournal $journal) : string {
|
||||||
return app('amount')->formatJournal($journal);
|
return app('amount')->formatJournal($journal);
|
||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
);
|
);
|
||||||
@@ -233,7 +233,7 @@ class General extends Twig_Extension
|
|||||||
protected function formatTransaction(): Twig_SimpleFilter
|
protected function formatTransaction(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'formatTransaction', function (Transaction $transaction) {
|
'formatTransaction', function (Transaction $transaction) : string {
|
||||||
return app('amount')->formatTransaction($transaction);
|
return app('amount')->formatTransaction($transaction);
|
||||||
}, ['is_safe' => ['html']]
|
}, ['is_safe' => ['html']]
|
||||||
);
|
);
|
||||||
@@ -245,7 +245,7 @@ class General extends Twig_Extension
|
|||||||
protected function getAccountRole(): Twig_SimpleFilter
|
protected function getAccountRole(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'getAccountRole', function (string $name) {
|
'getAccountRole', function (string $name) : string {
|
||||||
return Config::get('firefly.accountRoles.' . $name);
|
return Config::get('firefly.accountRoles.' . $name);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -257,7 +257,7 @@ class General extends Twig_Extension
|
|||||||
protected function getCurrencyCode(): Twig_SimpleFunction
|
protected function getCurrencyCode(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'getCurrencyCode', function () {
|
'getCurrencyCode', function () : string {
|
||||||
return app('amount')->getCurrencyCode();
|
return app('amount')->getCurrencyCode();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -269,7 +269,7 @@ class General extends Twig_Extension
|
|||||||
protected function getCurrencySymbol(): Twig_SimpleFunction
|
protected function getCurrencySymbol(): Twig_SimpleFunction
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'getCurrencySymbol', function () {
|
'getCurrencySymbol', function () : string {
|
||||||
return app('amount')->getCurrencySymbol();
|
return app('amount')->getCurrencySymbol();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -281,7 +281,7 @@ class General extends Twig_Extension
|
|||||||
protected function mimeIcon(): Twig_SimpleFilter
|
protected function mimeIcon(): Twig_SimpleFilter
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFilter(
|
return new Twig_SimpleFilter(
|
||||||
'mimeIcon', function (string $string) {
|
'mimeIcon', function (string $string) : string {
|
||||||
switch ($string) {
|
switch ($string) {
|
||||||
default:
|
default:
|
||||||
return 'fa-file-o';
|
return 'fa-file-o';
|
||||||
@@ -301,7 +301,7 @@ class General extends Twig_Extension
|
|||||||
protected function phpdate()
|
protected function phpdate()
|
||||||
{
|
{
|
||||||
return new Twig_SimpleFunction(
|
return new Twig_SimpleFunction(
|
||||||
'phpdate', function (string $str) {
|
'phpdate', function (string $str) : string {
|
||||||
return date($str);
|
return date($str);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user