Skip to content

Commit

Permalink
Fix code styling
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbutcher authored and github-actions[bot] committed Feb 25, 2025
1 parent 02f5db6 commit c59395f
Show file tree
Hide file tree
Showing 51 changed files with 97 additions and 154 deletions.
2 changes: 1 addition & 1 deletion config/socialstream.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@
'registration-failed' => '/register',
'provider-linked' => '/user/profile',
'provider-link-failed' => '/user/profile',
]
],
];
1 change: 0 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use Illuminate\Support\Facades\Route;
use JoelButcher\Socialstream\Http\Controllers\OAuthController;


Route::group(['middleware' => config('socialstream.middleware', ['web'])], function () {
Route::get('/oauth/{provider}/callback/prompt', [OAuthController::class, 'prompt'])->name('oauth.callback.prompt');
Route::post('/oauth/{provider}/callback/confirm', [OAuthController::class, 'confirm'])->name(
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/AttemptToAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function handle($request, $next, $authIdentifier = null)

$socialUser = $this->resolver->resolve($request->route('provider'));

$connectedAccount = tap(Socialstream::$connectedAccountModel::where('email', $socialUser->getEmail())->first(), function ($connectedAccount) use ($request, $socialUser) {
$connectedAccount = tap(Socialstream::$connectedAccountModel::where('email', $socialUser->getEmail())->first(), function ($connectedAccount) use ($request) {
if (! $connectedAccount) {
event(new Failed($this->guard?->name ?? config('fortify.guard'), user: null, credentials: [
'provider' => $request->route('provider'),
Expand Down
14 changes: 7 additions & 7 deletions src/Actions/AuthenticateOAuthCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ function ($request, $next) use ($user) {

return $next($request);
},
]))->then(fn() => app(OAuthRegisterResponse::class)),
fn() => event(new NewOAuthRegistration($user, $provider, $providerAccount))
]))->then(fn () => app(OAuthRegisterResponse::class)),
fn () => event(new NewOAuthRegistration($user, $provider, $providerAccount))
);
}

Expand All @@ -156,8 +156,8 @@ protected function login(Authenticatable $user, mixed $account, string $provider
$this->updatesConnectedAccounts->update($user, $account, $provider, $providerAccount);

return tap(
$this->loginPipeline(request(), $user)->then(fn() => app(OAuthLoginResponse::class)),
fn() => event(new OAuthLogin($user, $provider, $account, $providerAccount)),
$this->loginPipeline(request(), $user)->then(fn () => app(OAuthLoginResponse::class)),
fn () => event(new OAuthLogin($user, $provider, $account, $providerAccount)),
);
}

Expand Down Expand Up @@ -215,7 +215,7 @@ public function link(Authenticatable $user, string $provider, ProviderUser $prov
return app(OAuthProviderLinkFailedResponse::class);
}

if (!$account) {
if (! $account) {
$this->createsConnectedAccounts->create($user, $provider, $providerAccount);
}

Expand Down Expand Up @@ -266,7 +266,7 @@ private function flashError(string $error): void
}
}

Session::flash('errors', (new ViewErrorBag())->put(
Session::flash('errors', (new ViewErrorBag)->put(
'default',
new MessageBag(['socialstream' => $error])
));
Expand All @@ -281,7 +281,7 @@ private function canRegister(): bool
return true;
}

if (class_exists(Fortify::class) && !FortifyFeatures::enabled(FortifyFeatures::registration())) {
if (class_exists(Fortify::class) && ! FortifyFeatures::enabled(FortifyFeatures::registration())) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Actions/RedirectIfTwoFactorAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected function validateCredentials($request)

$socialUser = $this->resolver->resolve($request->route('provider'));

$connectedAccount = tap(Socialstream::$connectedAccountModel::where('email', $socialUser->getEmail())->first(), function ($connectedAccount) use ($request, $socialUser) {
$connectedAccount = tap(Socialstream::$connectedAccountModel::where('email', $socialUser->getEmail())->first(), function ($connectedAccount) use ($request) {
if (! $connectedAccount) {
event(new Failed($this->guard?->name ?? config('fortify.guard'), user: null, credentials: [
'provider' => $request->route('provider'),
Expand Down
8 changes: 4 additions & 4 deletions src/Concerns/InteractsWithComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ protected function hasComposerPackage(string $package): bool
*/
protected function requireComposerPackages(array $packages, string $composerBinary = 'global'): bool
{
$outputStyle = new BufferedOutput();
$outputStyle = new BufferedOutput;

$command = $this->buildBaseComposerCommand('require', $packages, $composerBinary);

Expand All @@ -44,7 +44,7 @@ protected function requireComposerPackages(array $packages, string $composerBina
*/
protected function removeComposerDevPackages(array $packages, string $composerBinary = 'global'): bool
{
$outputStyle = new BufferedOutput();
$outputStyle = new BufferedOutput;

$command = $this->buildBaseComposerCommand('remove', $packages, $composerBinary, dev: true);

Expand All @@ -60,7 +60,7 @@ protected function removeComposerDevPackages(array $packages, string $composerBi
*/
protected function requireComposerDevPackages(array $packages, string $composerBinary = 'global'): bool
{
$outputStyle = new BufferedOutput();
$outputStyle = new BufferedOutput;

$command = $this->buildBaseComposerCommand('require', $packages, $composerBinary, dev: true);

Expand Down Expand Up @@ -89,6 +89,6 @@ protected function buildBaseComposerCommand(string $command, array $packages, st
*/
protected function phpBinary(): string
{
return (new PhpExecutableFinder())->find(false) ?: 'php';
return (new PhpExecutableFinder)->find(false) ?: 'php';
}
}
2 changes: 1 addition & 1 deletion src/Concerns/RefreshesOAuth2Tokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ trait RefreshesOAuth2Tokens
*/
public function refreshToken($connectedAccount): RefreshedCredentials
{
if(!$connectedAccount instanceof ConnectedAccount) {
if (! $connectedAccount instanceof ConnectedAccount) {
throw new \RuntimeException('Given parameter must be of type ConnectedAccount.');
}

Expand Down
23 changes: 11 additions & 12 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
use JoelButcher\Socialstream\Installer\Enums\JetstreamInstallStack;
use JoelButcher\Socialstream\Installer\InstallManager;
use Laravel\Fortify\Features as FortifyFeatures;
use Laravel\Fortify\FortifyServiceProvider;
use Laravel\Jetstream\Jetstream;
use Pest\TestSuite;
use RuntimeException;
Expand Down Expand Up @@ -185,10 +184,10 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp
{
if ($this->isUsingFilament()) {
$input->setOption('pest', $this->isUsingPest() || $this->option('pest') || select(
label: 'Which testing framework do you prefer?',
options: ['PHPUnit', 'Pest'],
default: $this->isUsingPest() ? 'Pest' : 'PHPUnit'
) === 'Pest');
label: 'Which testing framework do you prefer?',
options: ['PHPUnit', 'Pest'],
default: $this->isUsingPest() ? 'Pest' : 'PHPUnit'
) === 'Pest');

return;
}
Expand Down Expand Up @@ -235,16 +234,16 @@ protected function afterPromptingForMissingArguments(InputInterface $input, Outp
))->each(fn ($option) => $input->setOption($option, true));
} else {
$input->setOption('dark', $this->option('dark') || confirm(
label: 'Would you like dark mode support?',
default: false
));
label: 'Would you like dark mode support?',
default: false
));
}

$input->setOption('pest', $this->isUsingPest() || $this->option('pest') || select(
label: 'Which testing framework do you prefer?',
options: ['PHPUnit', 'Pest'],
default: $this->isUsingPest() ? 'Pest' : 'PHPUnit'
) === 'Pest');
label: 'Which testing framework do you prefer?',
options: ['PHPUnit', 'Pest'],
default: $this->isUsingPest() ? 'Pest' : 'PHPUnit'
) === 'Pest');
}
}

Expand Down
6 changes: 0 additions & 6 deletions src/Console/UpgradeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@
use Illuminate\Contracts\Console\PromptsForMissingInput;
use Illuminate\Support\Str;
use JoelButcher\Socialstream\Concerns\InteractsWithComposer;
use JoelButcher\Socialstream\Installer\Drivers\Jetstream\InertiaDriver;
use JoelButcher\Socialstream\Installer\Drivers\Jetstream\JetstreamDriver;
use JoelButcher\Socialstream\Installer\Drivers\Jetstream\LivewireDriver;
use JoelButcher\Socialstream\Installer\Enums\InstallStarterKit;
use JoelButcher\Socialstream\Socialstream;

use function Laravel\Prompts\alert;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\error;
use function Laravel\Prompts\intro;
use function Laravel\Prompts\multiselect;
use function Laravel\Prompts\outro;
use function Laravel\Prompts\spin;

class UpgradeCommand extends Command implements PromptsForMissingInput
{
Expand Down
2 changes: 1 addition & 1 deletion src/Contracts/HandlesInvalidState.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ interface HandlesInvalidState
/**
* Handle an invalid state exception from a Socialite provider.
*/
public function handle(InvalidStateException $exception): Response | RedirectResponse;
public function handle(InvalidStateException $exception): Response|RedirectResponse;
}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthFailedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace JoelButcher\Socialstream\Contracts;

interface OAuthFailedResponse extends SocialstreamResponse
{

}
interface OAuthFailedResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthLoginFailedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
/**
* @deprecated in v7, use OAuthFailedResponse instead.
*/
interface OAuthLoginFailedResponse extends SocialstreamResponse
{

}
interface OAuthLoginFailedResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthLoginResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace JoelButcher\Socialstream\Contracts;

interface OAuthLoginResponse extends SocialstreamResponse
{

}
interface OAuthLoginResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthProviderLinkFailedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace JoelButcher\Socialstream\Contracts;

interface OAuthProviderLinkFailedResponse extends SocialstreamResponse
{

}
interface OAuthProviderLinkFailedResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthProviderLinkedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace JoelButcher\Socialstream\Contracts;

interface OAuthProviderLinkedResponse extends SocialstreamResponse
{

}
interface OAuthProviderLinkedResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthRegisterFailedResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
/**
* @deprecated in v7, use OAuthFailedResponse instead.
*/
interface OAuthRegisterFailedResponse extends SocialstreamResponse
{

}
interface OAuthRegisterFailedResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/OAuthRegisterResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,4 @@

namespace JoelButcher\Socialstream\Contracts;

interface OAuthRegisterResponse extends SocialstreamResponse
{

}
interface OAuthRegisterResponse extends SocialstreamResponse {}
5 changes: 1 addition & 4 deletions src/Contracts/SocialstreamResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,4 @@

use Illuminate\Contracts\Support\Responsable;

interface SocialstreamResponse extends Responsable
{

}
interface SocialstreamResponse extends Responsable {}
1 change: 0 additions & 1 deletion src/Events/ConnectedAccountEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace JoelButcher\Socialstream\Events;

use App\Models\ConnectedAccount;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
Expand Down
2 changes: 1 addition & 1 deletion src/Filament/SocialstreamPanelProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SocialstreamPanelProvider extends AdminPanelProvider
public function panel(Panel $panel): Panel
{
return parent::panel($panel)->plugin(
new SocialstreamPlugin(),
new SocialstreamPlugin,
);
}
}
4 changes: 2 additions & 2 deletions src/Filament/SocialstreamPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ public function register(Panel $panel): void
$panel->renderHook('panels::auth.login.form.after', function () {
return Socialstream::show() ?
view(config('socialstream.component', 'socialstream::components.socialstream'), [
'errors' => session('errors') ?? new ViewErrorBag(),
'errors' => session('errors') ?? new ViewErrorBag,
]) : '';
});

if ($panel->hasRegistration()) {
$panel->renderHook('panels::auth.register.form.after', function () {
return Socialstream::show() ?
view(config('socialstream.component', 'socialstream::components.socialstream'), [
'errors' => session('errors') ?? new ViewErrorBag(),
'errors' => session('errors') ?? new ViewErrorBag,
]) : '';
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/Http/Controllers/Inertia/ConnectedAccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

namespace JoelButcher\Socialstream\Http\Controllers\Inertia;

use Illuminate\Contracts\Auth\StatefulGuard;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\Session;
use Illuminate\Validation\ValidationException;
use Illuminate\Contracts\Auth\StatefulGuard;
use Laravel\Fortify\Actions\ConfirmPassword;
use JoelButcher\Socialstream\Socialstream;
use Laravel\Fortify\Actions\ConfirmPassword;

class ConnectedAccountController extends Controller
{
Expand Down
5 changes: 2 additions & 3 deletions src/Http/Controllers/OAuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function confirm(string $provider): SocialstreamResponse|RedirectResponse
return app(OAuthProviderLinkFailedResponse::class);
}

if (!$providerAccount) {
if (! $providerAccount) {
throw new \DomainException(
message: 'Could not retrieve social provider information.'
);
Expand All @@ -118,10 +118,9 @@ private function flashError(string $error): void
}
}

Session::flash('errors', (new ViewErrorBag())->put(
Session::flash('errors', (new ViewErrorBag)->put(
'default',
new MessageBag(['socialstream' => $error])
));
}

}
1 change: 0 additions & 1 deletion src/Http/Responses/OAuthRegisterResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use JoelButcher\Socialstream\Concerns\InteractsWithComposer;
use JoelButcher\Socialstream\Contracts\OAuthRegisterResponse as RegisterResponseContract;
use JoelButcher\Socialstream\Socialstream;
use Laravel\Fortify\Contracts\RegisterResponse as FortifyRegisterResponse;
use Laravel\Fortify\Fortify;
use Laravel\Fortify\Http\Responses\RegisterResponse;

Expand Down
1 change: 0 additions & 1 deletion src/Installer/Drivers/Breeze/BreezeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace JoelButcher\Socialstream\Installer\Drivers\Breeze;

use Illuminate\Support\Facades\File;
use Illuminate\Support\Str;
use JoelButcher\Socialstream\Installer\Drivers\Driver;
use JoelButcher\Socialstream\Installer\Enums\BreezeInstallStack;
use JoelButcher\Socialstream\Installer\Enums\InstallOptions;
Expand Down
2 changes: 1 addition & 1 deletion src/Installer/Drivers/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected function removeDarkClasses(Finder $finder): void
*/
protected function runCommands(array $commands, array $env = []): Process
{
$output = new BufferedOutput();
$output = new BufferedOutput;
$process = Process::fromShellCommandline(implode(' && ', $commands), null, $env, null, null);

$process->run(function ($type, $line) use ($output) {
Expand Down
Loading

0 comments on commit c59395f

Please sign in to comment.