Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fixes from StyleCI #132

Open
wants to merge 1 commit into
base: dependabot/composer/symfony/http-kernel-6.2.6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions app/Console/Commands/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ public function handle()
/**
* Update the .env file from an array of $key => $value pairs.
*
* @param array $updatedValues
*
* @param array $updatedValues
* @return void
*/
protected function updateEnvironmentFile($updatedValues)
Expand Down Expand Up @@ -113,8 +112,7 @@ protected function createEnvFile()
/**
* Migrate the db with the new credentials.
*
* @param array $credentials
*
* @param array $credentials
* @return void
*/
protected function migrateDatabaseWithFreshCredentials($credentials)
Expand All @@ -137,9 +135,8 @@ protected function migrateDatabaseWithFreshCredentials($credentials)
/**
* Prompt the user for optional input but hide the answer from the console.
*
* @param string $question
* @param bool $fallback
*
* @param string $question
* @param bool $fallback
* @return string
*/
public function askHiddenWithDefault($question, $fallback = true)
Expand Down
17 changes: 8 additions & 9 deletions app/Console/Commands/PurgeUnusedMediaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Knot\Console\Commands;

use Cloudinary\Api\Admin\AdminApi;
use Cloudinary\Cloudinary;
use Illuminate\Console\Command;
use Knot\Models\User;
use Knot\Models\PostMedia;
use Cloudinary\Cloudinary;
use Cloudinary\Api\Admin\AdminApi;
use Knot\Models\User;

