diff --git a/app/Conversions/Svg.php b/app/Conversions/Svg.php index 76d5b3c3..fa208204 100644 --- a/app/Conversions/Svg.php +++ b/app/Conversions/Svg.php @@ -13,7 +13,7 @@ class Svg extends ImageGenerator /** * Converts SVG to PNG, preserving transparency */ - public function convert(string $file, Conversion $conversion = null): string + public function convert(string $file, ?Conversion $conversion = null): string { $imageFile = pathinfo($file, PATHINFO_DIRNAME) . '/' . pathinfo($file, PATHINFO_FILENAME) . '.png'; @@ -29,7 +29,7 @@ public function convert(string $file, Conversion $conversion = null): string public function requirementsAreInstalled(): bool { - return class_exists(\Imagick::class); + return class_exists(Imagick::class); } public function supportedExtensions(): Collection diff --git a/app/Helpers/LdapHelper.php b/app/Helpers/LdapHelper.php index 827780d3..6fa2756b 100644 --- a/app/Helpers/LdapHelper.php +++ b/app/Helpers/LdapHelper.php @@ -113,7 +113,6 @@ protected function flattenUserAttributes($users, $fields) /** * Look up and return a local user instance by checking LDAP for that user. * - * @param string $display_name The user's display name * @param string $name The user's name/uid * * @return User|boolean diff --git a/app/Http/Controllers/AppController.php b/app/Http/Controllers/AppController.php index 3c2bc51d..3d2ff1d7 100644 --- a/app/Http/Controllers/AppController.php +++ b/app/Http/Controllers/AppController.php @@ -2,16 +2,15 @@ namespace App\Http\Controllers; -use Illuminate\Http\Request; -use Illuminate\Contracts\View\View as ViewContract; -use Illuminate\View\View; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; class AppController extends Controller { /** * Display the App Homepage. */ - public function index(): View|ViewContract + public function index(): View|ViewFactory { return view('home'); } @@ -19,7 +18,7 @@ public function index(): View|ViewContract /** * Display the FAQ page. */ - public function faq(): View|ViewContract + public function faq(): View|ViewFactory { return view('faq'); } diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index bc5ca9c4..3e1da715 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -4,8 +4,8 @@ use App\Http\Controllers\Controller; use Illuminate\Foundation\Auth\AuthenticatesUsers; -use Illuminate\Contracts\View\View as ViewContract; -use Illuminate\View\View; +use Illuminate\Contracts\View\View; +use Illuminate\Contracts\View\Factory as ViewFactory; class LoginController extends Controller { @@ -52,7 +52,7 @@ public function username() /** * Show the login form. */ - public function showLoginForm(): View|ViewContract + public function showLoginForm(): View|ViewFactory { if (!session()->has('url.intended')) { session(['url.intended' => url()->previous()]); diff --git a/app/Http/Controllers/LogsController.php b/app/Http/Controllers/LogsController.php index b3fcbbff..91f39a9a 100644 --- a/app/Http/Controllers/LogsController.php +++ b/app/Http/Controllers/LogsController.php @@ -4,8 +4,8 @@ use App\LogEntry; use Illuminate\Http\Request; -use Illuminate\Contracts\View\View as ViewContract; -use Illuminate\View\View; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; class LogsController extends Controller { @@ -22,7 +22,7 @@ public function __construct() /** * Display a listing of the resource. */ - public function index(Request $request): View|ViewContract + public function index(Request $request): View|ViewFactory { return view('logs.index', [ 'logs' => LogEntry::with('user') diff --git a/app/Http/Controllers/ProfileStudentsController.php b/app/Http/Controllers/ProfileStudentsController.php index 7feba4af..27d471dd 100644 --- a/app/Http/Controllers/ProfileStudentsController.php +++ b/app/Http/Controllers/ProfileStudentsController.php @@ -3,9 +3,8 @@ namespace App\Http\Controllers; use App\Profile; -use Illuminate\Contracts\View\View as ViewContract; -use Illuminate\Http\Request; -use Illuminate\View\View; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; class ProfileStudentsController extends Controller { @@ -22,7 +21,7 @@ public function __construct() /** * Show student applications associated with a profile. */ - public function show(Profile $profile): View|ViewContract + public function show(Profile $profile): View|ViewFactory { return view('students.profile-students', [ 'profile' => $profile, diff --git a/app/Http/Controllers/ProfilesController.php b/app/Http/Controllers/ProfilesController.php index 64fdd2ba..5e267d00 100644 --- a/app/Http/Controllers/ProfilesController.php +++ b/app/Http/Controllers/ProfilesController.php @@ -14,14 +14,14 @@ use App\Http\Requests\ProfileSearchRequest; use App\Http\Requests\ProfileUpdateRequest; use App\School; -use Illuminate\Contracts\View\View as ViewContract; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Collection as EloquentCollection; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Response; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\DB; -use Illuminate\View\View; use Spatie\Browsershot\Browsershot; class ProfilesController extends Controller @@ -68,7 +68,7 @@ public function __construct() /** * Display a listing of profiles. */ - public function index(ProfileSearchRequest $request): View|ViewContract|RedirectResponse + public function index(ProfileSearchRequest $request): View|ViewFactory|RedirectResponse { $input_search = $request->input('search'); @@ -102,7 +102,7 @@ public function index(ProfileSearchRequest $request): View|ViewContract|Redirect /** * Display the home page */ - public function home(): View|ViewContract + public function home(): View|ViewFactory { $random_profile = Cache::tags(['home', 'profiles'])->remember('home-random-profiles', 86400, function() { return Profile::public()->excludingUnlisted()->inRandomOrder()->limit(2)->get(); @@ -132,7 +132,7 @@ public function home(): View|ViewContract /** * Display an admin table of profiles. */ - public function table(): View|ViewContract + public function table(): View|ViewFactory { return view('profiles.table'); } @@ -140,7 +140,7 @@ public function table(): View|ViewContract /** * Show the specified profile. */ - public function show(Request $request, Profile $profile): View|ViewContract + public function show(Request $request, Profile $profile): View|ViewFactory { /** @var User the logged-in user */ $user = Auth::user(); @@ -172,7 +172,7 @@ public function redirectById(int $id): RedirectResponse /** * Create a Profile */ - public function create(Request $request, User $user, LdapHelperContract $ldap): View|ViewContract|RedirectResponse + public function create(Request $request, User $user, LdapHelperContract $ldap): View|ViewFactory|RedirectResponse { $existing_profile = $user->profiles()->withTrashed()->first(); @@ -233,7 +233,7 @@ public function create(Request $request, User $user, LdapHelperContract $ldap): /** * Show the view for editing a profile section */ - public function edit(Profile $profile, string $section): View|ViewContract|RedirectResponse + public function edit(Profile $profile, string $section): View|ViewFactory|RedirectResponse { //dont manage auto-managed publications if ($section == 'publications' && $profile->hasOrcidManagedPublications()) { @@ -294,7 +294,7 @@ public function updateBanner(Profile $profile, ProfileBannerImageRequest $reques /** * Confirm deletion of a profile */ - public function confirmDelete(Profile $profile): View|ViewContract + public function confirmDelete(Profile $profile): View|ViewFactory { return view('profiles.delete', ['profile' => $profile]); } @@ -302,7 +302,7 @@ public function confirmDelete(Profile $profile): View|ViewContract /** * Confirm restoration of a soft-deleted profile */ - public function confirmRestore(Request $request, Profile $profile): View|ViewContract|RedirectResponse + public function confirmRestore(Request $request, Profile $profile): View|ViewFactory|RedirectResponse { // this message is in case someone tries to create an already archived profile if ($request->user()->cannot('restore', $profile)) { diff --git a/app/Http/Controllers/SchoolsController.php b/app/Http/Controllers/SchoolsController.php index 0847d8e2..8fb5a321 100644 --- a/app/Http/Controllers/SchoolsController.php +++ b/app/Http/Controllers/SchoolsController.php @@ -4,10 +4,10 @@ use App\Profile; use App\School; -use Illuminate\Contracts\View\View as ViewContract; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\View\View; class SchoolsController extends Controller { @@ -35,7 +35,7 @@ public function __construct() /** * Display a list of schools. */ - public function index(): View|ViewContract + public function index(): View|ViewFactory { $schools = School::get(); @@ -45,7 +45,7 @@ public function index(): View|ViewContract /** * Show the form for creating a new school. */ - public function create(): View|ViewContract + public function create(): View|ViewFactory { return view('schools.create'); } @@ -65,7 +65,7 @@ public function store(Request $request): RedirectResponse /** * Display all profiles from the specified school. */ - public function show(School $school): View|ViewContract + public function show(School $school): View|ViewFactory { $profiles = Profile::fromSchoolId($school->id)->public()->excludingUnlisted()->paginate(24); @@ -75,7 +75,7 @@ public function show(School $school): View|ViewContract /** * Show the form for editing the specified school. */ - public function edit(School $school): View|ViewContract + public function edit(School $school): View|ViewFactory { return view('schools.edit', compact('school')); } diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index a6842ca8..e7eed991 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -3,10 +3,10 @@ namespace App\Http\Controllers; use App\Setting; -use Illuminate\Contracts\View\View as ViewContract; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\View\View; use Illuminate\Support\Facades\Cache; class SettingsController extends Controller @@ -23,7 +23,7 @@ public function __construct() /** * Show the settings for editing. */ - public function edit(): View|ViewContract + public function edit(): View|ViewFactory { return view('settings', [ 'settings' => Setting::pluck('value', 'name')->toArray(), diff --git a/app/Http/Controllers/StudentsController.php b/app/Http/Controllers/StudentsController.php index 264945e2..a5e188c0 100644 --- a/app/Http/Controllers/StudentsController.php +++ b/app/Http/Controllers/StudentsController.php @@ -7,12 +7,11 @@ use App\Student; use App\StudentData; use App\User; -use Illuminate\Contracts\View\View as ViewContract; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; -use Illuminate\Support\Collection; use Illuminate\Support\Facades\Auth; -use Illuminate\View\View; class StudentsController extends Controller { @@ -35,7 +34,7 @@ public function about() /** * Display the list of student research applications. */ - public function index(): View|ViewContract + public function index(): View|ViewFactory { /** @var User */ $user = Auth::user(); @@ -94,7 +93,7 @@ public function store(Request $request): Student|false /** * Display the specified student research application. */ - public function show(Request $request, Student $student): View|ViewContract + public function show(Request $request, Student $student): View|ViewFactory { if ($request->user() && $request->user()->userOrDelegatorhasRole('faculty')) { StudentViewed::dispatch($student); @@ -114,7 +113,7 @@ public function show(Request $request, Student $student): View|ViewContract /** * Show the form for editing the specified student research application. */ - public function edit(Student $student): View|ViewContract + public function edit(Student $student): View|ViewFactory { return view('students.edit', [ 'student' => $student, diff --git a/app/Http/Controllers/TagsController.php b/app/Http/Controllers/TagsController.php index 24292f41..821819dd 100644 --- a/app/Http/Controllers/TagsController.php +++ b/app/Http/Controllers/TagsController.php @@ -2,11 +2,11 @@ namespace App\Http\Controllers; -use Illuminate\Contracts\View\View as ViewContract; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Cache; -use Illuminate\View\View; use Spatie\Tags\Tag; use App\Http\Requests\TagsUpdateRequest; use App\Http\Requests\TagUpdateRequest; @@ -39,7 +39,7 @@ public function __construct() /** * Show the index of all associated tags. */ - public function index(): View|ViewContract + public function index(): View|ViewFactory { $tags = Tag::whereExists(function($query) { $query->select(\DB::raw(1))->from('taggables')->whereRaw('tags.id = taggables.tag_id'); @@ -57,7 +57,7 @@ public function index(): View|ViewContract /** * Show the index table of all associated tags. */ - public function table(): View|ViewContract + public function table(): View|ViewFactory { return view('tags.table'); } @@ -65,7 +65,7 @@ public function table(): View|ViewContract /** * Show the index table of all associated tags. */ - public function create(): View|ViewContract + public function create(): View|ViewFactory { return view('tags.create'); } diff --git a/app/Http/Controllers/Testing/TestingController.php b/app/Http/Controllers/Testing/TestingController.php index 967f193e..eef1639a 100644 --- a/app/Http/Controllers/Testing/TestingController.php +++ b/app/Http/Controllers/Testing/TestingController.php @@ -8,11 +8,13 @@ use App\Http\Controllers\Controller; use App\Profile; use Exception; -use Illuminate\Contracts\View\View as ViewContract; +use Illuminate\Contracts\Routing\ResponseFactory; +use Illuminate\Contracts\View\Factory as ViewFactory; +use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; -use Illuminate\View\View; +use Illuminate\Support\Facades\Auth; class TestingController extends Controller { @@ -49,7 +51,7 @@ public function detachRole(Request $request, string $name): RedirectResponse /** * Show a list of possible users to login as */ - public function showLoginAsList(): Response + public function showLoginAsList(): Response|ResponseFactory { $output = "

Log in as a Different User

\n"; $output .= "