Skip to content

Commit

Permalink
Merge pull request #15 from ucan-lab/chore-14-laravel-pint
Browse files Browse the repository at this point in the history
Add Laravel Pint Setting
  • Loading branch information
ucan-lab authored May 4, 2024
2 parents 188471c + bb555ce commit f9f5ceb
Show file tree
Hide file tree
Showing 26 changed files with 109 additions and 7 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/testing-pull-request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Testing Pull Request
on:
pull_request:
types: [synchronize, opened, reopened]
jobs:
pint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup PHP with composer v2
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
tools: composer:v2
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --no-scripts --no-ansi
- name: Pint Testing
run: ./vendor/bin/pint -v --test
1 change: 1 addition & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/.phpunit.cache
/.pint.cache
/node_modules
/public/build
/public/hot
Expand Down
2 changes: 2 additions & 0 deletions src/app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace App\Http\Controllers;

abstract class Controller
Expand Down
4 changes: 3 additions & 1 deletion src/app/Models/User.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
<?php

declare(strict_types=1);

namespace App\Models;

// use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;

class User extends Authenticatable
final class User extends Authenticatable
{
use HasFactory, Notifiable;

Expand Down
4 changes: 3 additions & 1 deletion src/app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace App\Providers;

use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
final class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/app.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Foundation\Application;
use Illuminate\Foundation\Configuration\Exceptions;
use Illuminate\Foundation\Configuration\Middleware;
Expand Down
2 changes: 2 additions & 0 deletions src/bootstrap/providers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [
App\Providers\AppServiceProvider::class,
];
2 changes: 2 additions & 0 deletions src/config/app.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 2 additions & 0 deletions src/config/auth.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 2 additions & 0 deletions src/config/cache.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Support\Str;

return [
Expand Down
2 changes: 2 additions & 0 deletions src/config/database.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Support\Str;

return [
Expand Down
2 changes: 2 additions & 0 deletions src/config/filesystems.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 2 additions & 0 deletions src/config/logging.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
Expand Down
2 changes: 2 additions & 0 deletions src/config/mail.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 2 additions & 0 deletions src/config/queue.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 2 additions & 0 deletions src/config/services.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

return [

/*
Expand Down
2 changes: 2 additions & 0 deletions src/config/session.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Support\Str;

return [
Expand Down
6 changes: 4 additions & 2 deletions src/database/factories/UserFactory.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;
Expand All @@ -9,7 +11,7 @@
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
*/
class UserFactory extends Factory
final class UserFactory extends Factory
{
/**
* The current password being used by the factory.
Expand All @@ -27,7 +29,7 @@ public function definition(): array
'name' => fake()->name(),
'email' => fake()->unique()->safeEmail(),
'email_verified_at' => now(),
'password' => static::$password ??= Hash::make('password'),
'password' => self::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
];
}
Expand Down
4 changes: 3 additions & 1 deletion src/database/seeders/DatabaseSeeder.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
<?php

declare(strict_types=1);

namespace Database\Seeders;

use App\Models\User;
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
final class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
Expand Down
32 changes: 32 additions & 0 deletions src/pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"preset": "laravel",
"cache-file": ".pint.cache",
"exclude": [
"database/migrations"
],
"rules": {
"concat_space": false,
"date_time_immutable": true,
"declare_parentheses": true,
"declare_strict_types": true,
"final_class": true,
"global_namespace_import": {
"import_classes": true,
"import_constants": true,
"import_functions": true
},
"mb_str_functions": true,
"new_with_braces": true,
"no_superfluous_phpdoc_tags": true,
"not_operator_with_successor_space": true,
"phpdoc_align": {
"align": "left"
},
"phpdoc_separation": false,
"php_unit_test_case_static_method_calls": {
"call_type": "this"
},
"simplified_if_return": true,
"simplified_null_return": true
}
}
2 changes: 2 additions & 0 deletions src/public/index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Http\Request;

define('LARAVEL_START', microtime(true));
Expand Down
2 changes: 2 additions & 0 deletions src/routes/console.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;

Expand Down
2 changes: 2 additions & 0 deletions src/routes/web.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

use Illuminate\Support\Facades\Route;

Route::get('/', function () {
Expand Down
4 changes: 3 additions & 1 deletion src/tests/Feature/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?php

declare(strict_types=1);

namespace Tests\Feature;

// use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class ExampleTest extends TestCase
final class ExampleTest extends TestCase
{
/**
* A basic test example.
Expand Down
2 changes: 2 additions & 0 deletions src/tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace Tests;

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
Expand Down
4 changes: 3 additions & 1 deletion src/tests/Unit/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?php

declare(strict_types=1);

namespace Tests\Unit;

use PHPUnit\Framework\TestCase;

class ExampleTest extends TestCase
final class ExampleTest extends TestCase
{
/**
* A basic test example.
Expand Down

0 comments on commit f9f5ceb

Please sign in to comment.