Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ jobs:
run: php artisan migrate --no-interaction -vvv --force
- name: Execute code style check via Laravel Pint
run: vendor/bin/pint --test -v
- name: Rector Cache
uses: actions/cache@v4
with:
path: /tmp/rector
key: ${{ runner.os }}-rector-${{ github.run_id }}
restore-keys: ${{ runner.os }}-rector-
- run: mkdir -p /tmp/rector
- name: Rector Dry Run
run: vendor/bin/rector process --dry-run
- name: Execute tests (Unit and Feature tests) via PHPUnit
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
env:
Expand Down
2 changes: 1 addition & 1 deletion app/Auth/ExternalUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private function isRuleFulfilled($values, mixed $rule): bool

// Loop through all values and try to match the regex and save the result
foreach ($values as $value) {
$matches[] = preg_match($rule->regex, $value);
$matches[] = preg_match($rule->regex, (string) $value);
}

// Check if regex has to (not) match with all array entries
Expand Down
2 changes: 1 addition & 1 deletion app/Auth/LDAP/LDAPController.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function login(Request $request)
try {
// Run login method from AuthenticatesUsers trait
return $this->ldapLogin($request);
} catch (MissingAttributeException $e) {
} catch (MissingAttributeException) {
// If an attribute is missing during the login process, return error
return abort(500, __('auth.error.missing_attributes'));
}
Expand Down
6 changes: 6 additions & 0 deletions app/Auth/LDAP/LDAPProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
* @param mixed $identifier
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
#[\Override]

Check warning on line 43 in app/Auth/LDAP/LDAPProvider.php

View check run for this annotation

Codecov / codecov/patch

app/Auth/LDAP/LDAPProvider.php#L43

