refactor: add return type hints to all controller methods

Added proper return types (View, RedirectResponse, JsonResponse, Collection)
to 40+ controller methods across 16 controllers. Also added missing
imports for Illuminate response types and tightened parameter types
(e.g. InstallationController::showStep now uses int instead of mixed).
This commit is contained in:
root
2026-05-19 19:28:21 +02:00
parent 81e99933e4
commit 05fc7b04bc
1001 changed files with 1100 additions and 26101 deletions
@@ -7,18 +7,21 @@ use App\Models\Miscellaneous\WebsiteInstallation;
use App\Models\Miscellaneous\WebsiteSetting;
use App\Rules\ValidateInstallationKeyRule;
use Exception;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Str;
use Illuminate\View\View;
class InstallationController extends Controller
{
public function index()
public function index(): View
{
return view('installation.index');
}
public function storeInstallationKey(Request $request)
public function storeInstallationKey(Request $request): RedirectResponse
{
$request->validate([
'installation_key' => ['required', 'string', 'max:255', new ValidateInstallationKeyRule],
@@ -32,16 +35,16 @@ class InstallationController extends Controller
return to_route('installation.show-step', 1);
}
public function showStep($currentStep)
public function showStep(int $currentStep): View
{
$settings = $this->getSettingsForStep((int) $currentStep);
$settings = $this->getSettingsForStep($currentStep);
return view('installation.step-' . $currentStep, [
'settings' => $settings,
]);
}
public function saveStepSettings(Request $request)
public function saveStepSettings(Request $request): RedirectResponse
{
$this->updateSettings($request);
@@ -50,14 +53,14 @@ class InstallationController extends Controller
return to_route('installation.show-step', WebsiteInstallation::first()->step);
}
public function previousStep()
public function previousStep(): RedirectResponse
{
WebsiteInstallation::first()->decrement('step');
return to_route('installation.show-step', WebsiteInstallation::first()->step);
}
public function restartInstallation()
public function restartInstallation(): RedirectResponse
{
WebsiteInstallation::first()->update([
'step' => 0,
@@ -72,7 +75,7 @@ class InstallationController extends Controller
return to_route('installation.index');
}
public function completeInstallation()
public function completeInstallation(): RedirectResponse
{
// Clear all caches before marking as complete
Cache::forget('website_permissions');
@@ -97,7 +100,7 @@ class InstallationController extends Controller
// Cache will be automatically cleared by WebsiteSetting model events
}
private function getSettingsForStep(int $step)
private function getSettingsForStep(int $step): Collection
{
$settingsData = array_chunk(WebsiteSetting::all()->pluck('key')->toArray(), (int) ceil(WebsiteSetting::count() / 4));