Added PHP7 return type statements.

This commit is contained in:
James Cole 2016-02-06 10:17:41 +01:00
parent aa38b31015
commit d1a184e3f2
3 changed files with 17 additions and 17 deletions

View File

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

View File

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

View File

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