Add type hints from DocBlocks

This commit is contained in:
Shift
2024-02-16 21:13:14 +00:00
parent 2cb837e4b5
commit 3487f52a6b
13 changed files with 24 additions and 24 deletions

View File

@@ -59,7 +59,7 @@ class RegisterApp extends Command
* @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');
@@ -98,7 +98,7 @@ class RegisterApp extends Command
* @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);

View File

@@ -135,7 +135,7 @@ class LoginController extends Controller
*
* @return Application|Factory|View
*/
public function showLoginForm()
public function showLoginForm(): \Illuminate\View\View
{
return view('auth.login');
}

View File

@@ -60,7 +60,7 @@ class RegisterController extends Controller
* @param array $data
* @return User
*/
protected function create(array $data)
protected function create(array $data): User
{
return User::create([
'name' => $data['name'],

View File

@@ -511,7 +511,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');

View File

@@ -20,7 +20,7 @@ class ItemRestController extends Controller
*
* @return Collection
*/
public function index()
public function index(): Collection
{
$columns = [
'title',
@@ -70,7 +70,7 @@ class ItemRestController extends Controller
* @param Item $item
* @return Response
*/
public function show(Item $item)
public function show(Item $item): Response
{
//
}
@@ -81,7 +81,7 @@ class ItemRestController extends Controller
* @param Item $item
* @return Response
*/
public function edit(Item $item)
public function edit(Item $item): Response
{
//
}
@@ -93,7 +93,7 @@ class ItemRestController extends Controller
* @param Item $item
* @return Response
*/
public function update(Request $request, Item $item)
public function update(Request $request, Item $item): Response
{
//
}
@@ -104,7 +104,7 @@ class ItemRestController extends Controller
* @param Item $item
* @return Response
*/
public function destroy(Item $item)
public function destroy(Item $item): Response
{
//
}

View File

@@ -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 = [];

View File

@@ -41,7 +41,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();

View File

@@ -79,7 +79,7 @@ class Item extends Model
/**
* @return void
*/
protected static function boot()
protected static function boot(): void
{
parent::boot();

View File

@@ -53,7 +53,7 @@ class UpdateApps implements ShouldQueue, ShouldBeUnique
/**
* @return void
*/
public function failed($exception)
public function failed($exception): void
{
Cache::lock('updateApps')->forceRelease();
}

View File

@@ -108,7 +108,7 @@ class AppServiceProvider extends ServiceProvider
*
* @return void
*/
public function genKey()
public function genKey(): void
{
if (is_file(base_path('.env'))) {
if (empty(env('APP_KEY'))) {
@@ -188,7 +188,7 @@ class AppServiceProvider extends ServiceProvider
/**
* @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.

View File

@@ -32,7 +32,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @return void
*/
public function map()
public function map(): void
{
$this->mapApiRoutes();
@@ -48,7 +48,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @return void
*/
protected function mapWebRoutes()
protected function mapWebRoutes(): void
{
Route::middleware('web')
->group(base_path('routes/web.php'));
@@ -61,7 +61,7 @@ class RouteServiceProvider extends ServiceProvider
*
* @return void
*/
protected function mapApiRoutes()
protected function mapApiRoutes(): void
{
Route::prefix('api')
->middleware('api')

View File

@@ -224,7 +224,7 @@ class Setting extends Model
*
* @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;
@@ -270,7 +270,7 @@ 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;
}
@@ -280,7 +280,7 @@ class Setting extends Model
*
* @return bool
*/
public static function cached($key): bool
public static function cached(string $key): bool
{
return array_key_exists($key, self::$cache);
}

View File

@@ -32,7 +32,7 @@ class UserFactory extends Factory
*
* @return \Illuminate\Database\Eloquent\Factories\Factory
*/
public function unverified()
public function unverified(): Factory
{
return $this->state(function (array $attributes) {
return [