From d1a184e3f2da3fdbdc4f40e35e3502a5bfb58dc5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 6 Feb 2016 10:17:41 +0100 Subject: [PATCH] Added PHP7 return type statements. --- app/Support/Amount.php | 4 ++-- app/Support/Steam.php | 2 +- app/Support/Twig/General.php | 28 ++++++++++++++-------------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/app/Support/Amount.php b/app/Support/Amount.php index b4f1df5a4d..84b08b3da7 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -24,7 +24,7 @@ class Amount * * @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); } @@ -39,7 +39,7 @@ class Amount * * @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); $float = floatval($amount); diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 8779d7cc4b..60f1506403 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -25,7 +25,7 @@ class Steam * * @return string */ - public function balance(Account $account, Carbon $date, $ignoreVirtualBalance = false) + public function balance(Account $account, Carbon $date, $ignoreVirtualBalance = false): string { // abuse chart properties: diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index b0c728fc10..1ae282f199 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -99,7 +99,7 @@ class General extends Twig_Extension protected function activeRoutePartialWhat(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'activeRoutePartialWhat', function ($context) { + 'activeRoutePartialWhat', function ($context) : string { $args = func_get_args(); $route = $args[1]; // 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 { return new Twig_SimpleFunction( - 'activeRouteStrict', function () { + 'activeRouteStrict', function () : string { $args = func_get_args(); $route = $args[0]; // name of the route. @@ -142,7 +142,7 @@ class General extends Twig_Extension protected function balance(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'balance', function (Account $account = null) { + 'balance', function (Account $account = null) : string { if (is_null($account)) { return 'NULL'; } @@ -159,7 +159,7 @@ class General extends Twig_Extension protected function env(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'env', function (string $name, string $default) { + 'env', function (string $name, string $default) : string { return env($name, $default); } ); @@ -172,7 +172,7 @@ class General extends Twig_Extension protected function formatAmount(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'formatAmount', function (string $string) { + 'formatAmount', function (string $string) : string { return app('amount')->format($string); }, ['is_safe' => ['html']] @@ -185,7 +185,7 @@ class General extends Twig_Extension protected function formatAmountPlain(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'formatAmountPlain', function (string $string) { + 'formatAmountPlain', function (string $string) : string { return app('amount')->format($string, false); }, ['is_safe' => ['html']] @@ -198,7 +198,7 @@ class General extends Twig_Extension protected function formatFilesize(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'filesize', function (int $size) { + 'filesize', function (int $size) : string { // less than one GB, more than one MB if ($size < (1024 * 1024 * 2014) && $size >= (1024 * 1024)) { @@ -221,7 +221,7 @@ class General extends Twig_Extension protected function formatJournal(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'formatJournal', function (TransactionJournal $journal) { + 'formatJournal', function (TransactionJournal $journal) : string { return app('amount')->formatJournal($journal); }, ['is_safe' => ['html']] ); @@ -233,7 +233,7 @@ class General extends Twig_Extension protected function formatTransaction(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'formatTransaction', function (Transaction $transaction) { + 'formatTransaction', function (Transaction $transaction) : string { return app('amount')->formatTransaction($transaction); }, ['is_safe' => ['html']] ); @@ -245,7 +245,7 @@ class General extends Twig_Extension protected function getAccountRole(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'getAccountRole', function (string $name) { + 'getAccountRole', function (string $name) : string { return Config::get('firefly.accountRoles.' . $name); } ); @@ -257,7 +257,7 @@ class General extends Twig_Extension protected function getCurrencyCode(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'getCurrencyCode', function () { + 'getCurrencyCode', function () : string { return app('amount')->getCurrencyCode(); } ); @@ -269,7 +269,7 @@ class General extends Twig_Extension protected function getCurrencySymbol(): Twig_SimpleFunction { return new Twig_SimpleFunction( - 'getCurrencySymbol', function () { + 'getCurrencySymbol', function () : string { return app('amount')->getCurrencySymbol(); } ); @@ -281,7 +281,7 @@ class General extends Twig_Extension protected function mimeIcon(): Twig_SimpleFilter { return new Twig_SimpleFilter( - 'mimeIcon', function (string $string) { + 'mimeIcon', function (string $string) : string { switch ($string) { default: return 'fa-file-o'; @@ -301,7 +301,7 @@ class General extends Twig_Extension protected function phpdate() { return new Twig_SimpleFunction( - 'phpdate', function (string $str) { + 'phpdate', function (string $str) : string { return date($str); } );