From ae669397cb3c7301eaa6e2856f112f162e4b297f Mon Sep 17 00:00:00 2001 From: Tyler King Date: Tue, 12 Jun 2018 03:01:07 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/ShopifyApp/Models/Charge.php | 17 +++++++++-------- .../Traits/BillingControllerTrait.php | 2 +- .../2018_06_03_185902_create_charges_table.php | 2 +- tests/Controllers/BillingControllerTest.php | 1 + tests/Models/ShopModelTest.php | 2 +- tests/TestCase.php | 4 ++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/ShopifyApp/Models/Charge.php b/src/ShopifyApp/Models/Charge.php index d508d0ed..f5a8f60c 100644 --- a/src/ShopifyApp/Models/Charge.php +++ b/src/ShopifyApp/Models/Charge.php @@ -2,10 +2,9 @@ namespace OhMyBrew\ShopifyApp\Models; +use Carbon\Carbon; use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; -use OhMyBrew\ShopifyApp\Facades\ShopifyApp; -use Carbon\Carbon; class Charge extends Model { @@ -28,6 +27,7 @@ class Charge extends Model * Scope for latest charge for a shop. * * @param \Illuminate\Database\Eloquent\Builder $query The query builder + * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeLatest($query) @@ -39,7 +39,8 @@ public function scopeLatest($query) * Scope for latest charge by type for a shop. * * @param \Illuminate\Database\Eloquent\Builder $query The query builder - * @param integer $type The type of charge + * @param int $type The type of charge + * * @return \Illuminate\Database\Eloquent\Builder */ public function scopeLatestByType($query, int $type) @@ -70,7 +71,7 @@ public function isTest() /** * Checks if the charge is a type. * - * @param integer $type The charge type. + * @param int $type The charge type. * * @return bool */ @@ -102,12 +103,12 @@ public function isActiveTrial() /** * Returns the remaining trial days. * - * @return integer + * @return int */ public function remainingTrialDays() { if (!$this->isTrial()) { - return null; + return; } return $this->isActiveTrial() ? Carbon::today()->diffInDays($this->trial_ends_on) : 0; @@ -116,12 +117,12 @@ public function remainingTrialDays() /** * Returns the used trial days. * - * @return integer|null + * @return int|null */ public function usedTrialDays() { if (!$this->isTrial()) { - return null; + return; } return $this->trial_days - $this->remainingTrialDays(); diff --git a/src/ShopifyApp/Traits/BillingControllerTrait.php b/src/ShopifyApp/Traits/BillingControllerTrait.php index d0b2e7c3..f5293744 100644 --- a/src/ShopifyApp/Traits/BillingControllerTrait.php +++ b/src/ShopifyApp/Traits/BillingControllerTrait.php @@ -2,10 +2,10 @@ namespace OhMyBrew\ShopifyApp\Traits; +use Carbon\Carbon; use OhMyBrew\ShopifyApp\Facades\ShopifyApp; use OhMyBrew\ShopifyApp\Libraries\BillingPlan; use OhMyBrew\ShopifyApp\Models\Charge; -use Carbon\Carbon; trait BillingControllerTrait { diff --git a/src/ShopifyApp/resources/database/migrations/2018_06_03_185902_create_charges_table.php b/src/ShopifyApp/resources/database/migrations/2018_06_03_185902_create_charges_table.php index 26d7fe3f..3c4dee99 100644 --- a/src/ShopifyApp/resources/database/migrations/2018_06_03_185902_create_charges_table.php +++ b/src/ShopifyApp/resources/database/migrations/2018_06_03_185902_create_charges_table.php @@ -50,7 +50,7 @@ public function up() $table->timestamp('billing_on')->nullable(); // When activation happened - $table->timestamp('activated_on')->nullable(); + $table->timestamp('activated_on')->nullable(); // Date the trial period ends $table->timestamp('trial_ends_on')->nullable(); diff --git a/tests/Controllers/BillingControllerTest.php b/tests/Controllers/BillingControllerTest.php index 081db981..a2adc2ae 100644 --- a/tests/Controllers/BillingControllerTest.php +++ b/tests/Controllers/BillingControllerTest.php @@ -1,4 +1,5 @@ assertTrue($shop->trashed()); $this->assertSoftDeleted('shops', [ - 'id' => $shop->id, + 'id' => $shop->id, 'shopify_domain' => $shop->shopify_domain, ]); diff --git a/tests/TestCase.php b/tests/TestCase.php index 90a07f18..879e6165 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,12 +2,12 @@ namespace OhMyBrew\ShopifyApp\Test; -use OhMyBrew\ShopifyApp\Models\Shop; +use Carbon\Carbon; use OhMyBrew\ShopifyApp\Models\Charge; +use OhMyBrew\ShopifyApp\Models\Shop; use OhMyBrew\ShopifyApp\ShopifyAppProvider; use Orchestra\Database\ConsoleServiceProvider; use Orchestra\Testbench\TestCase as OrchestraTestCase; -use Carbon\Carbon; abstract class TestCase extends OrchestraTestCase {