From fba296995146e84af49d6aadd960ea3f5a52b7d4 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Wed, 29 Jul 2020 10:58:25 -0400 Subject: [PATCH] Fix coding styles --- .gitignore | 1 - .php_cs.dist | 21 +++++++++++++++++++ app/Http/Controllers/Auth/LoginController.php | 10 ++++----- .../Controllers/Auth/RegisterController.php | 4 ++-- app/Http/Controllers/ContactsController.php | 6 +++--- app/Http/Controllers/Controller.php | 6 +++--- .../Controllers/OrganizationsController.php | 4 ++-- app/Http/Controllers/UsersController.php | 6 +++--- app/Http/Middleware/Authenticate.php | 1 - .../Middleware/CheckForMaintenanceMode.php | 1 - app/Http/Middleware/EncryptCookies.php | 1 - .../Middleware/RedirectIfAuthenticated.php | 1 - app/Model.php | 2 +- app/User.php | 12 +++++------ ...019_03_05_000000_create_accounts_table.php | 4 ++-- ...019_03_05_000000_create_contacts_table.php | 4 ++-- ...3_05_000000_create_organizations_table.php | 4 ++-- ...05_000000_create_password_resets_table.php | 4 ++-- .../2019_03_05_000000_create_users_table.php | 4 ++-- database/seeds/DatabaseSeeder.php | 2 +- tests/Feature/ContactsTest.php | 8 +++---- tests/Feature/OrganizationsTest.php | 4 ++-- tests/TestCase.php | 6 +++--- 23 files changed, 66 insertions(+), 50 deletions(-) create mode 100644 .php_cs.dist diff --git a/.gitignore b/.gitignore index 2b38882..97cb3df 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ .DS_Store .env .env.backup -.php_cs.dist .phpunit.result.cache Homestead.json Homestead.yaml diff --git a/.php_cs.dist b/.php_cs.dist new file mode 100644 index 0000000..0c58ce3 --- /dev/null +++ b/.php_cs.dist @@ -0,0 +1,21 @@ +setUsingCache(false) + ->setRiskyAllowed(true) + ->setRules([ + '@PHP70Migration' => true, + '@PHP71Migration' => true, + '@PSR2' => true, + // '@Symfony' => true, + 'array_syntax' => ['syntax' => 'short'], + 'increment_style' => ['style' => 'post'], + 'no_multiline_whitespace_before_semicolons' => true, + 'not_operator_with_successor_space' => true, + 'ordered_imports' => ['sortAlgorithm' => 'alpha'], + 'semicolon_after_instruction' => false, + 'strict_comparison' => true, + 'yoda_style' => false, + ]); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 18ef5e7..d35a501 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -2,14 +2,14 @@ namespace App\Http\Controllers\Auth; -use Inertia\Inertia; -use Illuminate\Http\Request; -use Illuminate\Support\Facades\URL; use App\Http\Controllers\Controller; -use Illuminate\Support\Facades\Session; +use Illuminate\Foundation\Auth\AuthenticatesUsers; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Redirect; use Illuminate\Support\Facades\Response; -use Illuminate\Foundation\Auth\AuthenticatesUsers; +use Illuminate\Support\Facades\Session; +use Illuminate\Support\Facades\URL; +use Inertia\Inertia; class LoginController extends Controller { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 85b9057..6fdcba0 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -2,11 +2,11 @@ namespace App\Http\Controllers\Auth; -use App\User; use App\Http\Controllers\Controller; +use App\User; +use Illuminate\Foundation\Auth\RegistersUsers; use Illuminate\Support\Facades\Hash; use Illuminate\Support\Facades\Validator; -use Illuminate\Foundation\Auth\RegistersUsers; class RegisterController extends Controller { diff --git a/app/Http/Controllers/ContactsController.php b/app/Http/Controllers/ContactsController.php index 3b2d462..ace3856 100644 --- a/app/Http/Controllers/ContactsController.php +++ b/app/Http/Controllers/ContactsController.php @@ -3,11 +3,11 @@ namespace App\Http\Controllers; use App\Contact; -use Inertia\Inertia; -use Illuminate\Validation\Rule; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; +use Illuminate\Support\Facades\Request; +use Illuminate\Validation\Rule; +use Inertia\Inertia; class ContactsController extends Controller { diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 03e02a2..a0a2a8a 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -2,10 +2,10 @@ namespace App\Http\Controllers; -use Illuminate\Foundation\Bus\DispatchesJobs; -use Illuminate\Routing\Controller as BaseController; -use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; +use Illuminate\Foundation\Bus\DispatchesJobs; +use Illuminate\Foundation\Validation\ValidatesRequests; +use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { diff --git a/app/Http/Controllers/OrganizationsController.php b/app/Http/Controllers/OrganizationsController.php index 7db6f65..d50f59f 100644 --- a/app/Http/Controllers/OrganizationsController.php +++ b/app/Http/Controllers/OrganizationsController.php @@ -2,11 +2,11 @@ namespace App\Http\Controllers; -use Inertia\Inertia; use App\Organization; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; +use Illuminate\Support\Facades\Request; +use Inertia\Inertia; class OrganizationsController extends Controller { diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php index 1e83760..2216351 100644 --- a/app/Http/Controllers/UsersController.php +++ b/app/Http/Controllers/UsersController.php @@ -3,13 +3,13 @@ namespace App\Http\Controllers; use App\User; -use Inertia\Inertia; -use Illuminate\Validation\Rule; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Auth; -use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Redirect; +use Illuminate\Support\Facades\Request; +use Illuminate\Validation\Rule; use Illuminate\Validation\ValidationException; +use Inertia\Inertia; class UsersController extends Controller { diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index 09e6023..704089a 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -19,4 +19,3 @@ class Authenticate extends Middleware } } } - diff --git a/app/Http/Middleware/CheckForMaintenanceMode.php b/app/Http/Middleware/CheckForMaintenanceMode.php index ccb4ac1..35b9824 100644 --- a/app/Http/Middleware/CheckForMaintenanceMode.php +++ b/app/Http/Middleware/CheckForMaintenanceMode.php @@ -15,4 +15,3 @@ class CheckForMaintenanceMode extends Middleware // ]; } - diff --git a/app/Http/Middleware/EncryptCookies.php b/app/Http/Middleware/EncryptCookies.php index fec0e57..033136a 100644 --- a/app/Http/Middleware/EncryptCookies.php +++ b/app/Http/Middleware/EncryptCookies.php @@ -15,4 +15,3 @@ class EncryptCookies extends Middleware // ]; } - diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 6990a60..2395ddc 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -25,4 +25,3 @@ class RedirectIfAuthenticated return $next($request); } } - diff --git a/app/Model.php b/app/Model.php index 7b17500..c0f4ab9 100644 --- a/app/Model.php +++ b/app/Model.php @@ -2,8 +2,8 @@ namespace App; -use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\Model as Eloquent; +use Illuminate\Database\Eloquent\SoftDeletes; abstract class Model extends Eloquent { diff --git a/app/User.php b/app/User.php index f85d8a7..fb73cf2 100644 --- a/app/User.php +++ b/app/User.php @@ -2,15 +2,15 @@ namespace App; -use League\Glide\Server; -use Illuminate\Support\Facades\App; -use Illuminate\Support\Facades\URL; use Illuminate\Auth\Authenticatable; -use Illuminate\Support\Facades\Hash; +use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; +use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Foundation\Auth\Access\Authorizable; -use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract; -use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract; +use Illuminate\Support\Facades\App; +use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Facades\URL; +use League\Glide\Server; class User extends Model implements AuthenticatableContract, AuthorizableContract { diff --git a/database/migrations/2019_03_05_000000_create_accounts_table.php b/database/migrations/2019_03_05_000000_create_accounts_table.php index d44dd4e..f4bc6cc 100644 --- a/database/migrations/2019_03_05_000000_create_accounts_table.php +++ b/database/migrations/2019_03_05_000000_create_accounts_table.php @@ -1,8 +1,8 @@ assertPropCount('contacts.data', 5) ->assertPropValue('contacts.data', function ($contacts) { $this->assertEquals( - ['id', 'name', 'phone', 'city', + ['id', 'name', 'phone', 'city', 'deleted_at', 'organization'], array_keys($contacts[0]) ); diff --git a/tests/Feature/OrganizationsTest.php b/tests/Feature/OrganizationsTest.php index ad757c0..9885a96 100644 --- a/tests/Feature/OrganizationsTest.php +++ b/tests/Feature/OrganizationsTest.php @@ -2,11 +2,11 @@ namespace Tests\Feature; -use App\User; use App\Account; -use Tests\TestCase; use App\Organization; +use App\User; use Illuminate\Foundation\Testing\RefreshDatabase; +use Tests\TestCase; class OrganizationsTest extends TestCase { diff --git a/tests/TestCase.php b/tests/TestCase.php index 9d48575..953cafe 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,10 +2,10 @@ namespace Tests; -use Illuminate\Support\Arr; -use PHPUnit\Framework\Assert; -use Illuminate\Testing\TestResponse; use Illuminate\Foundation\Testing\TestCase as BaseTestCase; +use Illuminate\Support\Arr; +use Illuminate\Testing\TestResponse; +use PHPUnit\Framework\Assert; abstract class TestCase extends BaseTestCase {