Add typehints to object parameters

This commit is contained in:
James Cole 2015-03-29 07:43:20 +02:00
parent 907933f3df
commit ba9877c9b4
10 changed files with 29 additions and 21 deletions

View File

@ -272,15 +272,15 @@ class ReportQuery implements ReportQueryInterface
// only get deposits not to a shared account
// and transfers to a shared account.
$query->where(
function ($query) {
function (Builder $query) {
$query->where(
function ($q) {
function (Builder $q) {
$q->where('transaction_types.type', 'Deposit');
$q->where('acm_to.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function ($q) {
function (Builder $q) {
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_from.data', '=', '"sharedAsset"');
}
@ -427,15 +427,15 @@ class ReportQuery implements ReportQueryInterface
// get all withdrawals not from a shared accounts
// and all transfers to a shared account
$query->where(
function ($query) {
function (Builder $query) {
$query->where(
function ($q) {
function (Builder $q) {
$q->where('transaction_types.type', 'Withdrawal');
$q->where('acm_from.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function ($q) {
function (Builder $q) {
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_to.data', '=', '"sharedAsset"');
}
@ -495,15 +495,15 @@ class ReportQuery implements ReportQueryInterface
// show queries where transfer type is deposit, and its not to a shared account
// or where its a transfer and its from a shared account (both count as incomes)
$query->where(
function ($query) {
function (Builder $query) {
$query->where(
function ($q) {
function (Builder $q) {
$q->where('transaction_types.type', 'Deposit');
$q->where('acm_to.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function ($q) {
function (Builder $q) {
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_from.data', '=', '"sharedAsset"');
}

View File

@ -7,6 +7,7 @@ use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\AccountFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Pagination\LengthAwarePaginator;
use Input;
use Redirect;
@ -124,7 +125,7 @@ class AccountController extends Controller
// move to repository:
$set = Auth::user()->accounts()->with(
['accountmeta' => function ($query) {
['accountmeta' => function (HasMany $query) {
$query->where('name', 'accountRole');
}]
)->accountTypeIn($types)->take($size)->offset($offset)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);

View File

@ -5,6 +5,7 @@ use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Mail\Message;
use Mail;
use Session;
@ -73,7 +74,7 @@ class AuthController extends Controller
// send email.
Mail::send(
'emails.registered', [], function ($message) use ($email) {
'emails.registered', [], function (Message $message) use ($email) {
$message->to($email, $email)->subject('Welcome to Firefly III!');
}
);

View File

@ -2,6 +2,7 @@
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
/**
* Class Authenticate
@ -37,7 +38,7 @@ class Authenticate
*
* @return mixed
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {

View File

@ -10,6 +10,7 @@ use FireflyIII\Models\PiggyBankRepetition;
use FireflyIII\Models\Reminder;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Navigation;
use Session;
@ -48,7 +49,7 @@ class PiggyBanks
*
* @return mixed
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next)
{
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
// get piggy banks without a repetition:

View File

@ -6,6 +6,7 @@ namespace FireflyIII\Http\Middleware;
use Carbon\Carbon;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Navigation;
use Preferences;
use Session;
@ -44,7 +45,7 @@ class Range
*
* @return mixed
*/
public function handle($request, Closure $theNext)
public function handle(Request $request, Closure $theNext)
{
if ($this->auth->check()) {

View File

@ -3,6 +3,7 @@
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
/**
* Class RedirectIfAuthenticated
@ -38,7 +39,7 @@ class RedirectIfAuthenticated
*
* @return mixed
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next)
{
if ($this->auth->check()) {
return new RedirectResponse(url('/'));

View File

@ -8,6 +8,7 @@ use Closure;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use View;
/**
@ -43,7 +44,7 @@ class Reminders
*
* @return mixed
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next)
{
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
// do reminders stuff.

View File

@ -5,14 +5,15 @@ namespace FireflyIII\Http\Middleware;
use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\Routing\Middleware;
use Illuminate\Http\Request;
use Log;
/**
* Class ReplaceTestVars
*
* @package App\Http\Middleware
* @package FireflyIII\Http\Middleware
*/
class ReplaceTestVars implements Middleware
class ReplaceTestVars
{
/**
* The application implementation.
@ -40,7 +41,7 @@ class ReplaceTestVars implements Middleware
*
* @return mixed
*/
public function handle($request, Closure $next)
public function handle(Request $request, Closure $next)
{
if ('testing' === $this->app->environment() && $request->has('_token')) {
$input = $request->all();

View File

@ -5,7 +5,7 @@ namespace FireflyIII\Http\Requests;
use Auth;
use FireflyIII\Models\Account;
use Input;
use Exception;
/**
* Class JournalFormRequest
*
@ -62,7 +62,7 @@ class JournalFormRequest extends Request
$rules['category'] = 'between:1,255';
break;
default:
die('Cannot handle ' . $what);
throw new Exception('Cannot handle ' . $what);
break;
}