diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs
deleted file mode 100644
index 1eda14f3..00000000
--- a/.git-blame-ignore-revs
+++ /dev/null
@@ -1,10 +0,0 @@
-# Set native parameter types
-2b88322c0c1dcab3b0dd064ad880b0f31645da49
-# Set native return types
-aff8826c9941d3f18984dcd4f220dd25ad547f42
-# Set native property types
-b004f865b42886738d90f9915c1cccfcc3599322
-# Use constructor property promotion
-984f8038d3ab096b6018a2df084fd158644bc080
-# Add useless comment phpcs sniff
-c1d350f2b122ff7dff0c3a0ed2b3c0a515c176f6
diff --git a/.phpcs.xml b/.phpcs.xml
index 1b955614..9cc54c66 100644
--- a/.phpcs.xml
+++ b/.phpcs.xml
@@ -39,4 +39,5 @@
+
diff --git a/config/config.default.php b/config/config.default.php
index ce261089..66a8b287 100644
--- a/config/config.default.php
+++ b/config/config.default.php
@@ -15,7 +15,7 @@ return [
'api_key' => '',
// Enable maintenance mode (show a static page)
- 'maintenance' => (bool)env('MAINTENANCE', false),
+ 'maintenance' => (bool) env('MAINTENANCE', false),
// Application name (not the event name)
'app_name' => env('APP_NAME', 'Engelsystem'),
@@ -220,13 +220,13 @@ return [
'display_news' => env('DISPLAY_NEWS', 10),
// Users are able to sign up
- 'registration_enabled' => (bool)env('REGISTRATION_ENABLED', true),
+ 'registration_enabled' => (bool) env('REGISTRATION_ENABLED', true),
// Only arrived angels can sign up for shifts
- 'signup_requires_arrival' => (bool)env('SIGNUP_REQUIRES_ARRIVAL', false),
+ 'signup_requires_arrival' => (bool) env('SIGNUP_REQUIRES_ARRIVAL', false),
// Whether newly-registered user should automatically be marked as arrived
- 'autoarrive' => (bool)env('ANGEL_AUTOARRIVE', false),
+ 'autoarrive' => (bool) env('ANGEL_AUTOARRIVE', false),
// Only allow shift signup this number of hours in advance
// Setting this to 0 disables the feature
@@ -256,31 +256,31 @@ return [
// Whether the Password field should be enabled on registration.
// This is useful when using oauth, disabling it also disables normal
// registration without oauth.
- 'enable_password' => (bool)env('ENABLE_PASSWORD', true),
+ 'enable_password' => (bool) env('ENABLE_PASSWORD', true),
// Whether the DECT field should be enabled
- 'enable_dect' => (bool)env('ENABLE_DECT', true),
+ 'enable_dect' => (bool) env('ENABLE_DECT', true),
// Whether the mobile number can be shown to other users
- 'enable_mobile_show' => (bool)env('ENABLE_MOBILE_SHOW', false),
+ 'enable_mobile_show' => (bool) env('ENABLE_MOBILE_SHOW', false),
// Enables prename and lastname
- 'enable_user_name' => (bool)env('ENABLE_USER_NAME', false),
+ 'enable_user_name' => (bool) env('ENABLE_USER_NAME', false),
// Enable displaying the pronoun fields
- 'enable_pronoun' => (bool)env('ENABLE_PRONOUN', true),
+ 'enable_pronoun' => (bool) env('ENABLE_PRONOUN', true),
// Enables the planned arrival/leave date
- 'enable_planned_arrival' => (bool)env('ENABLE_PLANNED_ARRIVAL', true),
+ 'enable_planned_arrival' => (bool) env('ENABLE_PLANNED_ARRIVAL', true),
// Enables the T-Shirt configuration on signup and profile
- 'enable_tshirt_size' => (bool)env('ENABLE_TSHIRT_SIZE', true),
+ 'enable_tshirt_size' => (bool) env('ENABLE_TSHIRT_SIZE', true),
// Enables the goody configuration on signup and profile
- 'enable_goody' => (bool)env('ENABLE_GOODY', false),
+ 'enable_goody' => (bool) env('ENABLE_GOODY', false),
// Enables the food voucher in the user profile
- 'enable_voucher' => (bool)env('ENABLE_VOUCHER', true),
+ 'enable_voucher' => (bool) env('ENABLE_VOUCHER', true),
// Number of shifts to freeload until angel is locked for shift signup.
'max_freeloadable_shifts' => env('MAX_FREELOADABLE_SHIFTS', 2),
@@ -293,7 +293,7 @@ return [
// Multiply 'night shifts' and freeloaded shifts (start or end between 2 and 6 exclusive) by 2
'night_shifts' => [
- 'enabled' => (bool)env('NIGHT_SHIFTS', true), // Disable to weigh every shift the same
+ 'enabled' => (bool) env('NIGHT_SHIFTS', true), // Disable to weigh every shift the same
'start' => env('NIGHT_SHIFTS_START', 2),
'end' => env('NIGHT_SHIFTS_END', 6),
'multiplier' => env('NIGHT_SHIFTS_MULTIPLIER', 2),
@@ -359,7 +359,7 @@ return [
'trusted_proxies' => env('TRUSTED_PROXIES', ['127.0.0.0/8', '::ffff:127.0.0.0/8', '::1/128']),
// Add additional headers
- 'add_headers' => (bool)env('ADD_HEADERS', true),
+ 'add_headers' => (bool) env('ADD_HEADERS', true),
'headers' => [
'X-Content-Type-Options' => 'nosniff',
'X-Frame-Options' => 'sameorigin',
diff --git a/db/factories/User/StateFactory.php b/db/factories/User/StateFactory.php
index 7e69dc33..9d207058 100644
--- a/db/factories/User/StateFactory.php
+++ b/db/factories/User/StateFactory.php
@@ -16,7 +16,7 @@ class StateFactory extends Factory
$arrival = $this->faker->optional()->dateTimeThisMonth();
return [
- 'arrived' => (bool)$arrival,
+ 'arrived' => (bool) $arrival,
'arrival_date' => $arrival ? Carbon::instance($arrival) : null,
'active' => $this->faker->boolean(.3),
'force_active' => $this->faker->boolean(.1),
diff --git a/db/migrations/2018_09_24_000000_create_event_config_table.php b/db/migrations/2018_09_24_000000_create_event_config_table.php
index 71501a30..ef4167df 100644
--- a/db/migrations/2018_09_24_000000_create_event_config_table.php
+++ b/db/migrations/2018_09_24_000000_create_event_config_table.php
@@ -114,7 +114,7 @@ class CreateEventConfigTable extends Migration
protected function getConfigValue(Collection $config, string $name): mixed
{
- $value = $config->where('name', $name)->first('value', (object)['value' => null])->value;
+ $value = $config->where('name', $name)->first('value', (object) ['value' => null])->value;
return $value ? json_decode($value, true) : null;
}
diff --git a/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php b/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php
index 2a86b651..84739537 100644
--- a/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php
+++ b/db/migrations/2018_12_27_000000_fix_missing_arrival_dates.php
@@ -29,7 +29,7 @@ class FixMissingArrivalDates extends Migration
->first();
$state->arrival_date = $personalData->planned_arrival_date;
$connection->table('users_state')
- ->update((array)$state);
+ ->update((array) $state);
}
}
diff --git a/db/migrations/2022_11_08_000000_create_angel_types_table.php b/db/migrations/2022_11_08_000000_create_angel_types_table.php
index 724a656f..2dfb2740 100644
--- a/db/migrations/2022_11_08_000000_create_angel_types_table.php
+++ b/db/migrations/2022_11_08_000000_create_angel_types_table.php
@@ -49,9 +49,9 @@ class CreateAngelTypesTable extends Migration
'name' => $record->name,
'description' => $record->description,
- 'contact_name' => (string)$record->contact_name,
- 'contact_dect' => (string)$record->contact_dect,
- 'contact_email' => (string)$record->contact_email,
+ 'contact_name' => (string) $record->contact_name,
+ 'contact_dect' => (string) $record->contact_dect,
+ 'contact_email' => (string) $record->contact_email,
'restricted' => $record->restricted,
'requires_driver_license' => $record->requires_driver_license,
diff --git a/db/migrations/2022_11_28_000000_create_user_angel_types_table.php b/db/migrations/2022_11_28_000000_create_user_angel_types_table.php
index 1d61853b..c979031e 100644
--- a/db/migrations/2022_11_28_000000_create_user_angel_types_table.php
+++ b/db/migrations/2022_11_28_000000_create_user_angel_types_table.php
@@ -44,7 +44,7 @@ class CreateUserAngelTypesTable extends Migration
'user_id' => $record->user_id,
'angel_type_id' => $record->angeltype_id,
'confirm_user_id' => $record->confirm_user_id ?: null,
- 'supporter' => (bool)$record->supporter,
+ 'supporter' => (bool) $record->supporter,
]);
}
@@ -84,7 +84,7 @@ class CreateUserAngelTypesTable extends Migration
'user_id' => $record->user_id,
'angeltype_id' => $record->angel_type_id,
'confirm_user_id' => $record->confirm_user_id ?: null,
- 'supporter' => (bool)$record->supporter,
+ 'supporter' => (bool) $record->supporter,
]);
}
diff --git a/includes/controller/angeltypes_controller.php b/includes/controller/angeltypes_controller.php
index 2bb95d53..3b01f9de 100644
--- a/includes/controller/angeltypes_controller.php
+++ b/includes/controller/angeltypes_controller.php
@@ -67,7 +67,7 @@ function angeltypes_about_controller()
return [
__('Teams/Job description'),
- AngelTypes_about_view($angeltypes, (bool)$user)
+ AngelTypes_about_view($angeltypes, (bool) $user)
];
}
diff --git a/includes/controller/shifts_controller.php b/includes/controller/shifts_controller.php
index b3a10de5..2b1fd26d 100644
--- a/includes/controller/shifts_controller.php
+++ b/includes/controller/shifts_controller.php
@@ -248,7 +248,7 @@ function shift_delete_controller()
'title' => $shift['title'],
'type' => $type->name,
'room' => $room,
- 'freeloaded' => (bool)$entry['freeloaded'],
+ 'freeloaded' => (bool) $entry['freeloaded'],
]);
}
diff --git a/includes/model/ShiftEntry_model.php b/includes/model/ShiftEntry_model.php
index 0c6d35f9..896d184d 100644
--- a/includes/model/ShiftEntry_model.php
+++ b/includes/model/ShiftEntry_model.php
@@ -20,7 +20,7 @@ function ShiftEntries_freeloaded_count()
return 0;
}
- return (int)array_shift($result);
+ return (int) array_shift($result);
}
/**
@@ -81,7 +81,7 @@ function ShiftEntry_create($shift_entry)
$shift_entry['UID'],
$shift_entry['Comment'],
$shift_entry['freeload_comment'],
- (int)$shift_entry['freeloaded'],
+ (int) $shift_entry['freeloaded'],
]
);
engelsystem_log(
@@ -117,7 +117,7 @@ function ShiftEntry_update($shift_entry)
[
$shift_entry['Comment'],
$shift_entry['freeload_comment'],
- (int)$shift_entry['freeloaded'],
+ (int) $shift_entry['freeloaded'],
$shift_entry['id']
]
);
diff --git a/includes/pages/admin_groups.php b/includes/pages/admin_groups.php
index 68287ba4..80395946 100644
--- a/includes/pages/admin_groups.php
+++ b/includes/pages/admin_groups.php
@@ -59,7 +59,7 @@ function admin_groups()
switch ($request->input('action')) {
case 'edit':
if ($request->has('id')) {
- $group_id = (int)$request->input('id');
+ $group_id = (int) $request->input('id');
} else {
return error('Incomplete call, missing Groups ID.', true);
}
@@ -96,7 +96,7 @@ function admin_groups()
$request->has('id')
&& $request->hasPostData('submit')
) {
- $group_id = (int)$request->input('id');
+ $group_id = (int) $request->input('id');
} else {
return error('Incomplete call, missing Groups ID.', true);
}
diff --git a/includes/pages/admin_rooms.php b/includes/pages/admin_rooms.php
index a3af8731..2c46f36d 100644
--- a/includes/pages/admin_rooms.php
+++ b/includes/pages/admin_rooms.php
@@ -200,7 +200,7 @@ function admin_rooms()
'title' => $shift['title'],
'type' => $type->name,
'room' => $room,
- 'freeloaded' => (bool)$entry['freeloaded'],
+ 'freeloaded' => (bool) $entry['freeloaded'],
]);
}
}
diff --git a/includes/pages/admin_shifts.php b/includes/pages/admin_shifts.php
index 7f39f502..25e73eba 100644
--- a/includes/pages/admin_shifts.php
+++ b/includes/pages/admin_shifts.php
@@ -207,9 +207,9 @@ function admin_shifts()
'description' => $description,
];
} elseif ($mode == 'multi') {
- $shift_start = (int)$start;
+ $shift_start = (int) $start;
do {
- $shift_end = $shift_start + (int)$length * 60;
+ $shift_end = $shift_start + (int) $length * 60;
if ($shift_end > $end) {
$shift_end = $end;
@@ -571,7 +571,7 @@ function admin_shifts_history(): string
'title' => $shift['title'],
'type' => $type->name,
'room' => $room,
- 'freeloaded' => (bool)$entry['freeloaded'],
+ 'freeloaded' => (bool) $entry['freeloaded'],
]);
}
diff --git a/includes/pages/schedule/ImportSchedule.php b/includes/pages/schedule/ImportSchedule.php
index 6fa1284a..d63edbc7 100644
--- a/includes/pages/schedule/ImportSchedule.php
+++ b/includes/pages/schedule/ImportSchedule.php
@@ -390,7 +390,7 @@ class ImportSchedule extends BaseController
*/
protected function getScheduleData(Request $request)
{
- $scheduleId = (int)$request->getAttribute('schedule_id');
+ $scheduleId = (int) $request->getAttribute('schedule_id');
/** @var ScheduleUrl $scheduleUrl */
$scheduleUrl = ScheduleUrl::findOrFail($scheduleId);
@@ -405,7 +405,7 @@ class ImportSchedule extends BaseController
throw new ErrorException('schedule.import.request-error');
}
- $scheduleData = (string)$scheduleResponse->getBody();
+ $scheduleData = (string) $scheduleResponse->getBody();
if (!$this->parser->load($scheduleData)) {
throw new ErrorException('schedule.import.read-error');
}
diff --git a/includes/pages/user_atom.php b/includes/pages/user_atom.php
index e21a13c4..71505d81 100644
--- a/includes/pages/user_atom.php
+++ b/includes/pages/user_atom.php
@@ -25,9 +25,9 @@ function user_atom()
throw new HttpForbidden('Not allowed', ['content-type' => 'text/text']);
}
- $news = $request->has('meetings') ? News::whereIsMeeting((bool)$request->get('meetings', false)) : News::query();
+ $news = $request->has('meetings') ? News::whereIsMeeting((bool) $request->get('meetings', false)) : News::query();
$news
- ->limit((int)config('display_news'))
+ ->limit((int) config('display_news'))
->orderByDesc('updated_at');
$output = make_atom_entries_from_news($news->get());
diff --git a/includes/sys_form.php b/includes/sys_form.php
index ea4d7b87..ddcd4ab4 100644
--- a/includes/sys_form.php
+++ b/includes/sys_form.php
@@ -12,7 +12,7 @@ use Carbon\Carbon;
*/
function form_hidden($name, $value)
{
- return '';
+ return '';
}
/**
@@ -65,7 +65,7 @@ function form_date($name, $label, $value, $start_date = '', $end_date = '')
return form_element(
$label,
- '',
+ '',
$dom_id
);
}
@@ -128,7 +128,7 @@ function form_checkbox($name, $label, $selected, $value = 'checked', $html_id =
}
return '
'
- . '
';
@@ -145,7 +145,7 @@ function form_checkbox($name, $label, $selected, $value = 'checked', $html_id =
*/
function form_radio($name, $label, $selected, $value)
{
- $value = htmlspecialchars((string)$value);
+ $value = htmlspecialchars((string) $value);
$id = preg_replace('/\s/', '-', $name . '_' . $value);
return ''
@@ -216,7 +216,7 @@ function form_submit($name, $label, $class = '', $wrapForm = true, $buttonType =
function form_text($name, $label, $value, $disabled = false, $maxlength = null, $autocomplete = null, $class = '', $data_attributes = [])
{
$disabled = $disabled ? ' disabled="disabled"' : '';
- $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
+ $maxlength = $maxlength ? ' maxlength=' . (int) $maxlength : '';
$autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : '';
$attr = '';
foreach ($data_attributes as $attr_key => $attr_value) {
@@ -226,7 +226,7 @@ function form_text($name, $label, $value, $disabled = false, $maxlength = null,
return form_element(
$label,
'',
+ . '" value="' . htmlspecialchars((string) $value) . '"' . $maxlength . $disabled . $autocomplete . $attr . '/>',
'form_' . $name,
$class
);
@@ -247,7 +247,7 @@ function form_text_placeholder($name, $placeholder, $value, $disabled = false)
return form_element(
'',
''
);
}
@@ -268,11 +268,11 @@ function form_email($name, $label, $value, $disabled = false, $autocomplete = nu
{
$disabled = $disabled ? ' disabled="disabled"' : '';
$autocomplete = $autocomplete ? ' autocomplete="' . $autocomplete . '"' : '';
- $maxlength = $maxlength ? ' maxlength=' . (int)$maxlength : '';
+ $maxlength = $maxlength ? ' maxlength=' . (int) $maxlength : '';
return form_element(
$label,
'',
+ . htmlspecialchars((string) $value) . '" ' . $disabled . $autocomplete . $maxlength . '/>',
'form_' . $name
);
}
@@ -352,7 +352,7 @@ function form_textarea($name, $label, $value, $disabled = false)
return form_element(
$label,
'',
+ . $name . '" ' . $disabled . '>' . htmlspecialchars((string) $value) . '',
'form_' . $name
);
}
diff --git a/includes/sys_menu.php b/includes/sys_menu.php
index 4c4b3a51..135179f9 100644
--- a/includes/sys_menu.php
+++ b/includes/sys_menu.php
@@ -104,7 +104,7 @@ function make_navigation()
continue;
}
- $title = ((array)$options)[0];
+ $title = ((array) $options)[0];
$menu[] = toolbar_item_link(page_link_to($menu_page), '', $title, $menu_page == $page);
}
@@ -137,7 +137,7 @@ function make_navigation()
continue;
}
- $title = ((array)$options)[0];
+ $title = ((array) $options)[0];
$admin_menu[] = toolbar_dropdown_item(
page_link_to($menu_page),
__($title),
@@ -160,7 +160,7 @@ function make_navigation()
*/
function menu_is_allowed(string $page, $options)
{
- $options = (array)$options;
+ $options = (array) $options;
$permissions = $page;
if (isset($options[1])) {
diff --git a/includes/sys_page.php b/includes/sys_page.php
index 9d8a591a..b5760104 100644
--- a/includes/sys_page.php
+++ b/includes/sys_page.php
@@ -266,5 +266,5 @@ function check_email($email)
$domain = idn_to_ascii($domain, IDNA_DEFAULT, INTL_IDNA_VARIANT_UTS46);
$email = $name . '@' . $domain;
}
- return (bool)filter_var($email, FILTER_VALIDATE_EMAIL);
+ return (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
}
diff --git a/includes/view/Shifts_view.php b/includes/view/Shifts_view.php
index ce8b1fdc..24a9cfbc 100644
--- a/includes/view/Shifts_view.php
+++ b/includes/view/Shifts_view.php
@@ -188,7 +188,7 @@ function Shift_view($shift, ShiftType $shifttype, Room $room, $angeltypes_source
div('col-sm-6', [
'
' . __('Description') . '
',
$parsedown->parse($shifttype->description),
- $parsedown->parse((string)$shift['description']),
+ $parsedown->parse((string) $shift['description']),
])
]);
diff --git a/src/Controllers/Admin/QuestionsController.php b/src/Controllers/Admin/QuestionsController.php
index 59164bbd..bb17a337 100644
--- a/src/Controllers/Admin/QuestionsController.php
+++ b/src/Controllers/Admin/QuestionsController.php
@@ -62,7 +62,7 @@ class QuestionsController extends BaseController
public function edit(Request $request): Response
{
- $questionId = (int)$request->getAttribute('question_id');
+ $questionId = (int) $request->getAttribute('question_id');
$questions = $this->question->find($questionId);
@@ -71,7 +71,7 @@ class QuestionsController extends BaseController
public function save(Request $request): Response
{
- $questionId = (int)$request->getAttribute('question_id');
+ $questionId = (int) $request->getAttribute('question_id');
/** @var Question $question */
$question = $this->question->findOrNew($questionId);
diff --git a/src/Controllers/Admin/UserShirtController.php b/src/Controllers/Admin/UserShirtController.php
index 78c84b12..ebc94c85 100644
--- a/src/Controllers/Admin/UserShirtController.php
+++ b/src/Controllers/Admin/UserShirtController.php
@@ -34,7 +34,7 @@ class UserShirtController extends BaseController
public function editShirt(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
+ $userId = (int) $request->getAttribute('user_id');
$user = $this->user->findOrFail($userId);
@@ -46,7 +46,7 @@ class UserShirtController extends BaseController
public function saveShirt(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
+ $userId = (int) $request->getAttribute('user_id');
/** @var User $user */
$user = $this->user->findOrFail($userId);
@@ -64,11 +64,11 @@ class UserShirtController extends BaseController
}
if ($this->auth->can('admin_arrive')) {
- $user->state->arrived = (bool)$data['arrived'];
+ $user->state->arrived = (bool) $data['arrived'];
}
- $user->state->active = (bool)$data['active'];
- $user->state->got_shirt = (bool)$data['got_shirt'];
+ $user->state->active = (bool) $data['active'];
+ $user->state->got_shirt = (bool) $data['got_shirt'];
$user->state->save();
$this->log->info(
diff --git a/src/Controllers/Admin/UserWorkLogController.php b/src/Controllers/Admin/UserWorkLogController.php
index fd76122c..3e62467a 100644
--- a/src/Controllers/Admin/UserWorkLogController.php
+++ b/src/Controllers/Admin/UserWorkLogController.php
@@ -37,13 +37,13 @@ class UserWorkLogController extends BaseController
public function editWorklog(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
+ $userId = (int) $request->getAttribute('user_id');
$worklogId = $request->getAttribute('worklog_id'); // optional
$user = $this->user->findOrFail($userId);
if (isset($worklogId)) {
- $worklog = $this->worklog->findOrFail((int)$worklogId);
+ $worklog = $this->worklog->findOrFail((int) $worklogId);
if ($worklog->user->id != $userId) {
throw new HttpNotFound();
@@ -56,7 +56,7 @@ class UserWorkLogController extends BaseController
public function saveWorklog(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
+ $userId = (int) $request->getAttribute('user_id');
$worklogId = $request->getAttribute('worklog_id'); // optional
$user = $this->user->findOrFail($userId);
@@ -68,7 +68,7 @@ class UserWorkLogController extends BaseController
]);
if (isset($worklogId)) {
- $worklog = $this->worklog->findOrFail((int)$worklogId);
+ $worklog = $this->worklog->findOrFail((int) $worklogId);
if ($worklog->user->id != $userId) {
throw new HttpNotFound();
@@ -91,8 +91,8 @@ class UserWorkLogController extends BaseController
public function showDeleteWorklog(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
- $worklogId = (int)$request->getAttribute('worklog_id');
+ $userId = (int) $request->getAttribute('user_id');
+ $worklogId = (int) $request->getAttribute('worklog_id');
$user = $this->user->findOrFail($userId);
$worklog = $this->worklog->findOrFail($worklogId);
@@ -109,8 +109,8 @@ class UserWorkLogController extends BaseController
public function deleteWorklog(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
- $worklogId = (int)$request->getAttribute('worklog_id');
+ $userId = (int) $request->getAttribute('user_id');
+ $worklogId = (int) $request->getAttribute('worklog_id');
$worklog = $this->worklog->findOrFail($worklogId);
diff --git a/src/Controllers/MessagesController.php b/src/Controllers/MessagesController.php
index b527ab14..237b4836 100644
--- a/src/Controllers/MessagesController.php
+++ b/src/Controllers/MessagesController.php
@@ -94,7 +94,7 @@ class MessagesController extends BaseController
*/
public function messagesOfConversation(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
+ $userId = (int) $request->getAttribute('user_id');
$currentUser = $this->auth->user();
$otherUser = $this->user->findOrFail($userId);
@@ -132,7 +132,7 @@ class MessagesController extends BaseController
*/
public function send(Request $request): Response
{
- $userId = (int)$request->getAttribute('user_id');
+ $userId = (int) $request->getAttribute('user_id');
$currentUser = $this->auth->user();
@@ -156,8 +156,8 @@ class MessagesController extends BaseController
*/
public function delete(Request $request): Response
{
- $otherUserId = (int)$request->getAttribute('user_id');
- $msgId = (int)$request->getAttribute('msg_id');
+ $otherUserId = (int) $request->getAttribute('user_id');
+ $msgId = (int) $request->getAttribute('msg_id');
$currentUser = $this->auth->user();
$msg = $this->message->findOrFail($msgId);
diff --git a/src/Controllers/Metrics/MetricsEngine.php b/src/Controllers/Metrics/MetricsEngine.php
index 595d6a85..ecedeae1 100644
--- a/src/Controllers/Metrics/MetricsEngine.php
+++ b/src/Controllers/Metrics/MetricsEngine.php
@@ -152,7 +152,7 @@ class MetricsEngine implements EngineInterface
protected function formatValue(mixed $value): mixed
{
if (is_bool($value)) {
- return (int)$value;
+ return (int) $value;
}
return $this->escape($value);
diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php
index 254c3479..30852b1d 100644
--- a/src/Controllers/Metrics/Stats.php
+++ b/src/Controllers/Metrics/Stats.php
@@ -127,7 +127,7 @@ class Stats
public function vouchers(): int
{
- return (int)$this->vouchersQuery()->sum('got_voucher');
+ return (int) $this->vouchersQuery()->sum('got_voucher');
}
public function vouchersBuckets(array $buckets): array
@@ -232,7 +232,7 @@ class Stats
{
$query = $this->workSecondsQuery($done, $freeloaded);
- return (int)$query->sum($this->raw('end - start'));
+ return (int) $query->sum($this->raw('end - start'));
}
/**
@@ -285,7 +285,7 @@ class Stats
*/
public function worklogSeconds(): int
{
- return (int)Worklog::query()
+ return (int) Worklog::query()
->sum($this->raw('hours * 60 * 60'));
}
diff --git a/src/Controllers/NewsController.php b/src/Controllers/NewsController.php
index 39cbd88a..9c38657f 100644
--- a/src/Controllers/NewsController.php
+++ b/src/Controllers/NewsController.php
@@ -48,7 +48,7 @@ class NewsController extends BaseController
public function show(Request $request): Response
{
- $newsId = (int)$request->getAttribute('news_id');
+ $newsId = (int) $request->getAttribute('news_id');
$news = $this->news
->with('user')
@@ -60,7 +60,7 @@ class NewsController extends BaseController
public function comment(Request $request): Response
{
- $newsId = (int)$request->getAttribute('news_id');
+ $newsId = (int) $request->getAttribute('news_id');
$data = $this->validate($request, [
'comment' => 'required',
@@ -89,7 +89,7 @@ class NewsController extends BaseController
public function deleteComment(Request $request): Response
{
- $commentId = (int)$request->getAttribute('comment_id');
+ $commentId = (int) $request->getAttribute('comment_id');
$this->validate(
$request,
diff --git a/src/Controllers/OAuthController.php b/src/Controllers/OAuthController.php
index 8c7c5150..f79872d7 100644
--- a/src/Controllers/OAuthController.php
+++ b/src/Controllers/OAuthController.php
@@ -100,7 +100,7 @@ class OAuthController extends BaseController
->where('identifier', $resourceId)
->get()
// Explicit case sensitive comparison using PHP as some DBMS collations are case sensitive and some arent
- ->where('identifier', '===', (string)$resourceId)
+ ->where('identifier', '===', (string) $resourceId)
->first();
$expirationTime = $accessToken->getExpires();
diff --git a/src/Database/Db.php b/src/Database/Db.php
index fb6c531d..4a2629ca 100644
--- a/src/Database/Db.php
+++ b/src/Database/Db.php
@@ -30,7 +30,7 @@ class Db
// @TODO: Remove type casting
foreach ($return as $key => $value) {
- $return[$key] = (array)$value;
+ $return[$key] = (array) $value;
}
return $return;
@@ -46,7 +46,7 @@ class Db
$result = self::connection()->selectOne($query, $bindings);
// @TODO: remove typecast
- $result = (array)$result;
+ $result = (array) $result;
if (empty($result)) {
return null;
}
diff --git a/src/Database/Migration/Migrate.php b/src/Database/Migration/Migrate.php
index a3e0c3da..16a8134b 100644
--- a/src/Database/Migration/Migrate.php
+++ b/src/Database/Migration/Migrate.php
@@ -111,7 +111,7 @@ class Migrate
{
$return = $migrated;
$return->transform(function ($migration) use ($migrations) {
- $migration = (array)$migration;
+ $migration = (array) $migration;
if ($migrations->contains('migration', $migration['migration'])) {
$migration += $migrations
->where('migration', $migration['migration'])
diff --git a/src/Events/EventDispatcher.php b/src/Events/EventDispatcher.php
index 6873a273..9127d528 100644
--- a/src/Events/EventDispatcher.php
+++ b/src/Events/EventDispatcher.php
@@ -12,7 +12,7 @@ class EventDispatcher
public function listen(array|string $events, callable|string $listener): void
{
- foreach ((array)$events as $event) {
+ foreach ((array) $events as $event) {
$this->listeners[$event][] = $listener;
}
}
diff --git a/src/Events/EventsServiceProvider.php b/src/Events/EventsServiceProvider.php
index b324a101..13bffbcf 100644
--- a/src/Events/EventsServiceProvider.php
+++ b/src/Events/EventsServiceProvider.php
@@ -23,7 +23,7 @@ class EventsServiceProvider extends ServiceProvider
$config = $this->app->get('config');
foreach ($config->get('event-handlers', []) as $event => $handlers) {
- foreach ((array)$handlers as $handler) {
+ foreach ((array) $handlers as $handler) {
$dispatcher->listen($event, $handler);
}
}
diff --git a/src/Exceptions/Handlers/LegacyDevelopment.php b/src/Exceptions/Handlers/LegacyDevelopment.php
index 079ecc73..acea6c35 100644
--- a/src/Exceptions/Handlers/LegacyDevelopment.php
+++ b/src/Exceptions/Handlers/LegacyDevelopment.php
@@ -65,7 +65,7 @@ class LegacyDevelopment extends Legacy
private function getDisplayNameOfValue(mixed $arg): string
{
return match (gettype($arg)) {
- 'string', 'integer', 'double' => (string)$arg,
+ 'string', 'integer', 'double' => (string) $arg,
'boolean' => $arg ? 'true' : 'false',
'object' => get_class($arg),
'resource' => get_resource_type($arg), // @codeCoverageIgnore
diff --git a/src/Helpers/Authenticator.php b/src/Helpers/Authenticator.php
index 85ded406..e86ac938 100644
--- a/src/Helpers/Authenticator.php
+++ b/src/Helpers/Authenticator.php
@@ -88,7 +88,7 @@ class Authenticator
*/
public function can(array|string $abilities): bool
{
- $abilities = (array)$abilities;
+ $abilities = (array) $abilities;
if (empty($this->permissions)) {
$user = $this->user();
diff --git a/src/Helpers/ConfigureEnvironmentServiceProvider.php b/src/Helpers/ConfigureEnvironmentServiceProvider.php
index 04d8bd64..3a7d10d9 100644
--- a/src/Helpers/ConfigureEnvironmentServiceProvider.php
+++ b/src/Helpers/ConfigureEnvironmentServiceProvider.php
@@ -31,7 +31,7 @@ class ConfigureEnvironmentServiceProvider extends ServiceProvider
*/
protected function setTimeZone(CarbonTimeZone $timeZone): void
{
- ini_set('date.timezone', (string)$timeZone);
+ ini_set('date.timezone', (string) $timeZone);
date_default_timezone_set($timeZone);
}
diff --git a/src/Helpers/Schedule/XmlParser.php b/src/Helpers/Schedule/XmlParser.php
index 81e5284f..0a1bebe0 100644
--- a/src/Helpers/Schedule/XmlParser.php
+++ b/src/Helpers/Schedule/XmlParser.php
@@ -39,7 +39,7 @@ class XmlParser
$this->getFirstXpathContent('conference/acronym'),
$this->getFirstXpathContent('conference/start'),
$this->getFirstXpathContent('conference/end'),
- (int)$this->getFirstXpathContent('conference/days'),
+ (int) $this->getFirstXpathContent('conference/days'),
$this->getFirstXpathContent('conference/timeslot_duration'),
$this->getFirstXpathContent('conference/base_url')
);
@@ -50,7 +50,7 @@ class XmlParser
foreach ($day->xpath('room') as $roomElement) {
$room = new Room(
- (string)$roomElement->attributes()['name']
+ (string) $roomElement->attributes()['name']
);
$events = $this->parseEvents($roomElement->xpath('event'), $room);
@@ -59,10 +59,10 @@ class XmlParser
}
$days[] = new Day(
- (string)$day->attributes()['date'],
+ (string) $day->attributes()['date'],
new Carbon($day->attributes()['start']),
new Carbon($day->attributes()['end']),
- (int)$day->attributes()['index'],
+ (int) $day->attributes()['index'],
$rooms
);
}
@@ -93,8 +93,8 @@ class XmlParser
}
$events[] = new Event(
- (string)$event->attributes()['guid'],
- (int)$event->attributes()['id'],
+ (string) $event->attributes()['guid'],
+ (int) $event->attributes()['id'],
$room,
$this->getFirstXpathContent('title', $event),
$this->getFirstXpathContent('subtitle', $event),
@@ -124,7 +124,7 @@ class XmlParser
{
$element = ($xml ?: $this->scheduleXML)->xpath($path);
- return $element ? (string)$element[0] : '';
+ return $element ? (string) $element[0] : '';
}
/**
@@ -140,7 +140,7 @@ class XmlParser
foreach ($element->xpath($firstElement) as $element) {
foreach ($element->xpath($secondElement) as $item) {
- $items[(string)$item->attributes()[$idAttribute]] = (string)$item;
+ $items[(string) $item->attributes()[$idAttribute]] = (string) $item;
}
}
diff --git a/src/Http/SessionServiceProvider.php b/src/Http/SessionServiceProvider.php
index 0c04beb5..ee90564c 100644
--- a/src/Http/SessionServiceProvider.php
+++ b/src/Http/SessionServiceProvider.php
@@ -58,7 +58,7 @@ class SessionServiceProvider extends ServiceProvider
'options' => [
'cookie_httponly' => true,
'name' => $sessionConfig['name'],
- 'cookie_lifetime' => (int)($sessionConfig['lifetime'] * 24 * 60 * 60),
+ 'cookie_lifetime' => (int) ($sessionConfig['lifetime'] * 24 * 60 * 60),
],
'handler' => $handler,
]);
diff --git a/src/Http/Validation/ValidatesRequest.php b/src/Http/Validation/ValidatesRequest.php
index 8696c302..7baae051 100644
--- a/src/Http/Validation/ValidatesRequest.php
+++ b/src/Http/Validation/ValidatesRequest.php
@@ -12,7 +12,7 @@ trait ValidatesRequest
protected function validate(Request $request, array $rules): array
{
$isValid = $this->validator->validate(
- (array)$request->getParsedBody(),
+ (array) $request->getParsedBody(),
$rules
);
diff --git a/src/Logger/Logger.php b/src/Logger/Logger.php
index 50479591..dd570579 100644
--- a/src/Logger/Logger.php
+++ b/src/Logger/Logger.php
@@ -57,7 +57,7 @@ class Logger extends AbstractLogger
}
// replace the values of the message
- $message = str_replace('{' . $key . '}', (string)$val, $message);
+ $message = str_replace('{' . $key . '}', (string) $val, $message);
}
return $message;
diff --git a/src/Mail/Mailer.php b/src/Mail/Mailer.php
index a1a3336a..78a38f3d 100644
--- a/src/Mail/Mailer.php
+++ b/src/Mail/Mailer.php
@@ -23,7 +23,7 @@ class Mailer
public function send(string|array $to, string $subject, string $body): void
{
$message = (new Email())
- ->to(...(array)$to)
+ ->to(...(array) $to)
->from(sprintf('%s <%s>', $this->fromName, $this->fromAddress))
->subject($subject)
->text($body);
diff --git a/src/Middleware/LegacyMiddleware.php b/src/Middleware/LegacyMiddleware.php
index 6d03a2d5..598fe1ad 100644
--- a/src/Middleware/LegacyMiddleware.php
+++ b/src/Middleware/LegacyMiddleware.php
@@ -170,10 +170,10 @@ class LegacyMiddleware implements MiddlewareInterface
protected function renderPage(string $page, string $title, string $content): ResponseInterface
{
if (!empty($page) && is_int($page)) {
- return response($content, (int)$page);
+ return response($content, (int) $page);
}
- if (strpos((string)$content, ' $permission) {
diff --git a/src/Renderer/Twig/Extensions/Authentication.php b/src/Renderer/Twig/Extensions/Authentication.php
index 3fe152a7..44a377bf 100644
--- a/src/Renderer/Twig/Extensions/Authentication.php
+++ b/src/Renderer/Twig/Extensions/Authentication.php
@@ -26,7 +26,7 @@ class Authentication extends TwigExtension
public function isAuthenticated(): bool
{
- return (bool)$this->auth->user();
+ return (bool) $this->auth->user();
}
public function isGuest(): bool
diff --git a/src/Renderer/Twig/Extensions/Globals.php b/src/Renderer/Twig/Extensions/Globals.php
index 6b8b977e..cb750c66 100644
--- a/src/Renderer/Twig/Extensions/Globals.php
+++ b/src/Renderer/Twig/Extensions/Globals.php
@@ -35,8 +35,8 @@ class Globals extends TwigExtension implements GlobalsInterface
}
$query = $this->request->query->get('theme');
- if (!is_null($query) && isset($themes[(int)$query])) {
- $themeId = (int)$query;
+ if (!is_null($query) && isset($themes[(int) $query])) {
+ $themeId = (int) $query;
}
if (array_key_exists($themeId, $themes) === false) {
diff --git a/tests/Feature/Logger/LoggerTest.php b/tests/Feature/Logger/LoggerTest.php
index 7f812655..d029e40b 100644
--- a/tests/Feature/Logger/LoggerTest.php
+++ b/tests/Feature/Logger/LoggerTest.php
@@ -157,7 +157,7 @@ class LoggerTest extends ApplicationFeatureTest
$this->assertStringContainsString('Oops', $entry['message']);
$this->assertStringContainsString('42', $entry['message']);
$this->assertStringContainsString(__FILE__, $entry['message']);
- $this->assertStringContainsString((string)$line, $entry['message']);
+ $this->assertStringContainsString((string) $line, $entry['message']);
$this->assertStringContainsString(__FUNCTION__, $entry['message']);
}
diff --git a/tests/Unit/Config/RoutesFileTest.php b/tests/Unit/Config/RoutesFileTest.php
index dbeb0d9c..8603fa30 100644
--- a/tests/Unit/Config/RoutesFileTest.php
+++ b/tests/Unit/Config/RoutesFileTest.php
@@ -34,7 +34,7 @@ class RoutesFileTest extends TestCase
}
$this->fail(
- sprintf('The route "%s %s" is not cacheable', implode(',', (array)$httpMethod), $route)
+ sprintf('The route "%s %s" is not cacheable', implode(',', (array) $httpMethod), $route)
);
});
diff --git a/tests/Unit/Controllers/Admin/NewsControllerTest.php b/tests/Unit/Controllers/Admin/NewsControllerTest.php
index 452c9b49..1e29ff3b 100644
--- a/tests/Unit/Controllers/Admin/NewsControllerTest.php
+++ b/tests/Unit/Controllers/Admin/NewsControllerTest.php
@@ -152,7 +152,7 @@ class NewsControllerTest extends ControllerTest
$news = (new News())->find($id);
$this->assertEquals($text, $news->text);
- $this->assertEquals($isMeeting, (bool)$news->is_meeting);
+ $this->assertEquals($isMeeting, (bool) $news->is_meeting);
}
/**
diff --git a/tests/Unit/Controllers/Metrics/ControllerTest.php b/tests/Unit/Controllers/Metrics/ControllerTest.php
index f080491e..0eb336d6 100644
--- a/tests/Unit/Controllers/Metrics/ControllerTest.php
+++ b/tests/Unit/Controllers/Metrics/ControllerTest.php
@@ -207,7 +207,7 @@ class ControllerTest extends TestCase
$stats->expects($this->once())
->method('workSeconds')
->with(true)
- ->willReturn((int)(60 * 60 * 99.47));
+ ->willReturn((int) (60 * 60 * 99.47));
$this->setExpects($stats, 'newUsers', null, 3);
$this->setExpects($stats, 'arrivedUsers', null, 10, $this->exactly(2));
$this->setExpects($stats, 'currentlyWorkingUsers', null, 5);
diff --git a/tests/Unit/Controllers/OAuthControllerTest.php b/tests/Unit/Controllers/OAuthControllerTest.php
index ec738f8d..4577cee5 100644
--- a/tests/Unit/Controllers/OAuthControllerTest.php
+++ b/tests/Unit/Controllers/OAuthControllerTest.php
@@ -151,7 +151,7 @@ class OAuthControllerTest extends TestCase
// Login using provider
$controller->index($request);
$this->assertFalse($this->session->has('oauth2_connect_provider'));
- $this->assertFalse((bool)$this->otherUser->state->arrived);
+ $this->assertFalse((bool) $this->otherUser->state->arrived);
// Tokens updated
$oauth = $this->otherUser->oauth[0];
@@ -165,13 +165,13 @@ class OAuthControllerTest extends TestCase
$this->config->set('oauth', $oauthConfig);
$controller->index($request);
- $this->assertTrue((bool)User::find(1)->state->arrived);
+ $this->assertTrue((bool) User::find(1)->state->arrived);
$this->assertTrue($this->log->hasInfoThatContains('as arrived'));
$this->log->reset();
// Don't set arrived if already done
$controller->index($request);
- $this->assertTrue((bool)User::find(1)->state->arrived);
+ $this->assertTrue((bool) User::find(1)->state->arrived);
$this->assertFalse($this->log->hasInfoThatContains('as arrived'));
}
diff --git a/tests/Unit/Exceptions/Handlers/LegacyTest.php b/tests/Unit/Exceptions/Handlers/LegacyTest.php
index 54b99dd5..cf03b25d 100644
--- a/tests/Unit/Exceptions/Handlers/LegacyTest.php
+++ b/tests/Unit/Exceptions/Handlers/LegacyTest.php
@@ -63,7 +63,7 @@ class LegacyTest extends TestCase
$this->assertStringContainsString('4242', $logContent);
$this->assertStringContainsString('Lorem Ipsum', $logContent);
$this->assertStringContainsString(basename(__FILE__), $logContent);
- $this->assertStringContainsString((string)$line, $logContent);
+ $this->assertStringContainsString((string) $line, $logContent);
$this->assertStringContainsString(__FUNCTION__, $logContent);
$this->assertStringContainsString(json_encode(__CLASS__), $logContent);
$this->assertStringContainsString('Test Exception', $logContent);
diff --git a/tests/Unit/Mail/Transport/LogTransportTest.php b/tests/Unit/Mail/Transport/LogTransportTest.php
index f1a26887..185fe2ab 100644
--- a/tests/Unit/Mail/Transport/LogTransportTest.php
+++ b/tests/Unit/Mail/Transport/LogTransportTest.php
@@ -39,6 +39,6 @@ class LogTransportTest extends TestCase
$logger = $this->getMockForAbstractClass(LoggerInterface::class);
$transport = new LogTransport($logger);
- $this->assertEquals('log://', (string)$transport);
+ $this->assertEquals('log://', (string) $transport);
}
}
diff --git a/tests/Unit/Models/User/UserTest.php b/tests/Unit/Models/User/UserTest.php
index 37a3735a..173df634 100644
--- a/tests/Unit/Models/User/UserTest.php
+++ b/tests/Unit/Models/User/UserTest.php
@@ -151,7 +151,7 @@ class UserTest extends ModelTest
->associate($user)
->save();
- $this->assertArraySubset($data, (array)$user->{$name}->attributesToArray());
+ $this->assertArraySubset($data, (array) $user->{$name}->attributesToArray());
}
/**