diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..84f7655 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,51 @@ +name: Lint + +on: + push: + branches: [ main ] + pull_request: + +jobs: + phpcs: + name: PHPCS + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --no-suggest --ignore-platform-reqs + + - name: PHPCS lint + run: vendor/bin/phpcs --warning-severity=0 + + tlint: + name: TLint + + continue-on-error: false + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + extensions: posix, dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick + coverage: none + + - name: Install dependencies + run: composer install --no-interaction --no-suggest --ignore-platform-reqs + + - name: Tlint Lint + run: vendor/bin/tlint diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist new file mode 100644 index 0000000..5ffcf8e --- /dev/null +++ b/.phpcs.xml.dist @@ -0,0 +1,12 @@ + + + app + config + database + public + resources + routes + tests + + + diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d8bc1d2..e1d9417 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -25,7 +25,7 @@ protected function schedule(Schedule $schedule) */ protected function commands() { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index a0a2a8a..ce1176d 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -9,5 +9,7 @@ class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests; + use DispatchesJobs; + use ValidatesRequests; } diff --git a/app/Models/User.php b/app/Models/User.php index 23b4063..ffdc1d5 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -10,7 +10,9 @@ class User extends Authenticatable { - use HasApiTokens, HasFactory, Notifiable; + use HasApiTokens; + use HasFactory; + use Notifiable; /** * The attributes that are mass assignable. diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index ab8b2cf..474b6c1 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -5,7 +5,6 @@ use Illuminate\Auth\Events\Registered; use Illuminate\Auth\Listeners\SendEmailVerificationNotification; use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider; -use Illuminate\Support\Facades\Event; class EventServiceProvider extends ServiceProvider { diff --git a/composer.json b/composer.json index 299b7e8..b0f48b0 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,8 @@ "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^6.1", "phpunit/phpunit": "^9.5.10", - "spatie/laravel-ignition": "^1.0" + "spatie/laravel-ignition": "^1.0", + "tightenco/duster": "^0.3.2" }, "autoload": { "psr-4": { @@ -57,7 +58,8 @@ "preferred-install": "dist", "sort-packages": true, "allow-plugins": { - "pestphp/pest-plugin": true + "pestphp/pest-plugin": true, + "dealerdirect/phpcodesniffer-composer-installer": true } }, "minimum-stability": "dev", diff --git a/composer.lock b/composer.lock index fe82701..287d1c8 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ccbd816a07b206f971042295b899d1ba", + "content-hash": "edc5ef85a08ad3f9d2b10904032cfb71", "packages": [ { "name": "brick/math", @@ -5175,6 +5175,81 @@ } ], "packages-dev": [ + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.7.2", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "reference": "1c968e542d8843d7cd71de3c5c9c3ff3ad71a1db", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0", + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.0 || ^3.1.0 || ^4.0" + }, + "require-dev": { + "composer/composer": "*", + "php-parallel-lint/php-parallel-lint": "^1.3.1", + "phpcompatibility/php-compatibility": "^9.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + }, + { + "name": "Contributors", + "homepage": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer/graphs/contributors" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcbf", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "support": { + "issues": "https://github.com/dealerdirect/phpcodesniffer-composer-installer/issues", + "source": "https://github.com/dealerdirect/phpcodesniffer-composer-installer" + }, + "time": "2022-02-04T12:51:07+00:00" + }, { "name": "doctrine/instantiator", "version": "1.4.1", @@ -7850,6 +7925,62 @@ ], "time": "2022-06-17T06:28:57+00:00" }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.7.1", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/1359e176e9307e906dc3d890bcc9603ff6d90619", + "reference": "1359e176e9307e906dc3d890bcc9603ff6d90619", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "support": { + "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", + "source": "https://github.com/squizlabs/PHP_CodeSniffer", + "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + }, + "time": "2022-06-18T07:21:10+00:00" + }, { "name": "theseer/tokenizer", "version": "1.2.1", @@ -7899,6 +8030,167 @@ } ], "time": "2021-07-28T10:34:58+00:00" + }, + { + "name": "tightenco/duster", + "version": "v0.3.2", + "source": { + "type": "git", + "url": "https://github.com/tighten/duster.git", + "reference": "f2459c92f9288a542033cc0b814f1f94b32b0fc1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tighten/duster/zipball/f2459c92f9288a542033cc0b814f1f94b32b0fc1", + "reference": "f2459c92f9288a542033cc0b814f1f94b32b0fc1", + "shasum": "" + }, + "require": { + "php": "^7.3|^8.0", + "phpunit/phpunit": "^9.0", + "squizlabs/php_codesniffer": "^3.5", + "tightenco/tighten-coding-standard": "^1.0", + "tightenco/tlint": "^6.0" + }, + "bin": [ + "bin/duster" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Stauffer", + "email": "matt@tighten.co", + "homepage": "https://tighten.co", + "role": "Developer" + } + ], + "description": "Automatic configuration for Laravel apps to apply Tighten's standard linting & code standards.", + "homepage": "https://github.com/tighten/duster", + "keywords": [ + "Code style", + "duster", + "laravel", + "php", + "phpcs", + "tightenco" + ], + "support": { + "issues": "https://github.com/tighten/duster/issues", + "source": "https://github.com/tighten/duster/tree/v0.3.2" + }, + "time": "2021-08-20T15:23:52+00:00" + }, + { + "name": "tightenco/tighten-coding-standard", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/tighten/tighten-coding-standard.git", + "reference": "0d4812d996acedb07b4bca851d84ce9024cc85de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tighten/tighten-coding-standard/zipball/0d4812d996acedb07b4bca851d84ce9024cc85de", + "reference": "0d4812d996acedb07b4bca851d84ce9024cc85de", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", + "php": "^7.3|^8.0", + "squizlabs/php_codesniffer": "^3.5" + }, + "require-dev": { + "phpunit/phpunit": "^9.0", + "tightenco/tlint": "^5.0" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "Tighten\\TightenCodingStandard\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Matt Stauffer", + "email": "matt@tighten.co", + "homepage": "https://tighten.co", + "role": "Developer" + } + ], + "description": "A PHP Code_Sniffer configuration for the Tighten coding standard.", + "homepage": "https://github.com/tighten/tighten-coding-standard", + "keywords": [ + "php", + "tighten-coding-standard", + "tightenco" + ], + "support": { + "issues": "https://github.com/tighten/tighten-coding-standard/issues", + "source": "https://github.com/tighten/tighten-coding-standard/tree/v1.0.2" + }, + "time": "2021-08-20T00:11:14+00:00" + }, + { + "name": "tightenco/tlint", + "version": "v6.3.0", + "source": { + "type": "git", + "url": "https://github.com/tighten/tlint.git", + "reference": "001743e6560757a1a225196e613f11cd8fdb8421" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tighten/tlint/zipball/001743e6560757a1a225196e613f11cd8fdb8421", + "reference": "001743e6560757a1a225196e613f11cd8fdb8421", + "shasum": "" + }, + "require": { + "illuminate/view": "*", + "nikic/php-parser": "^4.12", + "php": ">=7.3", + "symfony/console": "^4.4.30 || ^5.3.7 || ^6.0", + "symfony/process": "^4.4.20 || ^5.0.9 || ^6.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.1", + "phpunit/phpunit": "^8.5.16 || ^9.0", + "symfony/var-dumper": "^5.0" + }, + "bin": [ + "bin/tlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Tighten\\TLint\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Logan Henson", + "email": "logan@loganhenson.com", + "role": "Developer" + } + ], + "description": "Tighten linter for Laravel conventions", + "homepage": "https://github.com/tighten/tlint", + "support": { + "issues": "https://github.com/tighten/tlint/issues", + "source": "https://github.com/tighten/tlint/tree/v6.3.0" + }, + "time": "2022-04-25T18:24:39+00:00" } ], "aliases": [], diff --git a/config/broadcasting.php b/config/broadcasting.php index 1688242..3fe737e 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,7 +36,7 @@ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ - 'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', + 'host' => env('PUSHER_HOST', 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com') ?: 'api-' . env('PUSHER_APP_CLUSTER', 'mt1') . '.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), 'encrypted' => true, diff --git a/config/cache.php b/config/cache.php index 33bb295..daf5e68 100644 --- a/config/cache.php +++ b/config/cache.php @@ -105,6 +105,6 @@ | */ - 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache_'), + 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_cache_'), ]; diff --git a/config/database.php b/config/database.php index 137ad18..535cd52 100644 --- a/config/database.php +++ b/config/database.php @@ -125,7 +125,7 @@ 'options' => [ 'cluster' => env('REDIS_CLUSTER', 'redis'), - 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'), + 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), ], 'default' => [ diff --git a/config/filesystems.php b/config/filesystems.php index e9d9dbd..4afc1fc 100644 --- a/config/filesystems.php +++ b/config/filesystems.php @@ -39,7 +39,7 @@ 'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), - 'url' => env('APP_URL').'/storage', + 'url' => env('APP_URL') . '/storage', 'visibility' => 'public', 'throw' => false, ], diff --git a/config/logging.php b/config/logging.php index 5aa1dbb..752af71 100644 --- a/config/logging.php +++ b/config/logging.php @@ -85,7 +85,7 @@ 'handler_with' => [ 'host' => env('PAPERTRAIL_URL'), 'port' => env('PAPERTRAIL_PORT'), - 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), + 'connectionString' => 'tls://' . env('PAPERTRAIL_URL') . ':' . env('PAPERTRAIL_PORT'), ], ], diff --git a/config/session.php b/config/session.php index 8fed97c..1b99f22 100644 --- a/config/session.php +++ b/config/session.php @@ -128,7 +128,7 @@ 'cookie' => env( 'SESSION_COOKIE', - Str::slug(env('APP_NAME', 'laravel'), '_').'_session' + Str::slug(env('APP_NAME', 'laravel'), '_') . '_session' ), /* diff --git a/database/migrations/2014_10_12_000000_create_users_table.php b/database/migrations/2014_10_12_000000_create_users_table.php index cf6b776..34c79fe 100644 --- a/database/migrations/2014_10_12_000000_create_users_table.php +++ b/database/migrations/2014_10_12_000000_create_users_table.php @@ -6,11 +6,6 @@ return new class extends Migration { - /** - * Run the migrations. - * - * @return void - */ public function up() { Schema::create('users', function (Blueprint $table) { @@ -24,11 +19,6 @@ public function up() }); } - /** - * Reverse the migrations. - * - * @return void - */ public function down() { Schema::dropIfExists('users'); diff --git a/database/migrations/2014_10_12_100000_create_password_resets_table.php b/database/migrations/2014_10_12_100000_create_password_resets_table.php index fcacb80..cb07396 100644 --- a/database/migrations/2014_10_12_100000_create_password_resets_table.php +++ b/database/migrations/2014_10_12_100000_create_password_resets_table.php @@ -6,11 +6,6 @@ return new class extends Migration { - /** - * Run the migrations. - * - * @return void - */ public function up() { Schema::create('password_resets', function (Blueprint $table) { @@ -20,11 +15,6 @@ public function up() }); } - /** - * Reverse the migrations. - * - * @return void - */ public function down() { Schema::dropIfExists('password_resets'); diff --git a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php index 1719198..f22af77 100644 --- a/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ b/database/migrations/2019_08_19_000000_create_failed_jobs_table.php @@ -6,11 +6,6 @@ return new class extends Migration { - /** - * Run the migrations. - * - * @return void - */ public function up() { Schema::create('failed_jobs', function (Blueprint $table) { @@ -24,11 +19,6 @@ public function up() }); } - /** - * Reverse the migrations. - * - * @return void - */ public function down() { Schema::dropIfExists('failed_jobs'); diff --git a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php index 6c81fd2..d362751 100644 --- a/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php +++ b/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php @@ -6,11 +6,6 @@ return new class extends Migration { - /** - * Run the migrations. - * - * @return void - */ public function up() { Schema::create('personal_access_tokens', function (Blueprint $table) { @@ -25,11 +20,6 @@ public function up() }); } - /** - * Reverse the migrations. - * - * @return void - */ public function down() { Schema::dropIfExists('personal_access_tokens'); diff --git a/public/index.php b/public/index.php index 1d69f3a..f3c2ebc 100644 --- a/public/index.php +++ b/public/index.php @@ -16,7 +16,7 @@ | */ -if (file_exists($maintenance = __DIR__.'/../storage/framework/maintenance.php')) { +if (file_exists($maintenance = __DIR__ . '/../storage/framework/maintenance.php')) { require $maintenance; } @@ -31,7 +31,7 @@ | */ -require __DIR__.'/../vendor/autoload.php'; +require __DIR__ . '/../vendor/autoload.php'; /* |-------------------------------------------------------------------------- @@ -44,7 +44,7 @@ | */ -$app = require_once __DIR__.'/../bootstrap/app.php'; +$app = require_once __DIR__ . '/../bootstrap/app.php'; $kernel = $app->make(Kernel::class); diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 547152f..ab92402 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -13,7 +13,7 @@ trait CreatesApplication */ public function createApplication() { - $app = require __DIR__.'/../bootstrap/app.php'; + $app = require __DIR__ . '/../bootstrap/app.php'; $app->make(Kernel::class)->bootstrap();