From 9aebc9395ea6d5bce57b899f220a0d59a1a33283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ey=C3=BCp=20Erdo=C4=9Fan?= Date: Mon, 27 May 2024 17:09:31 +0300 Subject: [PATCH] Apply pint --- app/Actions/Fortify/CreateNewUser.php | 1 - app/Actions/Fortify/ResetUserPassword.php | 1 - app/Actions/Fortify/UpdateUserPassword.php | 1 - .../Fortify/UpdateUserProfileInformation.php | 2 - app/Console/Kernel.php | 1 - .../Controllers/Api/Auth/AuthController.php | 13 ---- .../Controllers/Auth/RegisterController.php | 2 - .../Middleware/RedirectIfAuthenticated.php | 1 - app/Models/User.php | 7 +- app/Providers/FortifyServiceProvider.php | 2 +- app/Repositories/BaseRepository.php | 38 +---------- app/Traits/StorageTrait.php | 19 ------ config/debugbar.php | 66 +++++++++---------- ..._add_two_factor_columns_to_users_table.php | 12 ++-- database/seeders/DatabaseSeeder.php | 2 - .../seeders/Local/User/DefaultUserSeeder.php | 2 - database/seeders/Local/User/UserSeeder.php | 2 - routes/web.php | 2 +- 18 files changed, 47 insertions(+), 127 deletions(-) diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index cc593f3..38500d5 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -15,7 +15,6 @@ class CreateNewUser implements CreatesNewUsers /** * Validate and create a newly registered user. * - * @param array $input * @return \App\Models\User */ public function create(array $input) diff --git a/app/Actions/Fortify/ResetUserPassword.php b/app/Actions/Fortify/ResetUserPassword.php index a1e811b..86e38cc 100644 --- a/app/Actions/Fortify/ResetUserPassword.php +++ b/app/Actions/Fortify/ResetUserPassword.php @@ -14,7 +14,6 @@ class ResetUserPassword implements ResetsUserPasswords * Validate and reset the user's forgotten password. * * @param mixed $user - * @param array $input * @return void */ public function reset($user, array $input) diff --git a/app/Actions/Fortify/UpdateUserPassword.php b/app/Actions/Fortify/UpdateUserPassword.php index 0c587ae..1bbe4e7 100644 --- a/app/Actions/Fortify/UpdateUserPassword.php +++ b/app/Actions/Fortify/UpdateUserPassword.php @@ -14,7 +14,6 @@ class UpdateUserPassword implements UpdatesUserPasswords * Validate and update the user's password. * * @param mixed $user - * @param array $input * @return void */ public function update($user, array $input) diff --git a/app/Actions/Fortify/UpdateUserProfileInformation.php b/app/Actions/Fortify/UpdateUserProfileInformation.php index 95e84ab..d63ad26 100644 --- a/app/Actions/Fortify/UpdateUserProfileInformation.php +++ b/app/Actions/Fortify/UpdateUserProfileInformation.php @@ -13,7 +13,6 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation * Validate and update the given user's profile information. * * @param mixed $user - * @param array $input * @return void */ public function update($user, array $input) @@ -45,7 +44,6 @@ public function update($user, array $input) * Update the given verified user's profile information. * * @param mixed $user - * @param array $input * @return void */ protected function updateVerifiedUser($user, array $input) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index d8bc1d2..854bcc8 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -10,7 +10,6 @@ class Kernel extends ConsoleKernel /** * Define the application's command schedule. * - * @param \Illuminate\Console\Scheduling\Schedule $schedule * @return void */ protected function schedule(Schedule $schedule) diff --git a/app/Http/Controllers/Api/Auth/AuthController.php b/app/Http/Controllers/Api/Auth/AuthController.php index 58f5351..fe200a0 100644 --- a/app/Http/Controllers/Api/Auth/AuthController.php +++ b/app/Http/Controllers/Api/Auth/AuthController.php @@ -18,8 +18,6 @@ class AuthController extends ApiController /** * Login user with credentials * - * @param UserLoginRequest $request - * @return array|Response * * @throws ValidationException */ @@ -67,8 +65,6 @@ public function login(UserLoginRequest $request): array|Response /** * Register new user * - * @param UserRegisterRequest $request - * @return array|Response * * @throws ValidationException */ @@ -93,9 +89,6 @@ public function register(UserRegisterRequest $request): array|Response /** * Logout on this device - * - * @param Request $request - * @return array|Response */ public function logout(Request $request): array|Response { @@ -110,8 +103,6 @@ public function logout(Request $request): array|Response /** * Show authenticated user - * - * @return Authenticatable|Response */ public function me(): Response|Authenticatable { @@ -121,10 +112,6 @@ public function me(): Response|Authenticatable /** * Logout on this device * This method using for prevent multiple logins on one device - * - * @param User $user - * @param string $clientUserAgent - * @return void */ private function logoutOnThisDevice(User $user, string $clientUserAgent): void { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 69efd5f..ffcb3b8 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -44,7 +44,6 @@ public function __construct() /** * Get a validator for an incoming registration request. * - * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) @@ -59,7 +58,6 @@ protected function validator(array $data) /** * Create a new user instance after a valid registration. * - * @param array $data * @return \App\Models\User */ protected function create(array $data) diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index a2813a0..4e7c24b 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -12,7 +12,6 @@ class RedirectIfAuthenticated /** * Handle an incoming request. * - * @param \Illuminate\Http\Request $request * @param \Closure(\Illuminate\Http\Request): (\Illuminate\Http\Response|\Illuminate\Http\RedirectResponse) $next * @param string|null ...$guards * @return \Illuminate\Http\Response|\Illuminate\Http\RedirectResponse diff --git a/app/Models/User.php b/app/Models/User.php index eaa403c..f3fa19e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -2,12 +2,12 @@ namespace App\Models; -use Laravel\Sanctum\HasApiTokens; -use Illuminate\Notifications\Notifiable; -use Laravel\Fortify\TwoFactorAuthenticatable; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; +use Illuminate\Notifications\Notifiable; +use Laravel\Fortify\TwoFactorAuthenticatable; +use Laravel\Sanctum\HasApiTokens; /** * App\Models\User @@ -37,6 +37,7 @@ * @method static \Illuminate\Database\Eloquent\Builder|User wherePassword($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereRememberToken($value) * @method static \Illuminate\Database\Eloquent\Builder|User whereUpdatedAt($value) + * * @mixin \Eloquent */ class User extends Authenticatable implements MustVerifyEmail diff --git a/app/Providers/FortifyServiceProvider.php b/app/Providers/FortifyServiceProvider.php index 913716e..367a028 100644 --- a/app/Providers/FortifyServiceProvider.php +++ b/app/Providers/FortifyServiceProvider.php @@ -39,7 +39,7 @@ public function boot() RateLimiter::for('login', function (Request $request) { $email = (string) $request->email; - return Limit::perMinute(5)->by($email . $request->ip()); + return Limit::perMinute(5)->by($email.$request->ip()); }); RateLimiter::for('two-factor', function (Request $request) { diff --git a/app/Repositories/BaseRepository.php b/app/Repositories/BaseRepository.php index 17f643b..592f203 100644 --- a/app/Repositories/BaseRepository.php +++ b/app/Repositories/BaseRepository.php @@ -10,19 +10,11 @@ abstract class BaseRepository { - /** - * @var Model - */ protected Model $model; - /** - * @var Application - */ protected Application $app; /** - * @param Application $app - * * @throws \Exception */ public function __construct(Application $app) @@ -33,22 +25,17 @@ public function __construct(Application $app) /** * Get searchable fields array - * - * @return array */ abstract public function getFieldsSearchable(): array; /** * Configure the Model - * - * @return string */ abstract public function model(): string; /** * Make Model instance * - * @return Model * * @throws \Exception */ @@ -65,10 +52,6 @@ public function makeModel(): Model /** * Paginate records for scaffold. - * - * @param int $perPage - * @param array $columns - * @return LengthAwarePaginator */ public function paginate(int $perPage, array $columns = ['*']): LengthAwarePaginator { @@ -79,13 +62,8 @@ public function paginate(int $perPage, array $columns = ['*']): LengthAwarePagin /** * Build a query for retrieving all records. - * - * @param array $search - * @param int|null $skip - * @param int|null $limit - * @return Builder */ - public function allQuery(array $search = [], int $skip = null, int $limit = null): Builder + public function allQuery(array $search = [], ?int $skip = null, ?int $limit = null): Builder { $query = $this->model->newQuery(); @@ -111,13 +89,9 @@ public function allQuery(array $search = [], int $skip = null, int $limit = null /** * Retrieve all records with given filter criteria * - * @param array $search - * @param int|null $skip - * @param int|null $limit - * @param array $columns * @return LengthAwarePaginator|Builder[]|Collection */ - public function all(array $search = [], int $skip = null, int $limit = null, array $columns = ['*']): Collection|LengthAwarePaginator|array + public function all(array $search = [], ?int $skip = null, ?int $limit = null, array $columns = ['*']): Collection|LengthAwarePaginator|array { $query = $this->allQuery($search, $skip, $limit); @@ -126,9 +100,6 @@ public function all(array $search = [], int $skip = null, int $limit = null, arr /** * Create model record - * - * @param array $input - * @return Model */ public function create(array $input): Model { @@ -142,8 +113,6 @@ public function create(array $input): Model /** * Find model record for given id * - * @param int $id - * @param array $columns * @return Builder|Builder[]|Collection|Model|null */ public function find(int $id, array $columns = ['*']): Model|Collection|Builder|array|null @@ -156,8 +125,6 @@ public function find(int $id, array $columns = ['*']): Model|Collection|Builder| /** * Update model record for given id * - * @param array $input - * @param int $id * @return Builder|Builder[]|Collection|Model */ public function update(array $input, int $id): Model|Collection|Builder|array @@ -174,7 +141,6 @@ public function update(array $input, int $id): Model|Collection|Builder|array } /** - * @param int $id * @return bool|mixed|null * * @throws \Exception diff --git a/app/Traits/StorageTrait.php b/app/Traits/StorageTrait.php index 9bc6919..c334e43 100644 --- a/app/Traits/StorageTrait.php +++ b/app/Traits/StorageTrait.php @@ -13,7 +13,6 @@ trait StorageTrait * @param object $file * @param string $path * @param string $fileName - * @return bool|string */ public function saveFileToDisk($file, $folder, $fileName, $disk = 'public'): bool|string { @@ -32,8 +31,6 @@ public function saveFileToDisk($file, $folder, $fileName, $disk = 'public'): boo * Get path of local path * * @param object $filePath - * @param string $disk - * @return bool|string */ public function getStoragePath(string $filePath, string $disk = 'public'): bool|string { @@ -47,7 +44,6 @@ public function getStoragePath(string $filePath, string $disk = 'public'): bool| * @param object $file * @param string $path * @param string $fileName - * @return bool|string */ public function moveFileOnDisk(string $filePath, string $newPath, string $disk = 'public'): bool|string { @@ -60,10 +56,6 @@ public function moveFileOnDisk(string $filePath, string $newPath, string $disk = /** * Delete a file from the storage. - * - * @param string $filePath - * @param string $disk - * @return bool */ public function deleteFileFromDisk(string $filePath, string $disk = 'public'): bool { @@ -76,10 +68,6 @@ public function deleteFileFromDisk(string $filePath, string $disk = 'public'): b /** * Get a file from the storage. - * - * @param string $filePath - * @param string $disk - * @return string|bool */ public function getFileFromDisk(string $filePath, string $disk = 'public'): string|bool { @@ -93,8 +81,6 @@ public function getFileFromDisk(string $filePath, string $disk = 'public'): stri /** * Check file exists in the storage. * - * @param string $filePath - * @param string $disk * @return string|bool */ public function fileExists(string $filePath, string $disk = 'public'): bool @@ -104,11 +90,6 @@ public function fileExists(string $filePath, string $disk = 'public'): bool /** * Download a file from the storage. - * - * @param string $filePath - * @param string $fileName - * @param string $disk - * @return StreamedResponse */ public function downloadFileFromDisk(string $filePath, string $fileName, string $disk = 'public'): StreamedResponse { diff --git a/config/debugbar.php b/config/debugbar.php index fe3b192..b18c919 100644 --- a/config/debugbar.php +++ b/config/debugbar.php @@ -33,13 +33,13 @@ | */ 'storage' => [ - 'enabled' => true, - 'driver' => 'file', // redis, file, pdo, socket, custom - 'path' => storage_path('debugbar'), // For file driver + 'enabled' => true, + 'driver' => 'file', // redis, file, pdo, socket, custom + 'path' => storage_path('debugbar'), // For file driver 'connection' => null, // Leave null for default connection (Redis/PDO) - 'provider' => '', // Instance of StorageInterface for custom driver - 'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver - 'port' => 2304, // Port to use with the "socket" driver + 'provider' => '', // Instance of StorageInterface for custom driver + 'hostname' => '127.0.0.1', // Hostname to use with the "socket" driver + 'port' => 2304, // Port to use with the "socket" driver ], /* @@ -149,29 +149,29 @@ */ 'collectors' => [ - 'phpinfo' => true, // Php version - 'messages' => true, // Messages - 'time' => true, // Time Datalogger - 'memory' => true, // Memory usage - 'exceptions' => true, // Exception displayer - 'log' => true, // Logs from Monolog (merged in messages if enabled) - 'db' => true, // Show database (PDO) queries and bindings - 'views' => true, // Views with their data - 'route' => true, // Current route information - 'auth' => false, // Display Laravel authentication status - 'gate' => true, // Display Laravel Gate checks - 'session' => true, // Display session data + 'phpinfo' => true, // Php version + 'messages' => true, // Messages + 'time' => true, // Time Datalogger + 'memory' => true, // Memory usage + 'exceptions' => true, // Exception displayer + 'log' => true, // Logs from Monolog (merged in messages if enabled) + 'db' => true, // Show database (PDO) queries and bindings + 'views' => true, // Views with their data + 'route' => true, // Current route information + 'auth' => false, // Display Laravel authentication status + 'gate' => true, // Display Laravel Gate checks + 'session' => true, // Display session data 'symfony_request' => true, // Only one can be enabled.. - 'mail' => true, // Catch mail messages - 'laravel' => false, // Laravel version and environment - 'events' => false, // All events fired + 'mail' => true, // Catch mail messages + 'laravel' => false, // Laravel version and environment + 'events' => false, // All events fired 'default_request' => false, // Regular or special Symfony request logger - 'logs' => false, // Add the latest log messages - 'files' => false, // Show the included files - 'config' => false, // Display config settings - 'cache' => false, // Display cache events - 'models' => true, // Display models - 'livewire' => true, // Display Livewire (when available) + 'logs' => false, // Add the latest log messages + 'files' => false, // Show the included files + 'config' => false, // Display config settings + 'cache' => false, // Display cache events + 'models' => true, // Display models + 'livewire' => true, // Display Livewire (when available) ], /* @@ -188,17 +188,17 @@ 'show_name' => true, // Also show the users name/email in the debugbar ], 'db' => [ - 'with_params' => true, // Render SQL with the parameters substituted - 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. + 'with_params' => true, // Render SQL with the parameters substituted + 'backtrace' => true, // Use a backtrace to find the origin of the query in your files. 'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults) - 'timeline' => false, // Add the queries to the timeline - 'duration_background' => true, // Show shaded background on each query relative to how long it took to execute. + 'timeline' => false, // Add the queries to the timeline + 'duration_background' => true, // Show shaded background on each query relative to how long it took to execute. 'explain' => [ // Show EXPLAIN output on queries 'enabled' => false, 'types' => ['SELECT'], // Deprecated setting, is always only SELECT ], - 'hints' => false, // Show hints for common mistakes - 'show_copy' => false, // Show copy button next to the query + 'hints' => false, // Show hints for common mistakes + 'show_copy' => false, // Show copy button next to the query ], 'mail' => [ 'full_log' => false, diff --git a/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php b/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php index 6acbf7b..ff1fa65 100644 --- a/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php +++ b/database/migrations/2014_10_12_200000_add_two_factor_columns_to_users_table.php @@ -16,17 +16,17 @@ public function up() { Schema::table('users', function (Blueprint $table) { $table->text('two_factor_secret') - ->after('password') - ->nullable(); + ->after('password') + ->nullable(); $table->text('two_factor_recovery_codes') - ->after('two_factor_secret') - ->nullable(); + ->after('two_factor_secret') + ->nullable(); if (Fortify::confirmsTwoFactorAuthentication()) { $table->timestamp('two_factor_confirmed_at') - ->after('two_factor_recovery_codes') - ->nullable(); + ->after('two_factor_recovery_codes') + ->nullable(); } }); } diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 8d5f949..6cc00f2 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -8,8 +8,6 @@ class DatabaseSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ public function run(): void { diff --git a/database/seeders/Local/User/DefaultUserSeeder.php b/database/seeders/Local/User/DefaultUserSeeder.php index 7618fa1..3db2a92 100644 --- a/database/seeders/Local/User/DefaultUserSeeder.php +++ b/database/seeders/Local/User/DefaultUserSeeder.php @@ -10,8 +10,6 @@ class DefaultUserSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ public function run(): void { diff --git a/database/seeders/Local/User/UserSeeder.php b/database/seeders/Local/User/UserSeeder.php index 49ae31e..3ecf31a 100644 --- a/database/seeders/Local/User/UserSeeder.php +++ b/database/seeders/Local/User/UserSeeder.php @@ -9,8 +9,6 @@ class UserSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ public function run(): void { diff --git a/routes/web.php b/routes/web.php index c34595e..ff50d05 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,7 +1,7 @@