Skip to content
Permalink
Browse files

Linting cleanup based on feedback from larastan

  • Loading branch information...
lovett committed Jun 30, 2019
1 parent 9f35038 commit 3c71b9e16df4539327e7f4fa4bfba4ac948e28ab
Showing with 21 additions and 9 deletions.
  1. +1 −0 Makefile
  2. +9 −2 app/Client.php
  3. +1 −0 app/Http/Controllers/EstimateController.php
  4. +1 −1 app/Http/Requests/TimeRequest.php
  5. +9 −2 app/Project.php
  6. +0 −4 app/Time.php
@@ -19,6 +19,7 @@ seed-full: dummy
lint: dummy
phpmd app text phpmd.xml
phpcs -s app
php artisan code:analyse

# Install NPM packages quietly.
setup-js: export NPM_CONFIG_PROGRESS=false
@@ -12,6 +12,7 @@
use Illuminate\Database\Query\Builder as QueryBuilder;
use App\Traits\Search;
use Carbon\Carbon;
use Carbon\CarbonInterface;
/**
* Eloquent model for the clients table.
@@ -141,13 +142,19 @@ public function stats()
$start = $this->time()->min('times.start');
if ($start) {
$stats['start'] = new Carbon($start);
$stats['age'] = Carbon::now()->diffForHumans($stats['start'], true);
$stats['age'] = Carbon::now()->diffForHumans(
$stats['start'],
CarbonInterface::DIFF_ABSOLUTE
);
}
if ((bool) $this->active === false) {
$end = $this->time()->max('times.start');
$stats['end'] = new Carbon($end);
$stats['duration'] = $stats['end']->diffForHumans($stats['start'], true);
$stats['duration'] = $stats['end']->diffForHumans(
$stats['start'],
CarbonInterface::DIFF_ABSOLUTE
);
}
return $stats;
@@ -6,6 +6,7 @@
use App\Helpers\MessagingHelper;
use App\Http\Requests\EstimateRequest;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Http\RedirectResponse;
use Illuminate\View\View;
use Illuminate\Support\Str;
@@ -91,7 +91,7 @@ public function withValidator(Validator $validator)
)->setTimezone('UTC');
if ($fields['start'] > $fields['end']) {
$fields['end'] = $fields['end']->addDay(1);
$fields['end'] = $fields['end']->addDay();
}
}
@@ -11,6 +11,7 @@
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use App\Traits\Search;
use Carbon\Carbon;
use Carbon\CarbonInterface;
/**
* Eloquent model for the projects table.
@@ -255,13 +256,19 @@ public function stats()
$start = $this->time()->min('times.start');
if ($start) {
$stats['start'] = new Carbon($start);
$stats['age'] = Carbon::now()->diffForHumans($stats['start'], true);
$stats['age'] = Carbon::now()->diffForHumans(
$stats['start'],
CarbonInterface::DIFF_ABSOLUTE
);
}
if ((bool) $this->active === false) {
$end = $this->time()->max('times.start');
$stats['end'] = new Carbon($end);
$stats['duration'] = $stats['end']->diffForHumans($stats['start'], true);
$stats['duration'] = $stats['end']->diffForHumans(
$stats['start'],
CarbonInterface::DIFF_ABSOLUTE
);
}
$stats['billable_minutes'] = $this->time()->billable()->sum('minutes');
@@ -396,10 +396,6 @@ public static function byInterval(
$intervalMultiplier = 1;
}
if (isset($diffMethod) === false) {
throw new InvalidArgumentException('invalid timeInterval');
}
$modelWhere = 'WHERE project_id=:modelId';
if ($model instanceof Client) {

0 comments on commit 3c71b9e

Please sign in to comment.
You can’t perform that action at this time.