Skip to content

Commit

Permalink
add pint with formating fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MuchQuak committed Dec 10, 2024
1 parent 2fc087d commit ee54c46
Show file tree
Hide file tree
Showing 407 changed files with 4,407 additions and 4,921 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Fix Code Style

on: [push]

jobs:
lint:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.3]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: json, dom, curl, libxml, mbstring
coverage: none

- name: Install Pint
run: composer global require laravel/pint

- name: Run Pint
run: pint

- name: Commit linted files
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Fixes coding style"
6 changes: 2 additions & 4 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\CreatesNewUsers;

class CreateNewUser implements CreatesNewUsers
{
class CreateNewUser implements CreatesNewUsers {
use PasswordValidationRules;

/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
*/
public function create(array $input): User
{
public function create(array $input): User {
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],
'email' => [
Expand Down
6 changes: 2 additions & 4 deletions app/Actions/Fortify/PasswordValidationRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@

use Illuminate\Validation\Rules\Password;

trait PasswordValidationRules
{
trait PasswordValidationRules {
/**
* Get the validation rules used to validate passwords.
*
* @return array<int, \Illuminate\Contracts\Validation\Rule|array<mixed>|string>
*/
protected function passwordRules(): array
{
protected function passwordRules(): array {
return ['required', 'string', Password::default(), 'confirmed'];
}
}
6 changes: 2 additions & 4 deletions app/Actions/Fortify/ResetUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\ResetsUserPasswords;

class ResetUserPassword implements ResetsUserPasswords
{
class ResetUserPassword implements ResetsUserPasswords {
use PasswordValidationRules;

/**
* Validate and reset the user's forgotten password.
*
* @param array<string, string> $input
*/
public function reset(User $user, array $input): void
{
public function reset(User $user, array $input): void {
Validator::make($input, [
'password' => $this->passwordRules(),
])->validate();
Expand Down
6 changes: 2 additions & 4 deletions app/Actions/Fortify/UpdateUserPassword.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,15 @@
use Illuminate\Support\Facades\Validator;
use Laravel\Fortify\Contracts\UpdatesUserPasswords;

class UpdateUserPassword implements UpdatesUserPasswords
{
class UpdateUserPassword implements UpdatesUserPasswords {
use PasswordValidationRules;

/**
* Validate and update the user's password.
*
* @param array<string, string> $input
*/
public function update(User $user, array $input): void
{
public function update(User $user, array $input): void {
Validator::make($input, [
'current_password' => ['required', 'string', 'current_password:web'],
'password' => $this->passwordRules(),
Expand Down
9 changes: 3 additions & 6 deletions app/Actions/Fortify/UpdateUserProfileInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@
use Illuminate\Validation\Rule;
use Laravel\Fortify\Contracts\UpdatesUserProfileInformation;

class UpdateUserProfileInformation implements UpdatesUserProfileInformation
{
class UpdateUserProfileInformation implements UpdatesUserProfileInformation {
/**
* Validate and update the given user's profile information.
*
* @param array<string, string> $input
*/
public function update(User $user, array $input): void
{
public function update(User $user, array $input): void {
Validator::make($input, [
'name' => ['required', 'string', 'max:255'],

Expand Down Expand Up @@ -45,8 +43,7 @@ public function update(User $user, array $input): void
*
* @param array<string, string> $input
*/
protected function updateVerifiedUser(User $user, array $input): void
{
protected function updateVerifiedUser(User $user, array $input): void {
$user->forceFill([
'name' => $input['name'],
'email' => $input['email'],
Expand Down
6 changes: 2 additions & 4 deletions app/Console/Commands/Log/ClearLogFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

use Illuminate\Console\Command;

class ClearLogFile extends Command
{
class ClearLogFile extends Command {
/**
* The name and signature of the console command.
*
Expand All @@ -23,8 +22,7 @@ class ClearLogFile extends Command
/**
* Execute the console command.
*/
public function handle()
{
public function handle() {
//
exec('echo "" > ' . storage_path('logs/laravel.log'));
exec('echo "" > ' . storage_path('logs/query.log'));
Expand Down
11 changes: 4 additions & 7 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,19 @@
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
class Kernel extends ConsoleKernel {
/**
* Define the application's command schedule.
*/
protected function schedule(Schedule $schedule): void
{
protected function schedule(Schedule $schedule): void {
// $schedule->command('inspire')->hourly();
}

/**
* Register the commands for the application.
*/
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
protected function commands(): void {
$this->load(__DIR__ . '/Commands');

require base_path('routes/console.php');
}
Expand Down
6 changes: 2 additions & 4 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
class Handler extends ExceptionHandler {
/**
* The list of the inputs that are never flashed to the session on validation exceptions.
*
Expand All @@ -21,8 +20,7 @@ class Handler extends ExceptionHandler
/**
* Register the exception handling callbacks for the application.
*/
public function register(): void
{
public function register(): void {
$this->reportable(function (Throwable $e) {
//
});
Expand Down
34 changes: 20 additions & 14 deletions app/Faker/TaxonomyProvider.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace App\Faker;

use Illuminate\Support\Str;
Expand All @@ -12,11 +13,13 @@ class TaxonomyProvider extends \Faker\Provider\Base {
'{{genus}} {{species}} subsp. {{subspecies}}',
'{{genus}} {{species}} subsp. {{subspecies}} var. {{variety}}',
'{{genus}} {{species}} var. {{variety}} \'{{cultivar}}\'',
'{{genus}} {{species}} \'{{cultivar}}\''
'{{genus}} {{species}} \'{{cultivar}}\'',
];

protected $kingdom = 'Plantae';

protected $genus;

protected $species;

private function clear_taxonomy() {
Expand All @@ -27,38 +30,41 @@ private function clear_taxonomy() {

public function kingdom() {
$this->kingdom = $this->kingdom ?? static::randomElements(static::$kingdoms);

return $this->kingdom;
}

function genus() {
public function genus() {
$this->genus = $this->genus ?? static::randomElements(array_keys(static::$taxonomy[$this->kingdom()]))[0];

return $this->genus;
}

function species() {
$species_tree = static::$taxonomy[$this->kingdom()][$this->genus()];
public function species() {
$species_tree = static::$taxonomy[$this->kingdom()][$this->genus()];
$this->species = $this->species ?? static::randomElements(array_values($species_tree))[0];

return $this->species;
}

function subspecies() {
public function subspecies() {
return Str::random(10);
}

function variety() {
public function variety() {
return Str::random(10);
}

function cultivar() {
public function cultivar() {
return Str::random(10);
}

protected function getTaxaTree() {
if(!$this->kingdom) {
if (! $this->kingdom) {
return static::$taxonomy;
} else if(!$this->genus) {
} elseif (! $this->genus) {
return static::$taxonomy[$this->kingdom];
} else if(!$this->species) {
} elseif (! $this->species) {
return static::$taxonomy[$this->kingdom][$this->genus];
}
}
Expand All @@ -71,28 +77,28 @@ protected function getTaxaTree() {
'nebrodensis',
'borisii-regis',
'ephalonica',
'nordmanniana'
'nordmanniana',
],
'Abroma' => [
'augustum',
'molle',
],
'Azorina' => [
'vidalli'
'vidalli',
],
'Brachyscome' => [
'aculeata',
'ascendens',
'basaltica',
'chrysoglossa',
'ciliaris',
'decipiens'
'decipiens',
],
],
'Fungi' => [],
'Protista' => [],
'Eubacteria' => [],
'Archaebateria' => []
'Archaebateria' => [],
];

public function taxonomicName() {
Expand Down
Loading

0 comments on commit ee54c46

Please sign in to comment.