Added line #L43 was not covered by tests
public function retrieveById($identifier)
{
return $this->eloquent->retrieveById($identifier);
Expand All @@ -52,6 +53,7 @@
* @param string $token
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
#[\Override]

Check warning on line 56 in app/Auth/LDAP/LDAPProvider.php

View check run for this annotation

Codecov / codecov/patch

app/Auth/LDAP/LDAPProvider.php#L56

Added line #L56 was not covered by tests
public function retrieveByToken($identifier, $token)
{
return $this->eloquent->retrieveByToken($identifier, $token);
Expand All @@ -63,11 +65,13 @@
* @param string $token
* @return void
*/
#[\Override]

Check warning on line 68 in app/Auth/LDAP/LDAPProvider.php

View check run for this annotation

Codecov / codecov/patch

app/Auth/LDAP/LDAPProvider.php#L68

Added line #L68 was not covered by tests
public function updateRememberToken(Authenticatable $user, $token)
{
$this->eloquent->updateRememberToken($user, $token);
}

#[\Override]
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false): void
{
$this->eloquent->rehashPasswordIfRequired($user, $credentials, $force);
Expand All @@ -78,6 +82,7 @@
*
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
#[\Override]
public function retrieveByCredentials(array $credentials)
{
// Find ldap user by username
Expand All @@ -102,6 +107,7 @@
*
* @return bool
*/
#[\Override]
public function validateCredentials(Authenticatable $user, array $credentials)
{
// Bind to LDAP with user credentials
Expand Down
2 changes: 1 addition & 1 deletion app/Auth/LDAP/LDAPUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function __construct(LDAPUserObject $ldap_user)
foreach ($raw_attributes as $attribute_name => $attribute_values) {
// If the current LDAP attribute matches the name of the LDAP attribute in the mapping
// add all values to the attribute of the user
if (strcasecmp($ldap_attribute, $attribute_name) == 0) {
if (strcasecmp((string) $ldap_attribute, $attribute_name) == 0) {
foreach ($attribute_values as $value) {
$this->addAttributeValue($attribute, $value);
}
Expand Down
2 changes: 2 additions & 0 deletions app/Auth/LDAP/LDAPUserObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class LDAPUserObject extends Model
/**
* The "booting" method of the model.
*/
#[\Override]
protected static function boot(): void
{
parent::boot();
Expand All @@ -27,6 +28,7 @@ public function __construct(array $attributes = [])
/**
* Get a new query for builder filtered by the current models object classes.
*/
#[\Override]
public function newQuery(): Builder
{
$query = $this->registerModelScopes(
Expand Down
1 change: 1 addition & 0 deletions app/Auth/Local/LocalProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class LocalProvider extends EloquentUserProvider implements UserProvider
*
* @return \Illuminate\Contracts\Auth\Authenticatable|null
*/
#[\Override]
public function retrieveByCredentials(array $credentials)
{
$email = $credentials['email'] ?? null;
Expand Down
4 changes: 2 additions & 2 deletions app/Auth/Shibboleth/ShibbolethController.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ public function callback(Request $request)
{
try {
$user = $this->provider->login($request);
} catch (MissingAttributeException $e) {
} catch (MissingAttributeException) {
return redirect('/external_login?error=missing_attributes');
} catch (ShibbolethSessionDuplicateException $e) {
} catch (ShibbolethSessionDuplicateException) {
// Prevented login attempt with duplicate shibboleth session, redirect to logout to kill SP session
return redirect($this->provider->logout(url('/external_login?error=shibboleth_session_duplicate_exception')));
}
Expand Down
2 changes: 1 addition & 1 deletion app/Auth/Shibboleth/ShibbolethProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ public function login(Request $request)

public function hashShibbolethSessionId($shibbolethSessionId)
{
return hash('sha256', $shibbolethSessionId);
return hash('sha256', (string) $shibbolethSessionId);
}
}
5 changes: 2 additions & 3 deletions app/Auth/Shibboleth/ShibbolethServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@ class ShibbolethServiceProvider extends ServiceProvider
/**
* Register the Shibboleth provider.
*/
#[\Override]
public function register(): void
{
$this->app->singleton(ShibbolethProvider::class, function (Application $app) {
return new ShibbolethProvider;
});
$this->app->singleton(fn (Application $app): \App\Auth\Shibboleth\ShibbolethProvider => new ShibbolethProvider);
}
}
2 changes: 1 addition & 1 deletion app/Console/Commands/CheckDatabaseConnectionCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
$this->info('Successfully connected to the database.');

return 0;
} catch (Exception $e) {
} catch (Exception) {

Check warning on line 35 in app/Console/Commands/CheckDatabaseConnectionCommand.php

View check run for this annotation

Codecov / codecov/patch

app/Console/Commands/CheckDatabaseConnectionCommand.php#L35

Added line #L35 was not covered by tests
$this->error('Connecting to the database failed.');

return 1;
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/CleanupRecordingsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function handle()
if ($retentionPeriod != TimePeriod::UNLIMITED) {
$day = now()->subDays($retentionPeriod->value)->toDateString();
Log::info('Removing recordings data older than '.$day);
Recording::where('start', '<', $day)->get()->each(function ($recording) {
Recording::where('start', '<', $day)->get()->each(function ($recording): void {
$recording->delete();
});
}
Expand Down
6 changes: 3 additions & 3 deletions app/Console/Commands/CleanupRoomsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public function handle()
->join('users', 'rooms.user_id', '=', 'users.id')
->select('rooms.id')
->whereNull('delete_inactive')
->where(function ($query) use ($neverUsedPeriod, $inactivePeriod, $createdDate, $lastStartDate) {
$query->where(function ($query) use ($inactivePeriod, $lastStartDate) {
->where(function ($query) use ($neverUsedPeriod, $inactivePeriod, $createdDate, $lastStartDate): void {
$query->where(function ($query) use ($inactivePeriod, $lastStartDate): void {
if ($inactivePeriod != TimePeriod::UNLIMITED) {
$query->where('meetings.start', '<', $lastStartDate);
}
})
->orWhere(function ($query) use ($neverUsedPeriod, $createdDate) {
->orWhere(function ($query) use ($neverUsedPeriod, $createdDate): void {
if ($neverUsedPeriod != TimePeriod::UNLIMITED) {
$query->where('rooms.created_at', '<', $createdDate)
->whereNull('meetings.start');
Expand Down
4 changes: 2 additions & 2 deletions app/Console/Commands/DeleteObsoleteTokensCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ public function handle()

if ($expireDuration != TimePeriod::UNLIMITED) {
$expiredTokens = RoomToken::query()
->where(function ($query) use ($expireDuration) {
->where(function ($query) use ($expireDuration): void {
$query->whereNull('last_usage')
->where('created_at', '<', Carbon::now()->subDays($expireDuration->value));
})
->orWhere(function ($query) use ($expireDuration) {
->orWhere(function ($query) use ($expireDuration): void {
$query->whereNotNull('last_usage')
->where('last_usage', '<', Carbon::now()->subDays($expireDuration->value));
})
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function handle()
$this->bar = $this->output->createProgressBar(100);

// Run command and show output in realtime
$process = Process::forever()->start($command, function (string $type, string $output) {
$process = Process::forever()->start($command, function (string $type, string $output): void {
if (Str::contains($output, 'ERROR')) {
$this->bar->clear();
$this->error($output);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportGreenlight2Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ protected function importRooms(Collection $rooms, int $roomType, array $userMap,
// walk through all found greenlight rooms
foreach ($rooms as $room) {
// convert room settings from json string to object
$room->room_settings = json_decode($room->room_settings);
$room->room_settings = json_decode((string) $room->room_settings);

// check if a room with the same id exists
$dbRoom = Room::find($room->uid);
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/ImportLocalesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
// Delete all old php locales files
$localeFiles = $disk->files($lang['code']);
foreach ($localeFiles as $localeFile) {
$path_parts = pathinfo($localeFile);
$path_parts = pathinfo((string) $localeFile);

Check warning on line 91 in app/Console/Commands/ImportLocalesCommand.php

View check run for this annotation

Codecov / codecov/patch

app/Console/Commands/ImportLocalesCommand.php#L91

Added line #L91 was not covered by tests

if ($path_parts['extension'] == 'php') {
$disk->delete($localeFile);
Expand Down
4 changes: 1 addition & 3 deletions app/Console/Commands/UpgradeDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ public function handle()

$this->info('Migrating old application settings');
$this->info('Overview of old settings:');
$this->table(['Key', 'Value'], collect($oldSettings)->map(function ($value, $key) {
return [$key, $value];
}));
$this->table(['Key', 'Value'], collect($oldSettings)->map(fn ($value, $key) => [$key, $value]));

// Apply old settings to new settings
$generalSettings = app(GeneralSettings::class);
Expand Down
2 changes: 2 additions & 0 deletions app/Console/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
/**
* Define the application's command schedule.
*/
#[\Override]

Check warning on line 42 in app/Console/Kernel.php

View check run for this annotation

Codecov / codecov/patch

app/Console/Kernel.php#L42

Added line #L42 was not covered by tests
protected function schedule(Schedule $schedule): void
{
$schedule->command(PollServerCommand::class)->everyMinute()->onOneServer();
Expand All @@ -56,6 +57,7 @@
/**
* Register the commands for the application.
*/
#[\Override]
protected function commands(): void
{
$this->load(__DIR__.'/Commands');
Expand Down
2 changes: 2 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Handler extends ExceptionHandler
*
* @throws \Exception
*/
#[\Override]
public function report(Throwable $exception)
{
parent::report($exception);
Expand All @@ -57,6 +58,7 @@ public function report(Throwable $exception)
/**
* Register the exception handling callbacks for the application.
*/
#[\Override]
public function register(): void
{
$this->reportable(function (Throwable $e) {
Expand Down
18 changes: 2 additions & 16 deletions app/Exports/AttendanceExport.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,13 @@
*/
class AttendanceExport implements FromCollection, ShouldAutoSize, WithHeadings, WithMapping, WithStyles
{
/**
* @var Meeting Meeting the attendance should be exported for
*/
private $meeting;

/**
* @var string Timezone the datetimes should be shown in
*/
private $timezone;

/**
* AttendanceExport constructor.
*
* @param Meeting $meeting Meeting the attendance should be exported for
* @param string $timezone Timezone the datetimes should be shown in
*/
public function __construct(Meeting $meeting, string $timezone)
{
$this->meeting = $meeting;
$this->timezone = $timezone;
}
public function __construct(private readonly Meeting $meeting, private readonly string $timezone) {}

/**
* Collection of the data to export into the excel file
Expand All @@ -46,7 +32,7 @@ public function __construct(Meeting $meeting, string $timezone)
*/
public function collection()
{
return (new MeetingService($this->meeting))->attendance();
return new MeetingService($this->meeting)->attendance();
}

/**
Expand Down
12 changes: 4 additions & 8 deletions app/Http/Controllers/RecordingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,10 @@ public function download(Recording $recording)

// Get all files in the recording directory, remove the root folder and filter the files by the whitelist
$files = Collection::make(Storage::disk('recordings')->allFiles($recording->id))
->map(function (string $filename) use ($recording) {
return explode($recording->id.'/', $filename, 2)[1];
})
->filter(function (string $filename) {
return preg_match('/'.config('recording.download_allowlist').'/', $filename);
});

$response = new StreamedResponse(function () use ($recording, $files) {
->map(fn (string $filename) => explode($recording->id.'/', $filename, 2)[1])
->filter(fn (string $filename) => preg_match('/'.config('recording.download_allowlist').'/', $filename));

$response = new StreamedResponse(function () use ($recording, $files): void {
// create a new zip stream
$zip = new ZipStream(
outputName: __('rooms.recordings.filename').'_'.$recording->start->format('Y-m-d').'.zip',
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/api/v1/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ public function config()
*/
public function currentUser()
{
return (new UserResource(Auth::user()))->withPermissions()->withoutRoles();
return new UserResource(Auth::user())->withPermissions()->withoutRoles();
}
}
8 changes: 4 additions & 4 deletions app/Http/Controllers/api/v1/MeetingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ public function index(Request $request)
if ($request->has('search') && trim($request->search) != '') {
$searchQueries = explode(' ', preg_replace('/\s\s+/', ' ', $request->search));
foreach ($searchQueries as $searchQuery) {
$resource = $resource->where(function ($query) use ($searchQuery) {
$query->whereHas('room', function ($subQuery) use ($searchQuery) {
$resource = $resource->where(function ($query) use ($searchQuery): void {
$query->whereHas('room', function ($subQuery) use ($searchQuery): void {
$subQuery->whereLike('name', '%'.$searchQuery.'%');
})
->orWhereHas('room.owner', function ($subQuery) use ($searchQuery) {
->orWhereHas('room.owner', function ($subQuery) use ($searchQuery): void {
$subQuery->whereLike('firstname', '%'.$searchQuery.'%')
->orWhereLike('lastname', '%'.$searchQuery.'%');
})
->orWhereHas('server', function ($subQuery) use ($searchQuery) {
->orWhereHas('server', function ($subQuery) use ($searchQuery): void {
$subQuery->whereLike('name', '%'.$searchQuery.'%');
});
});
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/api/v1/PermissionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class PermissionController extends Controller
*/
public function index()
{
return (new PermissionResourceCollection(Permission::all()))->additional([
return new PermissionResourceCollection(Permission::all())->additional([
'meta' => [
'restrictions' => config('permissions.restrictions'),
],
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/api/v1/RecordingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function index(Room $room, Request $request)
$allowedAccess[] = RecordingAccess::PARTICIPANT;
}

$resource = $resource->whereIn('access', $allowedAccess)->whereHas('formats', function (Builder $query) {
$resource = $resource->whereIn('access', $allowedAccess)->whereHas('formats', function (Builder $query): void {
$query->where('disabled', false);
});
}
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/api/v1/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function store(RoleRequest $request)

$role->permissions()->sync($new_permissions);

return (new RoleResource($role))->withPermissions();
return new RoleResource($role)->withPermissions();
}

/**
Expand All @@ -92,7 +92,7 @@ public function store(RoleRequest $request)
*/
public function show(Role $role)
{
return (new RoleResource($role))->withPermissions();
return new RoleResource($role)->withPermissions();
}

/**
Expand Down Expand Up @@ -133,7 +133,7 @@ public function update(RoleRequest $request, Role $role)
$role->name = $request->name;
$role->save();

return (new RoleResource($role))->withPermissions();
return new RoleResource($role)->withPermissions();
}

/**
Expand Down
Loading
Loading