Added PHP7 return type statements.

This commit is contained in:
James Cole 2016-02-06 10:15:07 +01:00
parent 466067bd95
commit aa38b31015
4 changed files with 30 additions and 30 deletions

View File

@ -23,7 +23,7 @@ class Search implements SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchAccounts(array $words) public function searchAccounts(array $words): Collection
{ {
return Auth::user()->accounts()->with('accounttype')->where( return Auth::user()->accounts()->with('accounttype')->where(
function (EloquentBuilder $q) use ($words) { function (EloquentBuilder $q) use ($words) {
@ -39,7 +39,7 @@ class Search implements SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchBudgets(array $words) public function searchBudgets(array $words): Collection
{ {
/** @var Collection $set */ /** @var Collection $set */
$set = Auth::user()->budgets()->get(); $set = Auth::user()->budgets()->get();
@ -64,7 +64,7 @@ class Search implements SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchCategories(array $words) public function searchCategories(array $words): Collection
{ {
/** @var Collection $set */ /** @var Collection $set */
$set = Auth::user()->categories()->get(); $set = Auth::user()->categories()->get();
@ -90,7 +90,7 @@ class Search implements SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchTags(array $words) public function searchTags(array $words): Collection
{ {
return new Collection; return new Collection;
} }
@ -100,7 +100,7 @@ class Search implements SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchTransactions(array $words) public function searchTransactions(array $words): Collection
{ {
// decrypted transaction journals: // decrypted transaction journals:
$decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where( $decrypted = Auth::user()->transactionjournals()->withRelevantData()->where('encrypted', 0)->where(

View File

@ -17,21 +17,21 @@ interface SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchAccounts(array $words); public function searchAccounts(array $words): Collection;
/** /**
* @param array $words * @param array $words
* *
* @return Collection * @return Collection
*/ */
public function searchBudgets(array $words); public function searchBudgets(array $words): Collection;
/** /**
* @param array $words * @param array $words
* *
* @return Collection * @return Collection
*/ */
public function searchCategories(array $words); public function searchCategories(array $words): Collection;
/** /**
* *
@ -39,12 +39,12 @@ interface SearchInterface
* *
* @return Collection * @return Collection
*/ */
public function searchTags(array $words); public function searchTags(array $words): Collection;
/** /**
* @param array $words * @param array $words
* *
* @return Collection * @return Collection
*/ */
public function searchTransactions(array $words); public function searchTransactions(array $words): Collection;
} }

View File

@ -20,7 +20,7 @@ class Budget extends Twig_Extension
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getFunctions() public function getFunctions(): array
{ {
$functions = []; $functions = [];
$functions[] = new Twig_SimpleFunction( $functions[] = new Twig_SimpleFunction(
@ -53,7 +53,7 @@ class Budget extends Twig_Extension
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() public function getName(): string
{ {
return 'FireflyIII\Support\Twig\Budget'; return 'FireflyIII\Support\Twig\Budget';
} }

View File

@ -28,7 +28,7 @@ class General extends Twig_Extension
/** /**
* @return array * @return array
*/ */
public function getFilters() public function getFilters(): array
{ {
return [ return [
$this->formatAmount(), $this->formatAmount(),
@ -46,7 +46,7 @@ class General extends Twig_Extension
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getFunctions() public function getFunctions(): array
{ {
return [ return [
$this->getCurrencyCode(), $this->getCurrencyCode(),
@ -64,7 +64,7 @@ class General extends Twig_Extension
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
public function getName() public function getName(): string
{ {
return 'FireflyIII\Support\Twig\General'; return 'FireflyIII\Support\Twig\General';
} }
@ -75,10 +75,10 @@ class General extends Twig_Extension
* *
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */
protected function activeRoutePartial() protected function activeRoutePartial(): Twig_SimpleFunction
{ {
return new Twig_SimpleFunction( return new Twig_SimpleFunction(
'activeRoutePartial', function () { 'activeRoutePartial', function () : string {
$args = func_get_args(); $args = func_get_args();
$route = $args[0]; // name of the route. $route = $args[0]; // name of the route.
if (!(strpos(Route::getCurrentRoute()->getName(), $route) === false)) { if (!(strpos(Route::getCurrentRoute()->getName(), $route) === false)) {
@ -96,7 +96,7 @@ class General extends Twig_Extension
* *
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */
protected function activeRoutePartialWhat() protected function activeRoutePartialWhat(): Twig_SimpleFunction
{ {
return new Twig_SimpleFunction( return new Twig_SimpleFunction(
'activeRoutePartialWhat', function ($context) { 'activeRoutePartialWhat', function ($context) {
@ -120,7 +120,7 @@ class General extends Twig_Extension
* *
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */
protected function activeRouteStrict() protected function activeRouteStrict(): Twig_SimpleFunction
{ {
return new Twig_SimpleFunction( return new Twig_SimpleFunction(
'activeRouteStrict', function () { 'activeRouteStrict', function () {
@ -139,7 +139,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function balance() protected function balance(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'balance', function (Account $account = null) { 'balance', function (Account $account = null) {
@ -156,7 +156,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */
protected function env() 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) {
@ -169,7 +169,7 @@ class General extends Twig_Extension
* *
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function formatAmount() protected function formatAmount(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'formatAmount', function (string $string) { 'formatAmount', function (string $string) {
@ -182,7 +182,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function formatAmountPlain() protected function formatAmountPlain(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'formatAmountPlain', function (string $string) { 'formatAmountPlain', function (string $string) {
@ -195,7 +195,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function formatFilesize() protected function formatFilesize(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'filesize', function (int $size) { 'filesize', function (int $size) {
@ -218,7 +218,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function formatJournal() protected function formatJournal(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'formatJournal', function (TransactionJournal $journal) { 'formatJournal', function (TransactionJournal $journal) {
@ -230,7 +230,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function formatTransaction() protected function formatTransaction(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'formatTransaction', function (Transaction $transaction) { 'formatTransaction', function (Transaction $transaction) {
@ -242,7 +242,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function getAccountRole() protected function getAccountRole(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'getAccountRole', function (string $name) { 'getAccountRole', function (string $name) {
@ -254,7 +254,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */
protected function getCurrencyCode() protected function getCurrencyCode(): Twig_SimpleFunction
{ {
return new Twig_SimpleFunction( return new Twig_SimpleFunction(
'getCurrencyCode', function () { 'getCurrencyCode', function () {
@ -266,7 +266,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFunction * @return Twig_SimpleFunction
*/ */
protected function getCurrencySymbol() protected function getCurrencySymbol(): Twig_SimpleFunction
{ {
return new Twig_SimpleFunction( return new Twig_SimpleFunction(
'getCurrencySymbol', function () { 'getCurrencySymbol', function () {
@ -278,7 +278,7 @@ class General extends Twig_Extension
/** /**
* @return Twig_SimpleFilter * @return Twig_SimpleFilter
*/ */
protected function mimeIcon() protected function mimeIcon(): Twig_SimpleFilter
{ {
return new Twig_SimpleFilter( return new Twig_SimpleFilter(
'mimeIcon', function (string $string) { 'mimeIcon', function (string $string) {