class PurgeUnusedMediaCommand extends Command
{
Expand All @@ -29,7 +29,6 @@ class PurgeUnusedMediaCommand extends Command
*
* @return void
*/

public function __construct()
{
parent::__construct();
Expand All @@ -56,14 +55,14 @@ public function handle()

$existingPaths = collect(PostMedia::all()->map->path->concat(User::all()->map->avatar));

$res = (array)$api->assets(['prefix' => $env, 'type' => 'upload', 'max_results' => 500]);
$res = (array) $api->assets(['prefix' => $env, 'type' => 'upload', 'max_results' => 500]);

$assets = collect($res['resources']);

while (array_key_exists('next_cursor', $res)) {
$res = (array)$api->assets(['prefix' => $env, 'type' => 'upload', 'max_results' => 500, 'next_cursor' => $res['next_cursor']]);
$res = (array) $api->assets(['prefix' => $env, 'type' => 'upload', 'max_results' => 500, 'next_cursor' => $res['next_cursor']]);
$assets = $assets->concat($res['resources']);
};
}

$idsToDelete = ($assets->reject(function ($value) use ($existingPaths) {
return $existingPaths->contains($value['public_id']);
Expand All @@ -89,9 +88,9 @@ public function handle()
$this->output->newLine();
$this->output->newLine();

$this->info("All done.");
$this->info('All done.');
} else {
$this->info("No stray photos found!");
$this->info('No stray photos found!');
}
}
}
4 changes: 2 additions & 2 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Kernel extends ConsoleKernel
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*/
protected function schedule(Schedule $schedule)
{
Expand All @@ -29,7 +29,7 @@ protected function schedule(Schedule $schedule)
*/
protected function commands()
{
$this->load(__DIR__ . '/Commands');
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
2 changes: 1 addition & 1 deletion app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function store(Request $request)
'password' => 'required',
]);

if (!auth()->attempt($credentials, true)) {
if (! auth()->attempt($credentials, true)) {
return response()->json(['error' => 'Invalid Credentials'], 401);
}

Expand Down
16 changes: 6 additions & 10 deletions app/Http/Controllers/CommentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ class CommentsController extends Controller
/**
* Display a listing of the resource.
*
* @param Knot\Models\Post $post
*
* @param Knot\Models\Post $post
* @return \Illuminate\Http\Response
*/
public function index(Post $post)
Expand All @@ -31,9 +30,8 @@ public function index(Post $post)
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\Post $post
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\Post $post
* @return \Illuminate\Http\Response
*/
public function store(Request $request, Post $post)
Expand Down Expand Up @@ -75,9 +73,8 @@ public function store(Request $request, Post $post)
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\Comment $comment
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\Comment $comment
* @return \Illuminate\Http\Response
*/
public function update(Request $request, Comment $comment)
Expand All @@ -94,8 +91,7 @@ public function update(Request $request, Comment $comment)
/**
* Remove the specified resource from storage.
*
* @param \Knot\Models\Comment $comment
*
* @param \Knot\Models\Comment $comment
* @return \Illuminate\Http\Response
*/
public function destroy(Comment $comment)
Expand Down
20 changes: 8 additions & 12 deletions app/Http/Controllers/FriendshipsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ public function index()
/**
* Send a friend request to another user.
*
* @param Request $request
* @param User $recipient
*
* @param Request $request
* @param User $recipient
* @return \Illuminate\Http\Response
*/
public function addFriend(Request $request, User $recipient)
Expand All @@ -39,9 +38,8 @@ public function addFriend(Request $request, User $recipient)
/**
* Accept a friend request from another user.
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\User $sender
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\User $sender
* @return \Illuminate\Http\Response
*/
public function acceptFriendship(Request $request, User $sender)
Expand All @@ -56,9 +54,8 @@ public function acceptFriendship(Request $request, User $sender)
/**
* Deny a friend request from another user.
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\User $sender
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\User $sender
* @return \Illuminate\Http\Response
*/
public function denyFriendship(Request $request, User $sender)
Expand All @@ -71,9 +68,8 @@ public function denyFriendship(Request $request, User $sender)
/**
* Unfriend a user.
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\User $friend
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\User $friend
* @return \Illuminate\Http\Response
*/
public function unfriend(Request $request, User $friend)
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ public function show(User $user)
/**
* Set the user's avatar.
*
* @param \Illuminate\Http\Request $request
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function updateAvatar(Request $request)
Expand Down
5 changes: 2 additions & 3 deletions app/Http/Controllers/ReactionsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ class ReactionsController extends Controller
/**
* Add a new reaction to a post.
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\Post $post
*
* @param \Illuminate\Http\Request $request
* @param \Knot\Models\Post $post
* @return \Illuminate\Http\Response
*/
public function store(Request $request, Post $post)
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/TokensController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Knot\Http\Controllers;

use Knot\Models\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\ValidationException;
use Knot\Models\User;

class TokensController extends Controller
{
Expand All @@ -19,7 +19,7 @@ public function store(Request $request)

$user = User::whereEmail($credentials['email'])->firstOrFail();

if (!$user || !Hash::check($credentials['password'], $user->password)) {
if (! $user || ! Hash::check($credentials['password'], $user->password)) {
throw ValidationException::withMessages([
'email' => ['The provided credentials are incorrect.'],
]);
Expand Down
3 changes: 1 addition & 2 deletions app/Http/Controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public function show()
/**
* Register a new user.
*
* @param \Illuminate\Http\Request $request
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
Expand Down
7 changes: 3 additions & 4 deletions app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ class RedirectIfAuthenticated
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
Expand Down
5 changes: 2 additions & 3 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function isAdmin()
/**
* Hash the user's password.
*
* @param string $value
* @param string $value
*/
public function setPasswordAttribute($value)
{
Expand All @@ -79,8 +79,7 @@ public function getIsAdminAttribute($value)
/**
* Fetch an activity feed for the given user.
*
* @param User $user
*
* @param User $user
* @return \Illuminate\Database\Eloquent\Collection
*/
public function timeline()
Expand Down
5 changes: 2 additions & 3 deletions app/Notifications/AddedAsFriend.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class AddedAsFriend extends Notification
/**
* Create a new notification instance.
*
* @param User $sender
* @param User $sender
*/
public function __construct(User $sender)
{
Expand All @@ -22,8 +22,7 @@ public function __construct(User $sender)
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
Expand Down
2 changes: 1 addition & 1 deletion app/Notifications/AddedPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class AddedPost extends Notification
/**
* Create a new notification instance.
*
* @param Post $post
* @param Post $post
*/
public function __construct(Post $post)
{
Expand Down
5 changes: 2 additions & 3 deletions app/Notifications/CommentRepliedTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CommentRepliedTo extends Notification
/**
* Create a new notification instance.
*
* @param Comment $comment
* @param Comment $comment
*/
public function __construct(Comment $comment)
{
Expand All @@ -22,8 +22,7 @@ public function __construct(Comment $comment)
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
Expand Down
5 changes: 2 additions & 3 deletions app/Notifications/FriendRequestAccepted.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class FriendRequestAccepted extends Notification
/**
* Create a new notification instance.
*
* @param User $recipient
* @param User $recipient
*/
public function __construct(User $recipient)
{
Expand All @@ -22,8 +22,7 @@ public function __construct(User $recipient)
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
Expand Down
5 changes: 2 additions & 3 deletions app/Notifications/PostCommentedOn.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PostCommentedOn extends Notification
/**
* Create a new notification instance.
*
* @param Comment $comment
* @param Comment $comment
*/
public function __construct(Comment $comment)
{
Expand All @@ -24,8 +24,7 @@ public function __construct(Comment $comment)
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
Expand Down
5 changes: 2 additions & 3 deletions app/Notifications/PostReactedTo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class PostReactedTo extends Notification
/**
* Create a new notification instance.
*
* @param Reaction $reaction
* @param Reaction $reaction
*/
public function __construct(Reaction $reaction)
{
Expand All @@ -24,8 +24,7 @@ public function __construct(Reaction $reaction)
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
Expand Down
Loading