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 formatting fixes with Duster #508

Merged
merged 5 commits into from
Jul 3, 2024
Merged
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
55 changes: 12 additions & 43 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,15 @@ on:
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.3
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.3
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
duster:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: "Duster Lint"
uses: tighten/duster-action@v3
with:
args: lint
2 changes: 0 additions & 2 deletions app/CallingAllPapers/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace App\CallingAllPapers;

use App\CallingAllPapers\Event;
use GuzzleHttp\Client as GuzzleClient;
use GuzzleHttp\json_decode;

class Client
{
Expand Down
2 changes: 1 addition & 1 deletion app/CallingAllPapers/ConferenceImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class ConferenceImporter

private $geocoder;

public function __construct(int $authorId = null)
public function __construct(?int $authorId = null)
{
$this->authorId = $authorId ?: auth()->user()->id;
$this->geocoder = app(Geocoder::class);
Expand Down
6 changes: 2 additions & 4 deletions app/CallingAllPapers/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,11 @@ class Event
/** The URI to the event's CFP */
public $uri;

private function __construct()
{
}
private function __construct() {}

public static function createFromApiObject(stdClass $object)
{
$event = new self();
$event = new self;
$event->id = self::generateIdWithYear($object);

foreach (get_object_vars($event) as $property => $unused) {
Expand Down
6 changes: 3 additions & 3 deletions app/Casts/SpeakerPackage.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function toDisplay()
{
if (! $this->currency) {
return collect();
};
}

return collect($this->categories)->map(function ($item) {
$currency = $this->currency;
Expand All @@ -68,7 +68,7 @@ public function toDecimal($category)
{
if (! $this->currency || ! array_key_exists($category, $this->categories)) {
return;
};
}

return with($this->categories[$category], function ($amount) {
if (! $amount > 0) {
Expand All @@ -85,7 +85,7 @@ public function toArray()
{
if (! $this->currency) {
return [];
};
}

return array_merge(['currency' => $this->currency], $this->categories);
}
Expand Down
4 changes: 1 addition & 3 deletions app/Commands/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace App\Commands;

abstract class Command
{
}
abstract class Command {}
2 changes: 1 addition & 1 deletion app/Console/Commands/VerifyConferenceImporterHeartbeat.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class VerifyConferenceImporterHeartbeat extends Command
public function handle(): int
{
if ($this->importerAppearsInactive()) {
(new TightenSlack())->notify(new ConferenceImporterInactive());
(new TightenSlack)->notify(new ConferenceImporterInactive);
}

return Command::SUCCESS;
Expand Down
4 changes: 1 addition & 3 deletions app/Events/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

namespace App\Events;

abstract class Event
{
}
abstract class Event {}
1 change: 0 additions & 1 deletion app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Illuminate\Auth\AuthenticationException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Throwable;

class Handler extends ExceptionHandler
{
Expand Down
4 changes: 1 addition & 3 deletions app/Exceptions/InvalidAddressGeocodingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@

use Exception;

class InvalidAddressGeocodingException extends Exception
{
}
class InvalidAddressGeocodingException extends Exception {}
8 changes: 4 additions & 4 deletions app/Filament/Resources/ConferenceIssueResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ public static function form(Form $form): Form
Section::make('Conference')->columns(2)->schema([
Grid::make()->schema([
TextInput::make('name')
->formatStateUsing(fn($record) => $record->conference->title),
->formatStateUsing(fn ($record) => $record->conference->title),
TextInput::make('Event dates')
->formatStateUsing(function ($record) {
return $record->conference->startsAtDisplay() . ' - ' . $record->conference->endsAtDisplay();
}),
Grid::make(3)->columnSpan(1)->schema([
TextInput::make('url')
->columnSpan(2)
->formatStateUsing(fn($record) => $record->conference->url),
->formatStateUsing(fn ($record) => $record->conference->url),
DropInAction::make('Conference URL')
->columnSpan(1)
->disableLabel()
Expand All @@ -68,10 +68,10 @@ public static function form(Form $form): Form
TextInput::make('reason'),
TextInput::make('reported by')
->columnSpan(1)
->formatStateUsing(fn($record) => $record->user->name),
->formatStateUsing(fn ($record) => $record->user->name),
]),
Placeholder::make('note')
->content(fn($record) => $record->note),
->content(fn ($record) => $record->note),
]),
]);
}
Expand Down
66 changes: 33 additions & 33 deletions app/Http/Controllers/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,39 +79,6 @@ public function update(Request $request): RedirectResponse
return redirect('account');
}

private function updateProfilePicture($user, $picture)
{
// Make regular image
$thumb = Image::make($picture->getRealPath())
->fit(self::THUMB_SIZE, self::THUMB_SIZE);

// Make hires image
$hires = Image::make($picture->getRealPath())
->fit(self::HIRES_SIZE, self::HIRES_SIZE, function ($constraint) {
$constraint->upsize();
});

// Delete the previous profile pictures
if ($user->profile_picture != null) {
Storage::delete([
User::PROFILE_PICTURE_THUMB_PATH . $user->profile_picture,
User::PROFILE_PICTURE_HIRES_PATH . $user->profile_picture,
]);
}

// Store the new profile pictures
Storage::put(User::PROFILE_PICTURE_THUMB_PATH . $picture->hashName(), $thumb->stream());
Storage::put(User::PROFILE_PICTURE_HIRES_PATH . $picture->hashName(), $hires->stream());

// Save the updated filename to the user
$user->updateProfilePicture($picture->hashName());
}

public function delete(): View
{
return view('account.confirm-delete');
}

public function destroy(): RedirectResponse
{
$user = auth()->user();
Expand All @@ -124,6 +91,11 @@ public function destroy(): RedirectResponse
return redirect('/');
}

public function delete(): View
{
return view('account.confirm-delete');
}

public function export(Filesystem $storage): Response
{
$user = auth()->user();
Expand Down Expand Up @@ -151,4 +123,32 @@ public function oAuthSettings(): View
{
return view('account.oauth-settings');
}

private function updateProfilePicture($user, $picture)
{
// Make regular image
$thumb = Image::make($picture->getRealPath())
->fit(self::THUMB_SIZE, self::THUMB_SIZE);

// Make hires image
$hires = Image::make($picture->getRealPath())
->fit(self::HIRES_SIZE, self::HIRES_SIZE, function ($constraint) {
$constraint->upsize();
});

// Delete the previous profile pictures
if ($user->profile_picture != null) {
Storage::delete([
User::PROFILE_PICTURE_THUMB_PATH . $user->profile_picture,
User::PROFILE_PICTURE_HIRES_PATH . $user->profile_picture,
]);
}

// Store the new profile pictures
Storage::put(User::PROFILE_PICTURE_THUMB_PATH . $picture->hashName(), $thumb->stream());
Storage::put(User::PROFILE_PICTURE_HIRES_PATH . $picture->hashName(), $hires->stream());

// Save the updated filename to the user
$user->updateProfilePicture($picture->hashName());
}
}
10 changes: 0 additions & 10 deletions app/Http/Controllers/Auth/ForgotPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,4 @@ class ForgotPasswordController extends Controller
|
*/
use SendsPasswordResetEmails;

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
10 changes: 0 additions & 10 deletions app/Http/Controllers/Auth/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ class LoginController extends Controller
*/
protected $redirectTo = '/dashboard';

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest', ['except' => 'logout']);
}

/**
* Handle a login request to the application.
*
Expand Down
19 changes: 4 additions & 15 deletions app/Http/Controllers/Auth/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use App\Http\Controllers\Controller;
use App\Http\Requests\Auth\RegisterFormRequest;
use App\Models\User;
use Illuminate\Auth\Events\Registered;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Event;
Expand Down Expand Up @@ -37,13 +36,13 @@ class RegisterController extends Controller
protected $redirectTo = '/dashboard';

/**
* Create a new controller instance.
* Handle a registration request for the application.
*
* @return void
* @return \Illuminate\Http\Response
*/
public function __construct()
public function register(RegisterFormRequest $request)
{
$this->middleware('guest');
return $this->registerUser($request);
}

/**
Expand All @@ -58,16 +57,6 @@ protected function validator(array $data): \Illuminate\Contracts\Validation\Vali
]);
}

/**
* Handle a registration request for the application.
*
* @return \Illuminate\Http\Response
*/
public function register(RegisterFormRequest $request)
{
return $this->registerUser($request);
}

/**
* Create a new user instance after a valid registration.
*/
Expand Down
10 changes: 0 additions & 10 deletions app/Http/Controllers/Auth/ResetPasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,4 @@ class ResetPasswordController extends Controller
use ResetsPasswords;

public $redirectTo = '/dashboard';

/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
}
4 changes: 2 additions & 2 deletions app/Http/Controllers/Auth/SocialLoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace App\Http\Controllers\Auth;

use Illuminate\Http\RedirectResponse;
use App\Http\Controllers\Controller;
use App\Models\User;
use Auth;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Socialite;

class SocialLoginController extends Controller
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/BiosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function index(): View
public function create(): View
{
return view('bios.create', [
'bio' => new Bio(),
'bio' => new Bio,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/ConferencesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ConferencesController extends Controller
public function create(): View
{
return view('conferences.create', [
'conference' => new Conference(),
'conference' => new Conference,
'currencies' => Currency::all(),
]);
}
Expand Down
Loading
Loading