diff --git a/app/Application.php b/app/Application.php index f6860305..9509e283 100644 --- a/app/Application.php +++ b/app/Application.php @@ -66,17 +66,11 @@ class Application extends Model return $this->icon; } - /** - * @return string - */ public function iconView(): string { return asset('storage/'.$this->icon); } - /** - * @return string - */ public function defaultColour(): string { // check if light or dark @@ -87,9 +81,6 @@ class Application extends Model return '#161b1f'; } - /** - * @return string - */ public function class(): string { $name = $this->name; @@ -100,7 +91,6 @@ class Application extends Model /** * @param $name - * @return string */ public static function classFromName($name): string { @@ -111,9 +101,6 @@ class Application extends Model return $class; } - /** - * @return Collection - */ public static function apps(): Collection { $json = json_decode(file_get_contents(storage_path('app/supportedapps.json'))) ?? []; @@ -122,9 +109,6 @@ class Application extends Model return $apps->sortBy('name', SORT_NATURAL | SORT_FLAG_CASE); } - /** - * @return array - */ public static function autocomplete(): array { $apps = self::apps(); @@ -193,9 +177,6 @@ class Application extends Model return $app; } - /** - * @return array - */ public static function applist(): array { $list = []; diff --git a/app/Console/Commands/RegisterApp.php b/app/Console/Commands/RegisterApp.php index 37f13461..66d139ff 100644 --- a/app/Console/Commands/RegisterApp.php +++ b/app/Console/Commands/RegisterApp.php @@ -35,10 +35,8 @@ class RegisterApp extends Command /** * Execute the console command. - * - * @return void */ - public function handle() + public function handle(): void { $folder = $this->argument('folder'); if ($folder == 'all') { @@ -56,10 +54,8 @@ class RegisterApp extends Command /** * @param $folder - * @param bool $remove - * @return void */ - public function addApp($folder, bool $remove = false) + public function addApp($folder, bool $remove = false): void { $json = app_path('SupportedApps/'.$folder.'/app.json'); @@ -96,9 +92,8 @@ class RegisterApp extends Command /** * @param $appFolder * @param $icon - * @return void */ - private function saveIcon($appFolder, $icon) + private function saveIcon($appFolder, $icon): void { $iconPath = app_path('SupportedApps/' . $appFolder . '/' . $icon); $contents = file_get_contents($iconPath); diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 6b665f66..4798a7e9 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -9,11 +9,8 @@ class Kernel extends ConsoleKernel { /** * Define the application's command schedule. - * - * @param Schedule $schedule - * @return void */ - protected function schedule(Schedule $schedule) + protected function schedule(Schedule $schedule): void { // $schedule->command('inspire') // ->hourly(); @@ -21,10 +18,8 @@ class Kernel extends ConsoleKernel /** * Register the commands for the application. - * - * @return void */ - protected function commands() + protected function commands(): void { $this->load(__DIR__.'/Commands'); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 82a37e40..56af2640 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -8,25 +8,7 @@ use Throwable; class Handler extends ExceptionHandler { /** - * A list of exception types with their corresponding custom log levels. - * - * @var array, \Psr\Log\LogLevel::*> - */ - protected $levels = [ - // - ]; - - /** - * A list of the exception types that are not reported. - * - * @var array> - */ - protected $dontReport = [ - // - ]; - - /** - * A list of the inputs that are never flashed to the session on validation exceptions. + * The list of the inputs that are never flashed to the session on validation exceptions. * * @var array */ @@ -38,10 +20,8 @@ class Handler extends ExceptionHandler /** * Register the exception handling callbacks for the application. - * - * @return void */ - public function register() + public function register(): void { $this->reportable(function (Throwable $e) { // diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 02f4dcc4..7b5be765 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -49,9 +49,6 @@ class LoginController extends Controller $this->middleware('guest')->except(['logout','autologin']); } - /** - * @return string - */ public function username(): string { return 'username'; @@ -60,8 +57,6 @@ class LoginController extends Controller /** * Handle a login request to the application. * - * @param Request $request - * @return Response * * @throws ValidationException */ @@ -97,10 +92,6 @@ class LoginController extends Controller { } - /** - * @param User $user - * @return RedirectResponse - */ public function setUser(User $user): RedirectResponse { Auth::logout(); @@ -111,7 +102,6 @@ class LoginController extends Controller /** * @param $uuid - * @return RedirectResponse */ public function autologin($uuid): RedirectResponse { @@ -135,15 +125,13 @@ class LoginController extends Controller * * @return Application|Factory|View */ - public function showLoginForm() + public function showLoginForm(): \Illuminate\View\View { return view('auth.login'); } /** - * @param Request $request * @param $user - * @return RedirectResponse */ protected function authenticated(Request $request, $user): RedirectResponse { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 8d8d3053..09b546b0 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -41,9 +41,6 @@ class RegisterController extends Controller /** * Get a validator for an incoming registration request. - * - * @param array $data - * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data): \Illuminate\Contracts\Validation\Validator { @@ -56,11 +53,8 @@ class RegisterController extends Controller /** * Create a new user instance after a valid registration. - * - * @param array $data - * @return User */ - protected function create(array $data) + protected function create(array $data): User { return User::create([ 'name' => $data['name'], diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index e3b0faba..fd0dae23 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -4,13 +4,12 @@ namespace App\Http\Controllers; use App\User; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; -use Illuminate\Foundation\Bus\DispatchesJobs; use Illuminate\Foundation\Validation\ValidatesRequests; use Illuminate\Routing\Controller as BaseController; class Controller extends BaseController { - use AuthorizesRequests, DispatchesJobs, ValidatesRequests; + use AuthorizesRequests, ValidatesRequests; protected $user; diff --git a/app/Http/Controllers/HealthController.php b/app/Http/Controllers/HealthController.php index e6ddcc42..be2aaa3a 100644 --- a/app/Http/Controllers/HealthController.php +++ b/app/Http/Controllers/HealthController.php @@ -12,17 +12,11 @@ use Illuminate\Support\Facades\RateLimiter; class HealthController extends Controller { - /** - * @return int - */ private static function getUsers(): int { return User::count(); } - /** - * @return int - */ private static function getItems(): int { return Item::select('id') @@ -34,7 +28,6 @@ class HealthController extends Controller /** * Handle the incoming request. * - * @param Request $request * @return JsonResponse|Response * @throws BindingResolutionException */ diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 2d8ae6da..1e7fa357 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -19,8 +19,6 @@ class HomeController extends Controller /** * Show the application dashboard. - * - * @return RedirectResponse */ public function index(): RedirectResponse { diff --git a/app/Http/Controllers/ImportController.php b/app/Http/Controllers/ImportController.php index 78debb0a..43068372 100644 --- a/app/Http/Controllers/ImportController.php +++ b/app/Http/Controllers/ImportController.php @@ -20,9 +20,6 @@ class ImportController extends Controller /** * Handle the incoming request. - * - * @param Request $request - * @return View */ public function __invoke(Request $request): View { diff --git a/app/Http/Controllers/ItemController.php b/app/Http/Controllers/ItemController.php index 77f7baa4..fa4c1ae3 100644 --- a/app/Http/Controllers/ItemController.php +++ b/app/Http/Controllers/ItemController.php @@ -32,8 +32,6 @@ class ItemController extends Controller /** * Display a listing of the resource on the dashboard. - * - * @return View */ public function dash(): View { @@ -69,7 +67,6 @@ class ItemController extends Controller * Pin item on the dashboard. * * @param $id - * @return RedirectResponse */ public function pin($id): RedirectResponse { @@ -85,7 +82,6 @@ class ItemController extends Controller * Unpin item on the dashboard. * * @param $id - * @return RedirectResponse */ public function unpin($id): RedirectResponse { @@ -135,9 +131,6 @@ class ItemController extends Controller /** * Display a listing of the resource. - * - * @param Request $request - * @return View */ public function index(Request $request): View { @@ -154,8 +147,6 @@ class ItemController extends Controller /** * Show the form for creating a new resource. - * - * @return View */ public function create(): View { @@ -169,9 +160,6 @@ class ItemController extends Controller /** * Show the form for editing the specified resource. - * - * @param int $id - * @return View */ public function edit(int $id): View { @@ -194,9 +182,7 @@ class ItemController extends Controller } /** - * @param Request $request * @param null $id - * @return Item * @throws ValidationException */ public static function storelogic(Request $request, $id = null): Item @@ -287,9 +273,6 @@ class ItemController extends Controller /** * Store a newly created resource in storage. - * - * @param Request $request - * @return RedirectResponse */ public function store(Request $request): RedirectResponse { @@ -303,9 +286,6 @@ class ItemController extends Controller /** * Display the specified resource. - * - * @param int $id - * @return void */ public function show(int $id): void { @@ -314,10 +294,6 @@ class ItemController extends Controller /** * Update the specified resource in storage. - * - * @param Request $request - * @param int $id - * @return RedirectResponse */ public function update(Request $request, int $id): RedirectResponse { @@ -330,10 +306,6 @@ class ItemController extends Controller /** * Remove the specified resource from storage. - * - * @param Request $request - * @param int $id - * @return RedirectResponse */ public function destroy(Request $request, int $id): RedirectResponse { @@ -355,9 +327,6 @@ class ItemController extends Controller /** * Restore the specified resource from soft deletion. - * - * @param int $id - * @return RedirectResponse */ public function restore(int $id): RedirectResponse { @@ -375,8 +344,6 @@ class ItemController extends Controller /** * Return details for supported apps * - * @param Request $request - * @return string|null * @throws GuzzleException */ public function appload(Request $request): ?string @@ -419,7 +386,6 @@ class ItemController extends Controller } /** - * @param Request $request * @return void */ public function testConfig(Request $request) @@ -448,9 +414,7 @@ class ItemController extends Controller /** * @param $url - * @param array $attrs * @param array|bool $overridevars - * @return ResponseInterface|null * @throws GuzzleException */ public function execute($url, array $attrs = [], $overridevars = false): ?ResponseInterface @@ -481,7 +445,6 @@ class ItemController extends Controller /** * @param $url - * @return StreamInterface * @throws GuzzleException */ public function websitelookup($url): StreamInterface @@ -511,7 +474,7 @@ class ItemController extends Controller /** * @return \Illuminate\Contracts\Foundation\Application|RedirectResponse|Redirector */ - public function checkAppList() + public function checkAppList(): RedirectResponse { ProcessApps::dispatch(); $route = route('items.index'); diff --git a/app/Http/Controllers/ItemRestController.php b/app/Http/Controllers/ItemRestController.php index d147d8a8..f962e154 100644 --- a/app/Http/Controllers/ItemRestController.php +++ b/app/Http/Controllers/ItemRestController.php @@ -17,10 +17,8 @@ class ItemRestController extends Controller /** * Display a listing of the resource. - * - * @return Collection */ - public function index() + public function index(): Collection { $columns = [ 'title', @@ -49,9 +47,6 @@ class ItemRestController extends Controller /** * Store a newly created resource in storage. - * - * @param Request $request - * @return object */ public function store(Request $request): object { @@ -66,45 +61,32 @@ class ItemRestController extends Controller /** * Display the specified resource. - * - * @param Item $item - * @return Response */ - public function show(Item $item) + public function show(Item $item): Response { // } /** * Show the form for editing the specified resource. - * - * @param Item $item - * @return Response */ - public function edit(Item $item) + public function edit(Item $item): Response { // } /** * Update the specified resource in storage. - * - * @param Request $request - * @param Item $item - * @return Response */ - public function update(Request $request, Item $item) + public function update(Request $request, Item $item): Response { // } /** * Remove the specified resource from storage. - * - * @param Item $item - * @return Response */ - public function destroy(Item $item) + public function destroy(Item $item): Response { // } diff --git a/app/Http/Controllers/SearchController.php b/app/Http/Controllers/SearchController.php index 2ffc5923..3b58551a 100644 --- a/app/Http/Controllers/SearchController.php +++ b/app/Http/Controllers/SearchController.php @@ -11,7 +11,6 @@ use Illuminate\Routing\Redirector; class SearchController extends Controller { /** - * @param Request $request * @return Application|RedirectResponse|Redirector|mixed|void */ public function index(Request $request) diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 89af0dcf..8f48055e 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -17,9 +17,6 @@ class SettingsController extends Controller $this->middleware('allowed'); } - /** - * @return View - */ public function index(): View { $settings = SettingGroup::with([ @@ -32,7 +29,6 @@ class SettingsController extends Controller } /** - * @param int $id * * @return RedirectResponse|View */ @@ -59,12 +55,6 @@ class SettingsController extends Controller } } - /** - * @param Request $request - * @param int $id - * - * @return RedirectResponse - */ public function update(Request $request, int $id): RedirectResponse { $setting = Setting::find($id); @@ -114,11 +104,6 @@ class SettingsController extends Controller } } - /** - * @param int $id - * - * @return RedirectResponse - */ public function clear(int $id): RedirectResponse { $user = $this->user(); diff --git a/app/Http/Controllers/TagController.php b/app/Http/Controllers/TagController.php index 1b65a824..6999689b 100644 --- a/app/Http/Controllers/TagController.php +++ b/app/Http/Controllers/TagController.php @@ -22,7 +22,7 @@ class TagController extends Controller * * @return Application|Factory|View */ - public function index(Request $request) + public function index(Request $request): \Illuminate\View\View { $trash = (bool) $request->input('trash'); @@ -40,7 +40,7 @@ class TagController extends Controller * * @return Application|Factory|View */ - public function create() + public function create(): \Illuminate\View\View { $data = []; @@ -49,9 +49,6 @@ class TagController extends Controller /** * Store a newly created resource in storage. - * - * @param Request $request - * @return RedirectResponse */ public function store(Request $request): RedirectResponse { @@ -90,7 +87,6 @@ class TagController extends Controller * Display the specified resource. * * @param $slug - * @return View */ public function show($slug): View { @@ -105,9 +101,6 @@ class TagController extends Controller /** * Show the form for editing the specified resource. - * - * @param int $id - * @return View */ public function edit(int $id): View { @@ -121,10 +114,6 @@ class TagController extends Controller /** * Update the specified resource in storage. - * - * @param Request $request - * @param int $id - * @return RedirectResponse */ public function update(Request $request, int $id): RedirectResponse { @@ -156,10 +145,6 @@ class TagController extends Controller /** * Remove the specified resource from storage. - * - * @param Request $request - * @param int $id - * @return RedirectResponse */ public function destroy(Request $request, int $id): RedirectResponse { @@ -181,9 +166,6 @@ class TagController extends Controller /** * Restore the specified resource from soft deletion. - * - * @param int $id - * @return RedirectResponse */ public function restore(int $id): RedirectResponse { diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 256cd0d8..2892366e 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -19,8 +19,6 @@ class UserController extends Controller /** * Display a listing of the resource. - * - * @return View */ public function index(): View { @@ -31,8 +29,6 @@ class UserController extends Controller /** * Show the form for creating a new resource. - * - * @return View */ public function create(): View { @@ -41,7 +37,7 @@ class UserController extends Controller return view('users.create', $data); } - public function selectUser() + public function selectUser(): \Illuminate\View\View { Auth::logout(); $data['users'] = User::all(); @@ -51,9 +47,6 @@ class UserController extends Controller /** * Store a newly created resource in storage. - * - * @param Request $request - * @return RedirectResponse */ public function store(Request $request): RedirectResponse { @@ -93,9 +86,6 @@ class UserController extends Controller /** * Display the specified resource. - * - * @param int $id - * @return void */ public function show(int $id): void { @@ -104,9 +94,6 @@ class UserController extends Controller /** * Show the form for editing the specified resource. - * - * @param User $user - * @return View */ public function edit(User $user): View { @@ -117,10 +104,6 @@ class UserController extends Controller /** * Update the specified resource in storage. - * - * @param Request $request - * @param User $user - * @return RedirectResponse */ public function update(Request $request, User $user): RedirectResponse { @@ -166,7 +149,6 @@ class UserController extends Controller /** * Remove the specified resource from storage. * - * @param User $user * @return RedirectResponse | void */ public function destroy(User $user): RedirectResponse diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 185cf5da..ddbd6d25 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -37,19 +37,19 @@ class Kernel extends HttpKernel ], 'api' => [ - 'throttle:60,1', + \Illuminate\Routing\Middleware\ThrottleRequests::class.':60,1', 'bindings', ], ]; /** - * The application's route middleware. + * The application's middleware aliases. * - * These middleware may be assigned to groups or used individually. + * Aliases may be used to conveniently assign middleware to routes and groups. * * @var array */ - protected $routeMiddleware = [ + protected $middlewareAliases = [ 'allowed' => \App\Http\Middleware\CheckAllowed::class, 'auth' => \Illuminate\Auth\Middleware\Authenticate::class, 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, diff --git a/app/Http/Middleware/CheckAllowed.php b/app/Http/Middleware/CheckAllowed.php index eaae0d57..d243820e 100644 --- a/app/Http/Middleware/CheckAllowed.php +++ b/app/Http/Middleware/CheckAllowed.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; use App\User; use Closure; use Illuminate\Auth\AuthenticationException; @@ -15,12 +16,9 @@ class CheckAllowed /** * Handle an incoming request. * - * @param Request $request - * @param Closure $next - * @return mixed * @throws AuthenticationException */ - public function handle(Request $request, Closure $next) + public function handle(Request $request, Closure $next): Response { $route = Route::currentRouteName(); $current_user = User::currentUser(); diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index 153bec91..a7e2579d 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -2,6 +2,7 @@ namespace App\Http\Middleware; +use Symfony\Component\HttpFoundation\Response; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; @@ -10,13 +11,8 @@ class RedirectIfAuthenticated { /** * Handle an incoming request. - * - * @param Request $request - * @param Closure $next - * @param string|null $guard - * @return mixed */ - public function handle(Request $request, Closure $next, string $guard = null) + public function handle(Request $request, Closure $next, string $guard = null): Response { if (Auth::guard($guard)->check()) { return redirect()->intended(); diff --git a/app/Item.php b/app/Item.php index 76a8be7c..b7bdd326 100644 --- a/app/Item.php +++ b/app/Item.php @@ -76,10 +76,7 @@ class Item extends Model use HasFactory; - /** - * @return void - */ - protected static function boot() + protected static function boot(): void { parent::boot(); @@ -113,9 +110,6 @@ class Item extends Model /** * Scope a query to only include pinned items. - * - * @param Builder $query - * @return Builder */ public function scopePinned(Builder $query): Builder { @@ -153,9 +147,6 @@ class Item extends Model return $tagdetails; } - /** - * @return string - */ public function getTagClass(): string { $tags = $this->tags(); @@ -170,17 +161,11 @@ class Item extends Model return implode(' ', $slugs); } - /** - * @return BelongsToMany - */ public function parents(): BelongsToMany { return $this->belongsToMany(Item::class, 'item_tag', 'item_id', 'tag_id'); } - /** - * @return BelongsToMany - */ public function children(): BelongsToMany { return $this->belongsToMany(Item::class, 'item_tag', 'tag_id', 'item_id'); @@ -198,9 +183,6 @@ class Item extends Model } } - /** - * @return string - */ public function getDroppableAttribute(): string { if ((int) $this->type === 1) { @@ -210,9 +192,6 @@ class Item extends Model } } - /** - * @return string - */ public function getLinkTargetAttribute(): string { $target = Setting::fetch('window_target'); @@ -224,9 +203,6 @@ class Item extends Model } } - /** - * @return string - */ public function getLinkIconAttribute(): string { if ((int) $this->type === 1) { @@ -236,9 +212,6 @@ class Item extends Model } } - /** - * @return string - */ public function getLinkTypeAttribute(): string { if ((int) $this->type === 1) { @@ -279,9 +252,6 @@ class Item extends Model return $query->where('type', $typeid); } - /** - * @return bool - */ public function enhanced(): bool { /*if(isset($this->class) && !empty($this->class)) { @@ -295,7 +265,6 @@ class Item extends Model /** * @param $class - * @return bool */ public static function isEnhanced($class): bool { @@ -321,9 +290,6 @@ class Item extends Model return ((bool) ($app instanceof SearchInterface)) ? $app : false; } - /** - * @return bool - */ public function enabled(): bool { if ($this->enhanced()) { @@ -369,7 +335,6 @@ class Item extends Model /** * @param $class - * @return Application|null */ public static function applicationDetails($class): ?Application { @@ -386,7 +351,6 @@ class Item extends Model /** * @param $class - * @return string */ public static function getApplicationDescription($class): string { @@ -400,8 +364,6 @@ class Item extends Model /** * Get the user that owns the item. - * - * @return BelongsTo */ public function user(): BelongsTo { diff --git a/app/Jobs/ProcessApps.php b/app/Jobs/ProcessApps.php index 73db5dc8..68276127 100644 --- a/app/Jobs/ProcessApps.php +++ b/app/Jobs/ProcessApps.php @@ -32,10 +32,9 @@ class ProcessApps implements ShouldQueue, ShouldBeUnique /** * Execute the job. * - * @return void * @throws GuzzleException */ - public function handle() + public function handle(): void { Log::debug('Process Apps dispatched'); $localapps = Application::whereNull('class')->get(); diff --git a/app/Jobs/UpdateApps.php b/app/Jobs/UpdateApps.php index dccc2188..636792b4 100644 --- a/app/Jobs/UpdateApps.php +++ b/app/Jobs/UpdateApps.php @@ -30,10 +30,9 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique /** * Execute the job. * - * @return void * @throws GuzzleException */ - public function handle() + public function handle(): void { Log::debug('Update of all apps triggered!'); $apps = Application::all('appid')->toArray(); @@ -50,10 +49,7 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique Cache::lock('updateApps')->forceRelease(); } - /** - * @return void - */ - public function failed($exception) + public function failed($exception): void { Cache::lock('updateApps')->forceRelease(); } diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 75c4e207..5f9748aa 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -19,10 +19,8 @@ class AppServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { if (! class_exists('ZipArchive')) { die('You are missing php-zip'); @@ -105,10 +103,8 @@ class AppServiceProvider extends ServiceProvider /** * Generate app key if missing and .env exists - * - * @return void */ - public function genKey() + public function genKey(): void { if (is_file(base_path('.env'))) { if (empty(env('APP_KEY'))) { @@ -119,10 +115,8 @@ class AppServiceProvider extends ServiceProvider /** * Register any application services. - * - * @return void */ - public function register() + public function register(): void { if ($this->app->isLocal()) { $this->app->register(IdeHelperServiceProvider::class); @@ -136,7 +130,6 @@ class AppServiceProvider extends ServiceProvider /** * Check if database needs an update or do first time database setup * - * @return void * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ @@ -158,9 +151,6 @@ class AppServiceProvider extends ServiceProvider } } - /** - * @return void - */ public function createEnvFile(): void { if (!is_file(base_path('.env'))) { @@ -170,9 +160,6 @@ class AppServiceProvider extends ServiceProvider $this->genKey(); } - /** - * @return bool - */ private function needsDBUpdate(): bool { if (!Schema::hasTable('settings')) { @@ -185,10 +172,7 @@ class AppServiceProvider extends ServiceProvider return version_compare($app_version, $db_version) === 1; } - /** - * @return void - */ - private function updateApps() + private function updateApps(): void { // This lock ensures that the job is not invoked multiple times. // In 5 minutes all app updates should be finished. diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 9e68caa6..e22ccf18 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -17,13 +17,9 @@ class AuthServiceProvider extends ServiceProvider /** * Register any authentication / authorization services. - * - * @return void */ - public function boot() + public function boot(): void { - $this->registerPolicies(); - // } } diff --git a/app/Providers/BroadcastServiceProvider.php b/app/Providers/BroadcastServiceProvider.php index 395c518b..2be04f5d 100644 --- a/app/Providers/BroadcastServiceProvider.php +++ b/app/Providers/BroadcastServiceProvider.php @@ -9,10 +9,8 @@ class BroadcastServiceProvider extends ServiceProvider { /** * Bootstrap any application services. - * - * @return void */ - public function boot() + public function boot(): void { Broadcast::routes(); diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php index 6df9c2b0..57bb737a 100644 --- a/app/Providers/EventServiceProvider.php +++ b/app/Providers/EventServiceProvider.php @@ -19,10 +19,8 @@ class EventServiceProvider extends ServiceProvider /** * Register any events for your application. - * - * @return void */ - public function boot() + public function boot(): void { parent::boot(); @@ -31,10 +29,8 @@ class EventServiceProvider extends ServiceProvider /** * Determine if events and listeners should be automatically discovered. - * - * @return bool */ - public function shouldDiscoverEvents() + public function shouldDiscoverEvents(): bool { return false; } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index f037a80b..e8bd7d8e 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -17,10 +17,8 @@ class RouteServiceProvider extends ServiceProvider /** * Define your route model bindings, pattern filters, etc. - * - * @return void */ - public function boot() + public function boot(): void { // @@ -29,10 +27,8 @@ class RouteServiceProvider extends ServiceProvider /** * Define the routes for the application. - * - * @return void */ - public function map() + public function map(): void { $this->mapApiRoutes(); @@ -45,10 +41,8 @@ class RouteServiceProvider extends ServiceProvider * Define the "web" routes for the application. * * These routes all receive session state, CSRF protection, etc. - * - * @return void */ - protected function mapWebRoutes() + protected function mapWebRoutes(): void { Route::middleware('web') ->group(base_path('routes/web.php')); @@ -58,10 +52,8 @@ class RouteServiceProvider extends ServiceProvider * Define the "api" routes for the application. * * These routes are typically stateless. - * - * @return void */ - protected function mapApiRoutes() + protected function mapApiRoutes(): void { Route::prefix('api') ->middleware('api') diff --git a/app/Setting.php b/app/Setting.php index be1adbb4..360f3c6c 100644 --- a/app/Setting.php +++ b/app/Setting.php @@ -70,10 +70,6 @@ class Setting extends Model */ protected static $cache = []; - /** - * @param Request $request - * @return object - */ public static function getInput(Request $request): object { return (object) [ @@ -198,16 +194,12 @@ class Setting extends Model return $value; } - /** - * @return BelongsTo - */ public function group(): BelongsTo { return $this->belongsTo(\App\SettingGroup::class, 'group_id'); } /** - * @param string $key * * @return mixed */ @@ -220,11 +212,10 @@ class Setting extends Model // @codingStandardsIgnoreStart /** - * @param string $key * * @return mixed */ - public static function _fetch($key, $user = null) + public static function _fetch(string $key, $user = null) { // @codingStandardsIgnoreEnd //$cachekey = ($user === null) ? $key : $key.'-'.$user->id; @@ -267,20 +258,14 @@ class Setting extends Model } /** - * @param string $key * @param $value */ - public static function add($key, $value) + public static function add(string $key, $value) { self::$cache[$key] = $value; } - /** - * @param string $key - * - * @return bool - */ - public static function cached($key): bool + public static function cached(string $key): bool { return array_key_exists($key, self::$cache); } diff --git a/app/SettingGroup.php b/app/SettingGroup.php index b6d59c87..1544bfc7 100644 --- a/app/SettingGroup.php +++ b/app/SettingGroup.php @@ -37,9 +37,6 @@ class SettingGroup extends Model */ public $timestamps = false; - /** - * @return HasMany - */ public function settings(): HasMany { return $this->hasMany(\App\Setting::class, 'group_id'); diff --git a/app/SupportedApps.php b/app/SupportedApps.php index c2798230..9ef56421 100644 --- a/app/SupportedApps.php +++ b/app/SupportedApps.php @@ -134,7 +134,7 @@ abstract class SupportedApps */ public function getLiveStats($status, $data) { - $className = get_class($this); + $className = $this::class; $explode = explode('\\', $className); $name = end($explode); diff --git a/composer.json b/composer.json index efa4f460..93c8e1a7 100644 --- a/composer.json +++ b/composer.json @@ -8,22 +8,22 @@ "license": "MIT", "type": "project", "require": { - "php": "^8.0", - "graham-campbell/github": "^10.5", + "php": "^8.1", + "graham-campbell/github": "^12.0", "guzzlehttp/guzzle": "^7.4", - "laravel/framework": "^9.52", - "laravel/tinker": "^2.7", - "laravel/ui": "^3.3", - "laravelcollective/html": "^6.3", + "laravel/framework": "^10.44", + "laravel/tinker": "^2.8", + "laravel/ui": "^4.2", + "laravelcollective/html": "^6.4", "nunomaduro/collision": "^6.3", - "symfony/yaml": "^6.0", + "symfony/yaml": "^6.2", "ext-json": "*", "ext-intl": "*", "league/flysystem-aws-s3-v3": "^3.0", - "spatie/laravel-ignition": "^1.4" + "spatie/laravel-ignition": "^2.0" }, "require-dev": { - "barryvdh/laravel-ide-helper": "^2.12", + "barryvdh/laravel-ide-helper": "^2.13", "filp/whoops": "^2.8", "mockery/mockery": "^1.4.4", "phpunit/phpunit": "^9.5.10", @@ -83,5 +83,7 @@ "kylekatarnls/update-helper": true, "symfony/thanks": true } - } + }, + "minimum-stability": "stable", + "prefer-stable": true } diff --git a/config/app.php b/config/app.php index ad34c3e6..cbfbb6d4 100644 --- a/config/app.php +++ b/config/app.php @@ -1,5 +1,6 @@ [ - - /* - * Laravel Framework Service Providers... - */ - Illuminate\Auth\AuthServiceProvider::class, - Illuminate\Broadcasting\BroadcastServiceProvider::class, - Illuminate\Bus\BusServiceProvider::class, - Illuminate\Cache\CacheServiceProvider::class, - Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class, - Illuminate\Cookie\CookieServiceProvider::class, - Illuminate\Database\DatabaseServiceProvider::class, - Illuminate\Encryption\EncryptionServiceProvider::class, - Illuminate\Filesystem\FilesystemServiceProvider::class, - Illuminate\Foundation\Providers\FoundationServiceProvider::class, - Illuminate\Hashing\HashServiceProvider::class, - Illuminate\Mail\MailServiceProvider::class, - Illuminate\Notifications\NotificationServiceProvider::class, - Illuminate\Pagination\PaginationServiceProvider::class, - Illuminate\Pipeline\PipelineServiceProvider::class, - Illuminate\Queue\QueueServiceProvider::class, - Illuminate\Redis\RedisServiceProvider::class, - Illuminate\Auth\Passwords\PasswordResetServiceProvider::class, - Illuminate\Session\SessionServiceProvider::class, - Illuminate\Translation\TranslationServiceProvider::class, - Illuminate\Validation\ValidationServiceProvider::class, - Illuminate\View\ViewServiceProvider::class, - + 'providers' => ServiceProvider::defaultProviders()->merge([ /* * Package Service Providers... */ @@ -196,8 +170,7 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - - ], + ])->toArray(), /* |-------------------------------------------------------------------------- diff --git a/config/auth.php b/config/auth.php index 2231b267..0628b650 100644 --- a/config/auth.php +++ b/config/auth.php @@ -86,16 +86,20 @@ return [ | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | - | The expire time is the number of minutes that each reset token will be + | The expiry time is the number of minutes that each reset token will be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | + | The throttle setting is the number of seconds a user must wait before + | generating more password reset tokens. This prevents the user from + | quickly generating a very large amount of password reset tokens. + | */ 'passwords' => [ 'users' => [ 'provider' => 'users', - 'table' => 'password_resets', + 'table' => 'password_reset_tokens', 'expire' => 60, 'throttle' => 60, ], diff --git a/config/broadcasting.php b/config/broadcasting.php index 9e4d4aa4..24104853 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -36,6 +36,7 @@ return [ 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => [ + 'cluster' => env('PUSHER_APP_CLUSTER'), 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 'port' => env('PUSHER_PORT', 443), 'scheme' => env('PUSHER_SCHEME', 'https'), diff --git a/config/cache.php b/config/cache.php index 7ffb6d91..1fdc67a9 100644 --- a/config/cache.php +++ b/config/cache.php @@ -52,6 +52,7 @@ return [ 'file' => [ 'driver' => 'file', 'path' => storage_path('framework/cache/data'), + 'lock_path' => storage_path('framework/cache/data'), ], 'memcached' => [ diff --git a/config/database.php b/config/database.php index a03c4439..137ad18c 100644 --- a/config/database.php +++ b/config/database.php @@ -15,7 +15,7 @@ return [ | */ - 'default' => env('DB_CONNECTION', 'sqlite'), + 'default' => env('DB_CONNECTION', 'mysql'), /* |-------------------------------------------------------------------------- @@ -37,9 +37,10 @@ return [ 'sqlite' => [ 'driver' => 'sqlite', - //'database' => env('DB_DATABASE', database_path('database.sqlite')), - 'database' => database_path(env('DB_DATABASE', 'app.sqlite')), + 'url' => env('DATABASE_URL'), + 'database' => env('DB_DATABASE', database_path('database.sqlite')), 'prefix' => '', + 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), ], 'mysql' => [ @@ -88,8 +89,10 @@ return [ 'charset' => 'utf8', 'prefix' => '', 'prefix_indexes' => true, + // 'encrypt' => env('DB_ENCRYPT', 'yes'), + // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), ], - + ], /* @@ -111,7 +114,7 @@ return [ |-------------------------------------------------------------------------- | | Redis is an open source, fast, and advanced key-value store that also - | provides a richer set of commands than a typical key-value systems + | provides a richer body of commands than a typical key-value system | such as APC or Memcached. Laravel makes it easy to dig right in. | */ @@ -128,7 +131,8 @@ return [ 'default' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_DB', '0'), ], @@ -136,7 +140,8 @@ return [ 'cache' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), - 'password' => env('REDIS_PASSWORD', null), + 'username' => env('REDIS_USERNAME'), + 'password' => env('REDIS_PASSWORD'), 'port' => env('REDIS_PORT', '6379'), 'database' => env('REDIS_CACHE_DB', '1'), ], diff --git a/config/hashing.php b/config/hashing.php index bcd3be4c..0e8a0bb3 100644 --- a/config/hashing.php +++ b/config/hashing.php @@ -29,7 +29,8 @@ return [ */ 'bcrypt' => [ - 'rounds' => env('BCRYPT_ROUNDS', 10), + 'rounds' => env('BCRYPT_ROUNDS', 12), + 'verify' => true, ], /* @@ -47,6 +48,7 @@ return [ 'memory' => 65536, 'threads' => 1, 'time' => 4, + 'verify' => true, ], ]; diff --git a/config/logging.php b/config/logging.php index 5aa1dbb7..c44d2763 100644 --- a/config/logging.php +++ b/config/logging.php @@ -3,6 +3,7 @@ use Monolog\Handler\NullHandler; use Monolog\Handler\StreamHandler; use Monolog\Handler\SyslogUdpHandler; +use Monolog\Processor\PsrLogMessageProcessor; return [ @@ -61,6 +62,7 @@ return [ 'driver' => 'single', 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'daily' => [ @@ -68,6 +70,7 @@ return [ 'path' => storage_path('logs/laravel.log'), 'level' => env('LOG_LEVEL', 'debug'), 'days' => 14, + 'replace_placeholders' => true, ], 'slack' => [ @@ -76,6 +79,7 @@ return [ 'username' => 'Laravel Log', 'emoji' => ':boom:', 'level' => env('LOG_LEVEL', 'critical'), + 'replace_placeholders' => true, ], 'papertrail' => [ @@ -87,6 +91,7 @@ return [ 'port' => env('PAPERTRAIL_PORT'), 'connectionString' => 'tls://'.env('PAPERTRAIL_URL').':'.env('PAPERTRAIL_PORT'), ], + 'processors' => [PsrLogMessageProcessor::class], ], 'stderr' => [ @@ -97,16 +102,20 @@ return [ 'with' => [ 'stream' => 'php://stderr', ], + 'processors' => [PsrLogMessageProcessor::class], ], 'syslog' => [ 'driver' => 'syslog', 'level' => env('LOG_LEVEL', 'debug'), + 'facility' => LOG_USER, + 'replace_placeholders' => true, ], 'errorlog' => [ 'driver' => 'errorlog', 'level' => env('LOG_LEVEL', 'debug'), + 'replace_placeholders' => true, ], 'null' => [ diff --git a/config/mail.php b/config/mail.php index 534395a3..e894b2e5 100644 --- a/config/mail.php +++ b/config/mail.php @@ -28,14 +28,15 @@ return [ | sending an e-mail. You will specify which one you are using for your | mailers below. You are free to add additional mailers as required. | - | Supported: "smtp", "sendmail", "mailgun", "ses", - | "postmark", "log", "array", "failover" + | Supported: "smtp", "sendmail", "mailgun", "ses", "ses-v2", + | "postmark", "log", "array", "failover", "roundrobin" | */ 'mailers' => [ 'smtp' => [ 'transport' => 'smtp', + 'url' => env('MAIL_URL'), 'host' => env('MAIL_HOST', 'smtp.mailgun.org'), 'port' => env('MAIL_PORT', 587), 'encryption' => env('MAIL_ENCRYPTION', 'tls'), @@ -49,12 +50,19 @@ return [ 'transport' => 'ses', ], - 'mailgun' => [ - 'transport' => 'mailgun', - ], - 'postmark' => [ 'transport' => 'postmark', + // 'message_stream_id' => null, + // 'client' => [ + // 'timeout' => 5, + // ], + ], + + 'mailgun' => [ + 'transport' => 'mailgun', + // 'client' => [ + // 'timeout' => 5, + // ], ], 'sendmail' => [ @@ -78,6 +86,14 @@ return [ 'log', ], ], + + 'roundrobin' => [ + 'transport' => 'roundrobin', + 'mailers' => [ + 'ses', + 'postmark', + ], + ], ], /* diff --git a/config/session.php b/config/session.php index d82da8f7..a33cd791 100644 --- a/config/session.php +++ b/config/session.php @@ -198,4 +198,17 @@ return [ 'same_site' => null, + /* + |-------------------------------------------------------------------------- + | Partitioned Cookies + |-------------------------------------------------------------------------- + | + | Setting this value to true will tie the cookie to the top-level site for + | a cross-site context. Partitioned cookies are accepted by the browser + | when flagged "secure" and the Same-Site attribute is set to "none". + | + */ + + 'partitioned' => false, + ]; diff --git a/database/factories/ItemFactory.php b/database/factories/ItemFactory.php index edbd66d8..3ab4097e 100644 --- a/database/factories/ItemFactory.php +++ b/database/factories/ItemFactory.php @@ -9,8 +9,6 @@ class ItemFactory extends Factory { /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/factories/ItemTagFactory.php b/database/factories/ItemTagFactory.php index cb928a0b..2e2901d2 100644 --- a/database/factories/ItemTagFactory.php +++ b/database/factories/ItemTagFactory.php @@ -10,8 +10,6 @@ class ItemTagFactory extends Factory { /** * Define the model's default state. - * - * @return array */ public function definition(): array { diff --git a/database/factories/UserFactory.php b/database/factories/UserFactory.php index cb6dc01e..e965b777 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/UserFactory.php @@ -2,6 +2,7 @@ namespace Database\Factories; +use Illuminate\Support\Facades\Hash; use App\User; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Str; @@ -13,12 +14,14 @@ class UserFactory extends Factory * * @return array */ - public function definition() + protected static ?string $password; + + public function definition(): array { return [ 'username' => $this->faker->name(), 'email' => $this->faker->unique()->safeEmail(), - 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'password' => static::$password ??= Hash::make('password'), 'public_front' => 1, 'remember_token' => Str::random(10), ]; @@ -26,10 +29,8 @@ class UserFactory extends Factory /** * Indicate that the model's email address should be unverified. - * - * @return \Illuminate\Database\Eloquent\Factories\Factory */ - public function unverified() + public function unverified(): Factory { return $this->state(function (array $attributes) { return [ diff --git a/database/migrations/2018_01_27_155922_create_items_table.php b/database/migrations/2018_01_27_155922_create_items_table.php index ed4eecfe..ed9577b1 100644 --- a/database/migrations/2018_01_27_155922_create_items_table.php +++ b/database/migrations/2018_01_27_155922_create_items_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('items', function (Blueprint $table) { $table->increments('id'); @@ -29,10 +27,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('items'); } diff --git a/database/migrations/2018_02_04_185524_create_settings_table.php b/database/migrations/2018_02_04_185524_create_settings_table.php index 4c3049f6..f9273079 100644 --- a/database/migrations/2018_02_04_185524_create_settings_table.php +++ b/database/migrations/2018_02_04_185524_create_settings_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('settings', function (Blueprint $table) { $table->increments('id'); @@ -28,10 +26,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('settings'); } diff --git a/database/migrations/2018_02_04_185802_create_setting_groups_table.php b/database/migrations/2018_02_04_185802_create_setting_groups_table.php index 5eada09a..6600bb1b 100644 --- a/database/migrations/2018_02_04_185802_create_setting_groups_table.php +++ b/database/migrations/2018_02_04_185802_create_setting_groups_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('setting_groups', function (Blueprint $table) { $table->increments('id'); @@ -22,10 +20,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('setting_groups'); } diff --git a/database/migrations/2018_02_16_175830_add_columns_to_items_for_groups.php b/database/migrations/2018_02_16_175830_add_columns_to_items_for_groups.php index 7edbf44d..1cc0b018 100644 --- a/database/migrations/2018_02_16_175830_add_columns_to_items_for_groups.php +++ b/database/migrations/2018_02_16_175830_add_columns_to_items_for_groups.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('items', function (Blueprint $table) { $table->integer('type')->default(0)->index(); // 0 = item, 1 = category @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('items', function (Blueprint $table) { $table->dropColumn(['type']); diff --git a/database/migrations/2018_02_16_193703_item_tag.php b/database/migrations/2018_02_16_193703_item_tag.php index 48e0cb11..0d088891 100644 --- a/database/migrations/2018_02_16_193703_item_tag.php +++ b/database/migrations/2018_02_16_193703_item_tag.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('item_tag', function (Blueprint $table) { $table->integer('item_id')->unsigned()->index(); @@ -25,10 +23,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('item_tag'); } diff --git a/database/migrations/2018_10_12_122907_create_users_table.php b/database/migrations/2018_10_12_122907_create_users_table.php index c9ac830d..30947620 100644 --- a/database/migrations/2018_10_12_122907_create_users_table.php +++ b/database/migrations/2018_10_12_122907_create_users_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('users', function (Blueprint $table) { $table->increments('id'); @@ -28,10 +26,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('users'); } diff --git a/database/migrations/2018_10_12_123036_create_password_resets_table.php b/database/migrations/2018_10_12_123036_create_password_resets_table.php index fcacb80b..4f42fe69 100644 --- a/database/migrations/2018_10_12_123036_create_password_resets_table.php +++ b/database/migrations/2018_10_12_123036_create_password_resets_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('password_resets', function (Blueprint $table) { $table->string('email')->index(); @@ -22,10 +20,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('password_resets'); } diff --git a/database/migrations/2018_10_12_131222_add_user_id_to_items_table.php b/database/migrations/2018_10_12_131222_add_user_id_to_items_table.php index c5a7302c..c499f103 100644 --- a/database/migrations/2018_10_12_131222_add_user_id_to_items_table.php +++ b/database/migrations/2018_10_12_131222_add_user_id_to_items_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('items', function (Blueprint $table) { $table->integer('user_id')->default(1)->index(); // 0 = item, 1 = category @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('items', function (Blueprint $table) { $table->dropColumn(['user_id']); diff --git a/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php b/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php index 54dfc992..157c9944 100644 --- a/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php +++ b/database/migrations/2018_10_12_140451_create_setting_user_pivot_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('setting_user', function (Blueprint $table) { $table->integer('setting_id')->unsigned()->index(); @@ -25,10 +23,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('setting_user'); } diff --git a/database/migrations/2018_10_18_110905_create_applications_table.php b/database/migrations/2018_10_18_110905_create_applications_table.php index 460db7a7..daa82b44 100644 --- a/database/migrations/2018_10_18_110905_create_applications_table.php +++ b/database/migrations/2018_10_18_110905_create_applications_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('applications', function (Blueprint $table) { $table->string('appid')->unique(); @@ -30,10 +28,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('applications'); } diff --git a/database/migrations/2018_10_23_132008_add_class_to_items_table.php b/database/migrations/2018_10_23_132008_add_class_to_items_table.php index 6877440d..2fae9bc1 100644 --- a/database/migrations/2018_10_23_132008_add_class_to_items_table.php +++ b/database/migrations/2018_10_23_132008_add_class_to_items_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('items', function (Blueprint $table) { $table->string('class')->nullable(); @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('items', function (Blueprint $table) { $table->dropColumn(['class']); diff --git a/database/migrations/2018_10_31_191604_create_jobs_table.php b/database/migrations/2018_10_31_191604_create_jobs_table.php index a786a891..6098d9b1 100644 --- a/database/migrations/2018_10_31_191604_create_jobs_table.php +++ b/database/migrations/2018_10_31_191604_create_jobs_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('jobs', function (Blueprint $table) { $table->bigIncrements('id'); @@ -26,10 +24,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('jobs'); } diff --git a/database/migrations/2018_11_06_112434_create_failed_jobs_table.php b/database/migrations/2018_11_06_112434_create_failed_jobs_table.php index 23a0faa3..b1b6dfcd 100644 --- a/database/migrations/2018_11_06_112434_create_failed_jobs_table.php +++ b/database/migrations/2018_11_06_112434_create_failed_jobs_table.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::create('failed_jobs', function (Blueprint $table) { $table->bigIncrements('id'); @@ -25,10 +23,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::dropIfExists('failed_jobs'); } diff --git a/database/migrations/2022_03_15_140911_add_appid_to_items.php b/database/migrations/2022_03_15_140911_add_appid_to_items.php index b099b695..2ca107fe 100644 --- a/database/migrations/2022_03_15_140911_add_appid_to_items.php +++ b/database/migrations/2022_03_15_140911_add_appid_to_items.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('items', function (Blueprint $table) { $table->string('appid')->nullable(); @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('items', function (Blueprint $table) { $table->dropColumn(['appid']); diff --git a/database/migrations/2022_03_16_093044_add_class_to_application.php b/database/migrations/2022_03_16_093044_add_class_to_application.php index bace6a2e..8dbd80ca 100644 --- a/database/migrations/2022_03_16_093044_add_class_to_application.php +++ b/database/migrations/2022_03_16_093044_add_class_to_application.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('applications', function (Blueprint $table) { $table->string('class')->nullable()->index(); @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('applications', function (Blueprint $table) { $table->dropColumn(['class']); diff --git a/database/migrations/2022_03_16_181343_add_app_description_to_items.php b/database/migrations/2022_03_16_181343_add_app_description_to_items.php index ed9dafb7..cdb6981f 100644 --- a/database/migrations/2022_03_16_181343_add_app_description_to_items.php +++ b/database/migrations/2022_03_16_181343_add_app_description_to_items.php @@ -8,10 +8,8 @@ return new class extends Migration { /** * Run the migrations. - * - * @return void */ - public function up() + public function up(): void { Schema::table('items', function (Blueprint $table) { $table->text('appdescription')->nullable(); @@ -20,10 +18,8 @@ return new class extends Migration /** * Reverse the migrations. - * - * @return void */ - public function down() + public function down(): void { Schema::table('items', function (Blueprint $table) { // diff --git a/database/migrations/2024_02_16_000000_rename_password_resets_table.php b/database/migrations/2024_02_16_000000_rename_password_resets_table.php new file mode 100644 index 00000000..f0ad3757 --- /dev/null +++ b/database/migrations/2024_02_16_000000_rename_password_resets_table.php @@ -0,0 +1,24 @@ +call(SettingsSeeder::class); $this->call(UsersSeeder::class); diff --git a/database/seeders/SettingsSeeder.php b/database/seeders/SettingsSeeder.php index df11f8f3..ff000ca0 100644 --- a/database/seeders/SettingsSeeder.php +++ b/database/seeders/SettingsSeeder.php @@ -52,10 +52,8 @@ class SettingsSeeder extends Seeder /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { // Groups if (! $setting_group = SettingGroup::find(1)) { diff --git a/database/seeders/UsersSeeder.php b/database/seeders/UsersSeeder.php index 198258b2..1c729a27 100644 --- a/database/seeders/UsersSeeder.php +++ b/database/seeders/UsersSeeder.php @@ -9,10 +9,8 @@ class UsersSeeder extends Seeder { /** * Run the database seeds. - * - * @return void */ - public function run() + public function run(): void { // Groups if (!User::find(1)) { diff --git a/lang/en/validation.php b/lang/en/validation.php index af94bd42..8dbe37f1 100644 --- a/lang/en/validation.php +++ b/lang/en/validation.php @@ -13,113 +13,125 @@ return [ | */ - 'accepted' => 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute must only contain letters.', - 'alpha_dash' => 'The :attribute must only contain letters, numbers, dashes and underscores.', - 'alpha_num' => 'The :attribute must only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'ascii' => 'The :attribute must only contain single-byte alphanumeric characters and symbols.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', + 'accepted' => 'The :attribute field must be accepted.', + 'accepted_if' => 'The :attribute field must be accepted when :other is :value.', + 'active_url' => 'The :attribute field must be a valid URL.', + 'after' => 'The :attribute field must be a date after :date.', + 'after_or_equal' => 'The :attribute field must be a date after or equal to :date.', + 'alpha' => 'The :attribute field must only contain letters.', + 'alpha_dash' => 'The :attribute field must only contain letters, numbers, dashes, and underscores.', + 'alpha_num' => 'The :attribute field must only contain letters and numbers.', + 'array' => 'The :attribute field must be an array.', + 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', + 'before' => 'The :attribute field must be a date before :date.', + 'before_or_equal' => 'The :attribute field must be a date before or equal to :date.', 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', + 'array' => 'The :attribute field must have between :min and :max items.', + 'file' => 'The :attribute field must be between :min and :max kilobytes.', + 'numeric' => 'The :attribute field must be between :min and :max.', + 'string' => 'The :attribute field must be between :min and :max characters.', ], 'boolean' => 'The :attribute field must be true or false.', - 'confirmed' => 'The :attribute confirmation does not match.', + 'can' => 'The :attribute field contains an unauthorized value.', + 'confirmed' => 'The :attribute field confirmation does not match.', 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'decimal' => 'The :attribute must have :decimal decimal places.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', + 'date' => 'The :attribute field must be a valid date.', + 'date_equals' => 'The :attribute field must be a date equal to :date.', + 'date_format' => 'The :attribute field must match the format :format.', + 'decimal' => 'The :attribute field must have :decimal decimal places.', + 'declined' => 'The :attribute field must be declined.', + 'declined_if' => 'The :attribute field must be declined when :other is :value.', + 'different' => 'The :attribute field and :other must be different.', + 'digits' => 'The :attribute field must be :digits digits.', + 'digits_between' => 'The :attribute field must be between :min and :max digits.', + 'dimensions' => 'The :attribute field has invalid image dimensions.', 'distinct' => 'The :attribute field has a duplicate value.', - 'doesnt_end_with' => 'The :attribute may not end with one of the following: :values.', - 'doesnt_start_with' => 'The :attribute may not start with one of the following: :values.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', + 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', + 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', + 'email' => 'The :attribute field must be a valid email address.', + 'ends_with' => 'The :attribute field must end with one of the following: :values.', 'enum' => 'The selected :attribute is invalid.', 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', + 'extensions' => 'The :attribute field must have one of the following extensions: :values.', + 'file' => 'The :attribute field must be a file.', 'filled' => 'The :attribute field must have a value.', 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', + 'array' => 'The :attribute field must have more than :value items.', + 'file' => 'The :attribute field must be greater than :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than :value.', + 'string' => 'The :attribute field must be greater than :value characters.', ], 'gte' => [ - 'array' => 'The :attribute must have :value items or more.', - 'file' => 'The :attribute must be greater than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be greater than or equal to :value.', - 'string' => 'The :attribute must be greater than or equal to :value characters.', + 'array' => 'The :attribute field must have :value items or more.', + 'file' => 'The :attribute field must be greater than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be greater than or equal to :value.', + 'string' => 'The :attribute field must be greater than or equal to :value characters.', ], - 'image' => 'The :attribute must be an image.', + 'hex_color' => 'The :attribute field must be a valid hexadecimal color.', + 'image' => 'The :attribute field must be an image.', 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lowercase' => 'The :attribute must be lowercase.', + 'in_array' => 'The :attribute field must exist in :other.', + 'integer' => 'The :attribute field must be an integer.', + 'ip' => 'The :attribute field must be a valid IP address.', + 'ipv4' => 'The :attribute field must be a valid IPv4 address.', + 'ipv6' => 'The :attribute field must be a valid IPv6 address.', + 'json' => 'The :attribute field must be a valid JSON string.', + 'lowercase' => 'The :attribute field must be lowercase.', 'lt' => [ - 'array' => 'The :attribute must have less than :value items.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'numeric' => 'The :attribute must be less than :value.', - 'string' => 'The :attribute must be less than :value characters.', + 'array' => 'The :attribute field must have less than :value items.', + 'file' => 'The :attribute field must be less than :value kilobytes.', + 'numeric' => 'The :attribute field must be less than :value.', + 'string' => 'The :attribute field must be less than :value characters.', ], 'lte' => [ - 'array' => 'The :attribute must not have more than :value items.', - 'file' => 'The :attribute must be less than or equal to :value kilobytes.', - 'numeric' => 'The :attribute must be less than or equal to :value.', - 'string' => 'The :attribute must be less than or equal to :value characters.', + 'array' => 'The :attribute field must not have more than :value items.', + 'file' => 'The :attribute field must be less than or equal to :value kilobytes.', + 'numeric' => 'The :attribute field must be less than or equal to :value.', + 'string' => 'The :attribute field must be less than or equal to :value characters.', ], - 'mac_address' => 'The :attribute must be a valid MAC address.', + 'mac_address' => 'The :attribute field must be a valid MAC address.', 'max' => [ - 'array' => 'The :attribute must not have more than :max items.', - 'file' => 'The :attribute must not be greater than :max kilobytes.', - 'numeric' => 'The :attribute must not be greater than :max.', - 'string' => 'The :attribute must not be greater than :max characters.', + 'array' => 'The :attribute field must not have more than :max items.', + 'file' => 'The :attribute field must not be greater than :max kilobytes.', + 'numeric' => 'The :attribute field must not be greater than :max.', + 'string' => 'The :attribute field must not be greater than :max characters.', ], - 'max_digits' => 'The :attribute must not have more than :max digits.', - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', + 'max_digits' => 'The :attribute field must not have more than :max digits.', + 'mimes' => 'The :attribute field must be a file of type: :values.', + 'mimetypes' => 'The :attribute field must be a file of type: :values.', 'min' => [ - 'array' => 'The :attribute must have at least :min items.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'numeric' => 'The :attribute must be at least :min.', - 'string' => 'The :attribute must be at least :min characters.', + 'array' => 'The :attribute field must have at least :min items.', + 'file' => 'The :attribute field must be at least :min kilobytes.', + 'numeric' => 'The :attribute field must be at least :min.', + 'string' => 'The :attribute field must be at least :min characters.', ], - 'min_digits' => 'The :attribute must have at least :min digits.', - 'multiple_of' => 'The :attribute must be a multiple of :value.', + 'min_digits' => 'The :attribute field must have at least :min digits.', + 'missing' => 'The :attribute field must be missing.', + 'missing_if' => 'The :attribute field must be missing when :other is :value.', + 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', + 'missing_with' => 'The :attribute field must be missing when :values is present.', + 'missing_with_all' => 'The :attribute field must be missing when :values are present.', + 'multiple_of' => 'The :attribute field must be a multiple of :value.', 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', + 'not_regex' => 'The :attribute field format is invalid.', + 'numeric' => 'The :attribute field must be a number.', 'password' => [ - 'letters' => 'The :attribute must contain at least one letter.', - 'mixed' => 'The :attribute must contain at least one uppercase and one lowercase letter.', - 'numbers' => 'The :attribute must contain at least one number.', - 'symbols' => 'The :attribute must contain at least one symbol.', + 'letters' => 'The :attribute field must contain at least one letter.', + 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', + 'numbers' => 'The :attribute field must contain at least one number.', + 'symbols' => 'The :attribute field must contain at least one symbol.', 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', ], 'present' => 'The :attribute field must be present.', + 'present_if' => 'The :attribute field must be present when :other is :value.', + 'present_unless' => 'The :attribute field must be present unless :other is :value.', + 'present_with' => 'The :attribute field must be present when :values is present.', + 'present_with_all' => 'The :attribute field must be present when :values are present.', 'prohibited' => 'The :attribute field is prohibited.', 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', + 'regex' => 'The :attribute field format is invalid.', 'required' => 'The :attribute field is required.', 'required_array_keys' => 'The :attribute field must contain entries for: :values.', 'required_if' => 'The :attribute field is required when :other is :value.', @@ -129,22 +141,22 @@ return [ 'required_with_all' => 'The :attribute field is required when :values are present.', 'required_without' => 'The :attribute field is required when :values is not present.', 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', + 'same' => 'The :attribute field must match :other.', 'size' => [ - 'array' => 'The :attribute must contain :size items.', - 'file' => 'The :attribute must be :size kilobytes.', - 'numeric' => 'The :attribute must be :size.', - 'string' => 'The :attribute must be :size characters.', + 'array' => 'The :attribute field must contain :size items.', + 'file' => 'The :attribute field must be :size kilobytes.', + 'numeric' => 'The :attribute field must be :size.', + 'string' => 'The :attribute field must be :size characters.', ], - 'starts_with' => 'The :attribute must start with one of the following: :values.', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid timezone.', + 'starts_with' => 'The :attribute field must start with one of the following: :values.', + 'string' => 'The :attribute field must be a string.', + 'timezone' => 'The :attribute field must be a valid timezone.', 'unique' => 'The :attribute has already been taken.', 'uploaded' => 'The :attribute failed to upload.', - 'uppercase' => 'The :attribute must be uppercase.', - 'url' => 'The :attribute must be a valid URL.', - 'ulid' => 'The :attribute must be a valid ULID.', - 'uuid' => 'The :attribute must be a valid UUID.', + 'uppercase' => 'The :attribute field must be uppercase.', + 'url' => 'The :attribute field must be a valid URL.', + 'ulid' => 'The :attribute field must be a valid ULID.', + 'uuid' => 'The :attribute field must be a valid UUID.', /* |-------------------------------------------------------------------------- diff --git a/phpunit.xml b/phpunit.xml index cfa9c5bc..95720b20 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -20,7 +20,8 @@ - + + diff --git a/tests/CreatesApplication.php b/tests/CreatesApplication.php index 36b3659e..e2dc0db5 100644 --- a/tests/CreatesApplication.php +++ b/tests/CreatesApplication.php @@ -2,16 +2,15 @@ namespace Tests; +use Illuminate\Foundation\Application; use Illuminate\Contracts\Console\Kernel; trait CreatesApplication { /** * Creates the application. - * - * @return \Illuminate\Foundation\Application */ - public function createApplication() + public function createApplication(): Application { $app = require __DIR__.'/../bootstrap/app.php'; diff --git a/tests/Feature/DashTest.php b/tests/Feature/DashTest.php index 2c631b76..189436b7 100644 --- a/tests/Feature/DashTest.php +++ b/tests/Feature/DashTest.php @@ -42,7 +42,7 @@ class DashTest extends TestCase * Test Cases */ - public function test_loads_empty_dash() + public function test_loads_empty_dash(): void { $this->seed(); @@ -51,7 +51,7 @@ class DashTest extends TestCase $response->assertStatus(200); } - public function test_displays_items_on_the_dash() + public function test_displays_items_on_the_dash(): void { $this->seed(); @@ -67,7 +67,7 @@ class DashTest extends TestCase $response->assertSee('Item 3'); } - public function test_displays_tags_on_the_dash() + public function test_displays_tags_on_the_dash(): void { $this->seed(); diff --git a/tests/Feature/ItemCreateTest.php b/tests/Feature/ItemCreateTest.php index f166face..2d7d681b 100644 --- a/tests/Feature/ItemCreateTest.php +++ b/tests/Feature/ItemCreateTest.php @@ -9,7 +9,7 @@ class ItemCreateTest extends TestCase { use RefreshDatabase; - public function test_displays_the_item_create_page() + public function test_displays_the_item_create_page(): void { $this->seed(); @@ -18,7 +18,7 @@ class ItemCreateTest extends TestCase $response->assertStatus(200); } - public function test_display_the_home_dashboard_tag() + public function test_display_the_home_dashboard_tag(): void { $this->seed(); @@ -27,7 +27,7 @@ class ItemCreateTest extends TestCase $response->assertSee('Home dashboard'); } - public function test_creates_a_new_item() + public function test_creates_a_new_item(): void { $this->seed(); $item = [ @@ -46,7 +46,7 @@ class ItemCreateTest extends TestCase $response->assertSee('Redirecting to'); } - public function test_redirects_to_dash_when_adding_a_new_item() + public function test_redirects_to_dash_when_adding_a_new_item(): void { $this->seed(); $item = [ diff --git a/tests/Feature/ItemDeleteTest.php b/tests/Feature/ItemDeleteTest.php index 13a1263b..63974c96 100644 --- a/tests/Feature/ItemDeleteTest.php +++ b/tests/Feature/ItemDeleteTest.php @@ -10,7 +10,7 @@ class ItemDeleteTest extends TestCase { use RefreshDatabase; - public function test_deletes_an_item() + public function test_deletes_an_item(): void { $this->seed(); $item = Item::factory() @@ -23,7 +23,7 @@ class ItemDeleteTest extends TestCase $response->assertStatus(302); } - public function test_redirects_to_item_list_page_when_deleting_an_item() + public function test_redirects_to_item_list_page_when_deleting_an_item(): void { $this->seed(); $item = Item::factory() diff --git a/tests/Feature/ItemExportTest.php b/tests/Feature/ItemExportTest.php index c56015a0..77baf32c 100644 --- a/tests/Feature/ItemExportTest.php +++ b/tests/Feature/ItemExportTest.php @@ -12,14 +12,14 @@ class ItemExportTest extends TestCase use RefreshDatabase; - public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db() + public function test_returns_empty_jsonarray_when_there_are_no_items_in_the_db(): void { $response = $this->get('api/item'); $response->assertJsonCount(0); } - public function test_returns_exactly_the_defined_fields() + public function test_returns_exactly_the_defined_fields(): void { $exampleItem = [ "appdescription" => "Description", @@ -37,7 +37,7 @@ class ItemExportTest extends TestCase $response->assertExactJson([(object)$exampleItem]); } - public function test_returns_all_items() + public function test_returns_all_items(): void { Item::factory() ->count(3) @@ -48,7 +48,7 @@ class ItemExportTest extends TestCase $response->assertJsonCount(3); } - public function test_does_not_return_deleted_item() + public function test_does_not_return_deleted_item(): void { Item::factory() ->create([ @@ -62,7 +62,7 @@ class ItemExportTest extends TestCase $response->assertJsonCount(1); } - public function test_does_not_return_tags() + public function test_does_not_return_tags(): void { Item::factory() ->create([ diff --git a/tests/Feature/ItemListTest.php b/tests/Feature/ItemListTest.php index 2d806d88..561ec8fb 100644 --- a/tests/Feature/ItemListTest.php +++ b/tests/Feature/ItemListTest.php @@ -18,7 +18,7 @@ class ItemListTest extends TestCase ]); } - public function test_displays_items_on_the_item_list_page() + public function test_displays_items_on_the_item_list_page(): void { $this->addItemWithTitleToDB('Item 1'); $this->addItemWithTitleToDB('Item 2'); @@ -32,7 +32,7 @@ class ItemListTest extends TestCase $response->assertSee('Item 3'); } - public function test_escapes_xss_on_the_item_list_page() + public function test_escapes_xss_on_the_item_list_page(): void { $this->addItemWithTitleToDB(''); diff --git a/tests/Feature/SettingsTest.php b/tests/Feature/SettingsTest.php index 8293dc2f..4afe6a54 100644 --- a/tests/Feature/SettingsTest.php +++ b/tests/Feature/SettingsTest.php @@ -9,7 +9,7 @@ class SettingsTest extends TestCase { use RefreshDatabase; - public function test_displays_the_settings_page() + public function test_displays_the_settings_page(): void { $this->seed(); diff --git a/tests/Feature/TagListTest.php b/tests/Feature/TagListTest.php index 54a52f9b..3b1332d1 100644 --- a/tests/Feature/TagListTest.php +++ b/tests/Feature/TagListTest.php @@ -19,7 +19,7 @@ class TagListTest extends TestCase ]); } - public function test_displays_the_tags_on_the_tag_list_page() + public function test_displays_the_tags_on_the_tag_list_page(): void { $this->addTagWithTitleToDB('Tag 1'); $this->addTagWithTitleToDB('Tag 2'); @@ -33,7 +33,7 @@ class TagListTest extends TestCase $response->assertSee('Tag 3'); } - public function test_escapes_xss_on_the_tag_list_page() + public function test_escapes_xss_on_the_tag_list_page(): void { $this->addTagWithTitleToDB(''); diff --git a/tests/Feature/UserListTest.php b/tests/Feature/UserListTest.php index e297f6fa..9f92edbc 100644 --- a/tests/Feature/UserListTest.php +++ b/tests/Feature/UserListTest.php @@ -18,7 +18,7 @@ class UserListTest extends TestCase ]); } - public function test_displays_admin_on_user_list_page_when_default_install() + public function test_displays_admin_on_user_list_page_when_default_install(): void { $this->seed(); @@ -28,7 +28,7 @@ class UserListTest extends TestCase $response->assertSee('admin'); } - public function test_displays_users_on_user_list_page() + public function test_displays_users_on_user_list_page(): void { $this->seed(); diff --git a/tests/Unit/database/seeders/SettingsSeederTest.php b/tests/Unit/database/seeders/SettingsSeederTest.php index 88532764..d257092b 100644 --- a/tests/Unit/database/seeders/SettingsSeederTest.php +++ b/tests/Unit/database/seeders/SettingsSeederTest.php @@ -9,10 +9,8 @@ class SettingsSeederTest extends TestCase { /** * All language keys are defined in all languages based on the en language file. - * - * @return void */ - public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present() + public function test_returns_a_jsonmap_with_same_amount_of_items_as_language_directories_present(): void { $languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir'); diff --git a/tests/Unit/helpers/IsImageTest.php b/tests/Unit/helpers/IsImageTest.php index 8b14a794..facad313 100644 --- a/tests/Unit/helpers/IsImageTest.php +++ b/tests/Unit/helpers/IsImageTest.php @@ -6,10 +6,7 @@ use Tests\TestCase; class IsImageTest extends TestCase { - /** - * @return void - */ - public function test_returns_true_when_file_is_image() + public function test_returns_true_when_file_is_image(): void { $file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png'); @@ -18,20 +15,14 @@ class IsImageTest extends TestCase $this->assertTrue($actual); } - /** - * @return void - */ - public function test_returns_false_when_file_extension_is_image_but_content_is_not() + public function test_returns_false_when_file_extension_is_image_but_content_is_not(): void { $actual = isImage("", "png"); $this->assertFalse($actual); } - /** - * @return void - */ - public function test_returns_false_when_file_extension_is_not_image_but_content_is() + public function test_returns_false_when_file_extension_is_not_image_but_content_is(): void { $file = file_get_contents(__DIR__ . '/fixtures/heimdall-icon-small.png'); diff --git a/tests/Unit/helpers/SlugTest.php b/tests/Unit/helpers/SlugTest.php index a12bd8be..17aed922 100644 --- a/tests/Unit/helpers/SlugTest.php +++ b/tests/Unit/helpers/SlugTest.php @@ -6,10 +6,7 @@ use Tests\TestCase; class SlugTest extends TestCase { - /** - * @return void - */ - public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US() + public function test_slug_returns_valid_tag_for_cn_characters_when_language_is_set_to_en_US(): void { $tag = str_slug('中文測試', '-', 'en_US'); diff --git a/tests/Unit/lang/LangTest.php b/tests/Unit/lang/LangTest.php index 33d2105a..7712811f 100644 --- a/tests/Unit/lang/LangTest.php +++ b/tests/Unit/lang/LangTest.php @@ -8,10 +8,8 @@ class LangTest extends TestCase { /** * All language keys are defined in all languages based on the en language file. - * - * @return void */ - public function test_all_language_keys_are_defined() + public function test_all_language_keys_are_defined(): void { $this->markTestSkipped('2022-11-14 Lot of keys missing. Enable this test to see them all.'); $languageDirectories = array_filter(glob(resource_path().'/lang/*'), 'is_dir');