diff options
Diffstat (limited to 'app/Http')
37 files changed, 118 insertions, 216 deletions
diff --git a/app/Http/Middleware/UseLanguage.php b/app/Http/Middleware/UseLanguage.php index 79686fc824..ab56c8992e 100644 --- a/app/Http/Middleware/UseLanguage.php +++ b/app/Http/Middleware/UseLanguage.php @@ -87,9 +87,7 @@ class UseLanguage implements MiddlewareInterface // Browser negotiation $locales = $this->module_service->findByInterface(ModuleLanguageInterface::class, true) - ->map(static function (ModuleLanguageInterface $module): LocaleInterface { - return $module->locale(); - }); + ->map(static fn(ModuleLanguageInterface $module): LocaleInterface => $module->locale()); $default = Locale::create(Site::getPreference('LANGUAGE')); $locale = Locale::httpAcceptLanguage($request->getServerParams(), $locales->all(), $default); diff --git a/app/Http/RequestHandlers/AbstractAutocompleteHandler.php b/app/Http/RequestHandlers/AbstractAutocompleteHandler.php index 743588f521..f7e2b8841f 100644 --- a/app/Http/RequestHandlers/AbstractAutocompleteHandler.php +++ b/app/Http/RequestHandlers/AbstractAutocompleteHandler.php @@ -56,9 +56,7 @@ abstract class AbstractAutocompleteHandler implements RequestHandlerInterface public function handle(ServerRequestInterface $request): ResponseInterface { $data = $this->search($request) - ->map(static function (string $datum): array { - return ['value' => $datum]; - }); + ->map(static fn(string $datum): array => ['value' => $datum]); return response($data) ->withHeader('cache-control', 'public,max-age=' . static::CACHE_LIFE); diff --git a/app/Http/RequestHandlers/AbstractModuleComponentPage.php b/app/Http/RequestHandlers/AbstractModuleComponentPage.php index 99ea3faf01..bd536e9846 100644 --- a/app/Http/RequestHandlers/AbstractModuleComponentPage.php +++ b/app/Http/RequestHandlers/AbstractModuleComponentPage.php @@ -69,14 +69,10 @@ abstract class AbstractModuleComponentPage implements RequestHandlerInterface $access_summary = $modules ->mapWithKeys(function (ModuleInterface $module) use ($interface): array { $access_levels = $this->tree_service->all() - ->map(static function (Tree $tree) use ($interface, $module): int { - return $module->accessLevel($tree, $interface); - }) + ->map(static fn(Tree $tree): int => $module->accessLevel($tree, $interface)) ->uniqueStrict() ->values() - ->map(static function (int $level): string { - return Auth::accessLevelNames()[$level]; - }) + ->map(static fn(int $level): string => Auth::accessLevelNames()[$level]) ->all(); return [$module->name() => $access_levels]; diff --git a/app/Http/RequestHandlers/AutoCompletePlace.php b/app/Http/RequestHandlers/AutoCompletePlace.php index 84c067768c..c773c8fe79 100644 --- a/app/Http/RequestHandlers/AutoCompletePlace.php +++ b/app/Http/RequestHandlers/AutoCompletePlace.php @@ -57,9 +57,7 @@ class AutoCompletePlace extends AbstractAutocompleteHandler $data = $this->search_service ->searchPlaces($tree, $query, 0, static::LIMIT) - ->map(static function (Place $place): string { - return $place->gedcomName(); - }); + ->map(static fn(Place $place): string => $place->gedcomName()); // No place found? Use external gazetteers. foreach ($this->module_service->findByInterface(ModuleMapAutocompleteInterface::class) as $module) { diff --git a/app/Http/RequestHandlers/CalendarEvents.php b/app/Http/RequestHandlers/CalendarEvents.php index 288e8139c2..a81aad385c 100644 --- a/app/Http/RequestHandlers/CalendarEvents.php +++ b/app/Http/RequestHandlers/CalendarEvents.php @@ -103,17 +103,11 @@ class CalendarEvents implements RequestHandlerInterface $anniversaries = Collection::make($anniversary_facts) ->unique() - ->sort(static function (Fact $x, Fact $y): int { - return $x->date()->minimumJulianDay() <=> $y->date()->minimumJulianDay(); - }); + ->sort(static fn(Fact $x, Fact $y): int => $x->date()->minimumJulianDay() <=> $y->date()->minimumJulianDay()); - $family_anniversaries = $anniversaries->filter(static function (Fact $f): bool { - return $f->record() instanceof Family; - }); + $family_anniversaries = $anniversaries->filter(static fn(Fact $f): bool => $f->record() instanceof Family); - $individual_anniversaries = $anniversaries->filter(static function (Fact $f): bool { - return $f->record() instanceof Individual; - }); + $individual_anniversaries = $anniversaries->filter(static fn(Fact $f): bool => $f->record() instanceof Individual); return response(view('calendar-list', [ 'family_anniversaries' => $family_anniversaries, diff --git a/app/Http/RequestHandlers/ControlPanel.php b/app/Http/RequestHandlers/ControlPanel.php index edd8f5cc44..e53dc413e6 100644 --- a/app/Http/RequestHandlers/ControlPanel.php +++ b/app/Http/RequestHandlers/ControlPanel.php @@ -137,9 +137,7 @@ class ControlPanel implements RequestHandlerInterface $custom_updates = $this->module_service ->findByInterface(ModuleCustomInterface::class) - ->filter(static function (ModuleCustomInterface $module): bool { - return version_compare($module->customModuleLatestVersion(), $module->customModuleVersion()) > 0; - }); + ->filter(static fn(ModuleCustomInterface $module): bool => version_compare($module->customModuleLatestVersion(), $module->customModuleVersion()) > 0); $multiple_tree_threshold = $this->admin_service->multipleTreeThreshold(); $gedcom_file_count = $this->admin_service->gedcomFiles(Registry::filesystem()->data())->count(); diff --git a/app/Http/RequestHandlers/DataFixUpdateAll.php b/app/Http/RequestHandlers/DataFixUpdateAll.php index 14263cdd7b..6429c6148f 100644 --- a/app/Http/RequestHandlers/DataFixUpdateAll.php +++ b/app/Http/RequestHandlers/DataFixUpdateAll.php @@ -88,11 +88,9 @@ class DataFixUpdateAll implements RequestHandlerInterface } /** @var Collection<int,GedcomRecord> $records */ - $records = $rows->map(function (object $row) use ($tree): ?GedcomRecord { - return $this->data_fix_service->getRecordByType($row->xref, $tree, $row->type); - })->filter(static function (?GedcomRecord $record) use ($module, $params): bool { - return $record instanceof GedcomRecord && !$record->isPendingDeletion() && $module->doesRecordNeedUpdate($record, $params); - }); + $records = $rows + ->map(fn(object $row): ?GedcomRecord => $this->data_fix_service->getRecordByType($row->xref, $tree, $row->type)) + ->filter(static fn(?GedcomRecord $record): bool => $record instanceof GedcomRecord && !$record->isPendingDeletion() && $module->doesRecordNeedUpdate($record, $params)); foreach ($records as $record) { $module->updateRecord($record, $params); diff --git a/app/Http/RequestHandlers/EditMediaFileAction.php b/app/Http/RequestHandlers/EditMediaFileAction.php index a5e127b7fa..866c32393c 100644 --- a/app/Http/RequestHandlers/EditMediaFileAction.php +++ b/app/Http/RequestHandlers/EditMediaFileAction.php @@ -85,9 +85,7 @@ class EditMediaFileAction implements RequestHandlerInterface // Find the fact to edit $media_file = $media->mediaFiles() - ->first(static function (MediaFile $media_file) use ($fact_id): bool { - return $media_file->factId() === $fact_id; - }); + ->first(static fn(MediaFile $media_file): bool => $media_file->factId() === $fact_id); // Media file does not exist? if ($media_file === null) { diff --git a/app/Http/RequestHandlers/EditRawFactPage.php b/app/Http/RequestHandlers/EditRawFactPage.php index 7fba308d4f..173cb835b0 100644 --- a/app/Http/RequestHandlers/EditRawFactPage.php +++ b/app/Http/RequestHandlers/EditRawFactPage.php @@ -53,9 +53,7 @@ class EditRawFactPage implements RequestHandlerInterface $title = I18N::translate('Edit the raw GEDCOM') . ' - ' . $record->fullName(); $fact = $record->facts([], false, null, true) - ->first(static function (Fact $fact) use ($fact_id): bool { - return $fact->id() === $fact_id; - }); + ->first(static fn(Fact $fact): bool => $fact->id() === $fact_id); if ($fact instanceof Fact) { return $this->viewResponse('edit/raw-gedcom-fact', [ diff --git a/app/Http/RequestHandlers/FamilyPage.php b/app/Http/RequestHandlers/FamilyPage.php index 7359697102..a366845557 100644 --- a/app/Http/RequestHandlers/FamilyPage.php +++ b/app/Http/RequestHandlers/FamilyPage.php @@ -80,9 +80,7 @@ class FamilyPage implements RequestHandlerInterface $clipboard_facts = $this->clipboard_service->pastableFacts($family); $facts = $family->facts([], true) - ->filter(static function (Fact $fact): bool { - return !in_array($fact->tag(), ['FAM:HUSB', 'FAM:WIFE', 'FAM:CHIL'], true); - }); + ->filter(static fn(Fact $fact): bool => !in_array($fact->tag(), ['FAM:HUSB', 'FAM:WIFE', 'FAM:CHIL'], true)); return $this->viewResponse('family-page', [ 'can_upload_media' => Auth::canUploadMedia($tree, Auth::user()), diff --git a/app/Http/RequestHandlers/FixLevel0MediaData.php b/app/Http/RequestHandlers/FixLevel0MediaData.php index d32013c942..2428d67702 100644 --- a/app/Http/RequestHandlers/FixLevel0MediaData.php +++ b/app/Http/RequestHandlers/FixLevel0MediaData.php @@ -113,13 +113,11 @@ class FixLevel0MediaData implements RequestHandlerInterface $media = Registry::mediaFactory()->make($datum->m_id, $tree, $datum->m_gedcom); $individual = Registry::individualFactory()->make($datum->i_id, $tree, $datum->i_gedcom); - $facts = $individual->facts([], true) - ->filter(static function (Fact $fact) use ($ignore_facts): bool { - return - !$fact->isPendingDeletion() && - !preg_match('/^@' . Gedcom::REGEX_XREF . '@$/', $fact->value()) && - !in_array($fact->tag(), $ignore_facts, true); - }); + $facts = $individual + ->facts([], true) + ->filter(static fn(Fact $fact): bool => !$fact->isPendingDeletion() && + !preg_match('/^@' . Gedcom::REGEX_XREF . '@$/', $fact->value()) && + !in_array($fact->tag(), $ignore_facts, true)); // The link to the media object may have been deleted in a pending change. $deleted = true; @@ -132,13 +130,11 @@ class FixLevel0MediaData implements RequestHandlerInterface $facts = new Collection(); } - $facts = $facts->map(static function (Fact $fact) use ($individual, $media): string { - return view('admin/fix-level-0-media-action', [ - 'fact' => $fact, - 'individual' => $individual, - 'media' => $media, - ]); - }); + $facts = $facts->map(static fn(Fact $fact): string => view('admin/fix-level-0-media-action', [ + 'fact' => $fact, + 'individual' => $individual, + 'media' => $media, + ])); return [ $tree->name(), diff --git a/app/Http/RequestHandlers/ImportThumbnailsData.php b/app/Http/RequestHandlers/ImportThumbnailsData.php index 67c4dc3c53..29a92e4103 100644 --- a/app/Http/RequestHandlers/ImportThumbnailsData.php +++ b/app/Http/RequestHandlers/ImportThumbnailsData.php @@ -92,12 +92,8 @@ class ImportThumbnailsData implements RequestHandlerInterface // Fetch all thumbnails try { $thumbnails = Collection::make($data_filesystem->listContents('', FilesystemReader::LIST_DEEP)) - ->filter(static function (StorageAttributes $attributes): bool { - return $attributes->isFile() && str_contains($attributes->path(), '/thumbs/'); - }) - ->map(static function (StorageAttributes $attributes): string { - return $attributes->path(); - }); + ->filter(static fn(StorageAttributes $attributes): bool => $attributes->isFile() && str_contains($attributes->path(), '/thumbs/')) + ->map(static fn(StorageAttributes $attributes): string => $attributes->path()); } catch (FilesystemException) { $thumbnails = new Collection(); } @@ -105,9 +101,7 @@ class ImportThumbnailsData implements RequestHandlerInterface $recordsTotal = $thumbnails->count(); if ($search !== '') { - $thumbnails = $thumbnails->filter(static function (string $thumbnail) use ($search): bool { - return stripos($thumbnail, $search) !== false; - }); + $thumbnails = $thumbnails->filter(static fn(string $thumbnail): bool => stripos($thumbnail, $search) !== false); } $recordsFiltered = $thumbnails->count(); @@ -125,9 +119,7 @@ class ImportThumbnailsData implements RequestHandlerInterface $media = $this->search_service->findMediaObjectsForMediaFile($original); - $media_links = array_map(static function (Media $media): string { - return '<a href="' . e($media->url()) . '">' . $media->fullName() . '</a>'; - }, $media); + $media_links = array_map(static fn(Media $media): string => '<a href="' . e($media->url()) . '">' . $media->fullName() . '</a>', $media); $media_links = implode('<br>', $media_links); diff --git a/app/Http/RequestHandlers/IndividualPage.php b/app/Http/RequestHandlers/IndividualPage.php index b4840b7843..0e8349e5f6 100644 --- a/app/Http/RequestHandlers/IndividualPage.php +++ b/app/Http/RequestHandlers/IndividualPage.php @@ -216,9 +216,7 @@ class IndividualPage implements RequestHandlerInterface $meta_facts[] = I18N::translate('Spouse') . ' ' . $spouse->fullName(); } - $child_names = $family->children()->map(static function (Individual $individual): string { - return e($individual->getAllNames()[0]['givn']); - })->implode(', '); + $child_names = $family->children()->map(static fn(Individual $individual): string => e($individual->getAllNames()[0]['givn']))->implode(', '); if ($child_names !== '') { @@ -244,9 +242,7 @@ class IndividualPage implements RequestHandlerInterface { return $this->module_service ->findByComponent(ModuleSidebarInterface::class, $individual->tree(), Auth::user()) - ->filter(static function (ModuleSidebarInterface $sidebar) use ($individual): bool { - return $sidebar->hasSidebarContent($individual); - }); + ->filter(static fn(ModuleSidebarInterface $sidebar): bool => $sidebar->hasSidebarContent($individual)); } /** @@ -261,9 +257,7 @@ class IndividualPage implements RequestHandlerInterface { return $this->module_service ->findByComponent(ModuleTabInterface::class, $individual->tree(), Auth::user()) - ->filter(static function (ModuleTabInterface $tab) use ($individual): bool { - return $tab->hasTabContent($individual); - }); + ->filter(static fn(ModuleTabInterface $tab): bool => $tab->hasTabContent($individual)); } /** diff --git a/app/Http/RequestHandlers/ManageMediaData.php b/app/Http/RequestHandlers/ManageMediaData.php index 9863b14d64..97cd9d3b19 100644 --- a/app/Http/RequestHandlers/ManageMediaData.php +++ b/app/Http/RequestHandlers/ManageMediaData.php @@ -220,9 +220,7 @@ class ManageMediaData implements RequestHandlerInterface // All unused files $unused_files = $disk_files->diff($db_files) - ->map(static function (string $file): array { - return (array) $file; - }); + ->map(static fn(string $file): array => (array) $file); $search_columns = [0]; $sort_columns = [0 => 0]; diff --git a/app/Http/RequestHandlers/MapDataExportCSV.php b/app/Http/RequestHandlers/MapDataExportCSV.php index 898963b58f..53757e5ddc 100644 --- a/app/Http/RequestHandlers/MapDataExportCSV.php +++ b/app/Http/RequestHandlers/MapDataExportCSV.php @@ -127,20 +127,18 @@ class MapDataExportCSV implements RequestHandlerInterface $max_level = max($max_level, count($place->hierarchy)); } - $places = array_map(function (object $place) use ($max_level): array { - return array_merge( - [ - count($place->hierarchy) - 1, - ], - array_pad($place->hierarchy, $max_level, ''), - [ - $this->map_data_service->writeLongitude((float) $place->longitude), - $this->map_data_service->writeLatitude((float) $place->latitude), - '', - '', - ] - ); - }, $places); + $places = array_map(fn(object $place): array => array_merge( + [ + count($place->hierarchy) - 1, + ], + array_pad($place->hierarchy, $max_level, ''), + [ + $this->map_data_service->writeLongitude((float) $place->longitude), + $this->map_data_service->writeLatitude((float) $place->latitude), + '', + '', + ] + ), $places); // Create the header line for the output file (always English) $header = [ diff --git a/app/Http/RequestHandlers/MapDataImportPage.php b/app/Http/RequestHandlers/MapDataImportPage.php index f77bfb1c65..0948e7133f 100644 --- a/app/Http/RequestHandlers/MapDataImportPage.php +++ b/app/Http/RequestHandlers/MapDataImportPage.php @@ -60,9 +60,7 @@ class MapDataImportPage implements RequestHandlerInterface return $extension === 'csv' || $extension === 'geojson'; }) - ->map(static function (StorageAttributes $attributes): string { - return pathinfo($attributes->path(), PATHINFO_BASENAME); - }) + ->map(static fn(StorageAttributes $attributes): string => pathinfo($attributes->path(), PATHINFO_BASENAME)) ->toArray(); } catch (FilesystemException) { $files = []; diff --git a/app/Http/RequestHandlers/PendingChangesLogDownload.php b/app/Http/RequestHandlers/PendingChangesLogDownload.php index f97976bb45..655e12e0b1 100644 --- a/app/Http/RequestHandlers/PendingChangesLogDownload.php +++ b/app/Http/RequestHandlers/PendingChangesLogDownload.php @@ -56,18 +56,17 @@ class PendingChangesLogDownload implements RequestHandlerInterface $content = $this->pending_changes_service->changesQuery($params) ->get() - ->map(static function (object $row): string { + ->map(static fn(object $row): string => // Convert to CSV - return implode(',', [ - '"' . $row->change_time . '"', - '"' . $row->status . '"', - '"' . $row->xref . '"', - '"' . str_replace('"', '""', $row->old_gedcom) . '"', - '"' . str_replace('"', '""', $row->new_gedcom) . '"', - '"' . str_replace('"', '""', $row->user_name) . '"', - '"' . str_replace('"', '""', $row->gedcom_name) . '"', - ]); - }) + implode(',', [ + '"' . $row->change_time . '"', + '"' . $row->status . '"', + '"' . $row->xref . '"', + '"' . str_replace('"', '""', $row->old_gedcom) . '"', + '"' . str_replace('"', '""', $row->new_gedcom) . '"', + '"' . str_replace('"', '""', $row->user_name) . '"', + '"' . str_replace('"', '""', $row->gedcom_name) . '"', + ])) ->implode("\n"); return response($content, StatusCodeInterface::STATUS_OK, [ diff --git a/app/Http/RequestHandlers/SearchGeneralPage.php b/app/Http/RequestHandlers/SearchGeneralPage.php index 372e287b35..7f0dcdd922 100644 --- a/app/Http/RequestHandlers/SearchGeneralPage.php +++ b/app/Http/RequestHandlers/SearchGeneralPage.php @@ -154,9 +154,7 @@ class SearchGeneralPage implements RequestHandlerInterface $tmp1 = $this->search_service->searchFamilies($search_trees->all(), $search_terms); $tmp2 = $this->search_service->searchFamilyNames($search_trees->all(), $search_terms); - $families = $tmp1->merge($tmp2)->unique(static function (Family $family): string { - return $family->xref() . '@' . $family->tree()->id(); - }); + $families = $tmp1->merge($tmp2)->unique(static fn(Family $family): string => $family->xref() . '@' . $family->tree()->id()); } if ($search_repositories) { diff --git a/app/Http/RequestHandlers/SetupWizard.php b/app/Http/RequestHandlers/SetupWizard.php index f029df1b3a..3f1d2119d7 100644 --- a/app/Http/RequestHandlers/SetupWizard.php +++ b/app/Http/RequestHandlers/SetupWizard.php @@ -139,9 +139,7 @@ class SetupWizard implements RequestHandlerInterface $locales = $this->module_service ->setupLanguages() - ->map(static function (ModuleLanguageInterface $module): LocaleInterface { - return $module->locale(); - }); + ->map(static fn(ModuleLanguageInterface $module): LocaleInterface => $module->locale()); if ($data['lang'] === '') { $default = new LocaleEnUs(); diff --git a/app/Http/RequestHandlers/SiteLogsDownload.php b/app/Http/RequestHandlers/SiteLogsDownload.php index 9d10be3c8c..ccd0c172b9 100644 --- a/app/Http/RequestHandlers/SiteLogsDownload.php +++ b/app/Http/RequestHandlers/SiteLogsDownload.php @@ -53,16 +53,13 @@ class SiteLogsDownload implements RequestHandlerInterface $content = $this->site_logs_service->logsQuery($request) ->orderBy('log_id') ->get() - ->map(static function (object $row): string { - return - '"' . $row->log_time . '",' . - '"' . $row->log_type . '",' . - '"' . str_replace('"', '""', $row->log_message) . '",' . - '"' . $row->ip_address . '",' . - '"' . str_replace('"', '""', $row->user_name) . '",' . - '"' . str_replace('"', '""', $row->gedcom_name) . '"' . - "\n"; - }) + ->map(static fn(object $row): string => '"' . $row->log_time . '",' . + '"' . $row->log_type . '",' . + '"' . str_replace('"', '""', $row->log_message) . '",' . + '"' . $row->ip_address . '",' . + '"' . str_replace('"', '""', $row->user_name) . '",' . + '"' . str_replace('"', '""', $row->gedcom_name) . '"' . + "\n") ->implode(''); return Registry::responseFactory()->response($content, StatusCodeInterface::STATUS_OK, [ diff --git a/app/Http/RequestHandlers/SiteLogsPage.php b/app/Http/RequestHandlers/SiteLogsPage.php index 4b95db84ca..e2960f2f64 100644 --- a/app/Http/RequestHandlers/SiteLogsPage.php +++ b/app/Http/RequestHandlers/SiteLogsPage.php @@ -94,14 +94,10 @@ class SiteLogsPage implements RequestHandlerInterface $from = max($from, $earliest); $to = min(max($from, $to), $latest); - $user_options = $this->user_service->all()->mapWithKeys(static function (User $user): array { - return [$user->userName() => $user->userName()]; - }); + $user_options = $this->user_service->all()->mapWithKeys(static fn(User $user): array => [$user->userName() => $user->userName()]); $user_options->prepend('', ''); - $tree_options = $this->tree_service->all()->mapWithKeys(static function (Tree $tree): array { - return [$tree->name() => $tree->title()]; - }); + $tree_options = $this->tree_service->all()->mapWithKeys(static fn(Tree $tree): array => [$tree->name() => $tree->title()]); $tree_options->prepend('', ''); $title = I18N::translate('Website logs'); diff --git a/app/Http/RequestHandlers/TomSelectFamily.php b/app/Http/RequestHandlers/TomSelectFamily.php index efac49a7aa..ee56e04909 100644 --- a/app/Http/RequestHandlers/TomSelectFamily.php +++ b/app/Http/RequestHandlers/TomSelectFamily.php @@ -68,11 +68,9 @@ class TomSelectFamily extends AbstractTomSelectHandler $results = $this->search_service->searchFamilyNames([$tree], $search, $offset, $limit); } - return $results->map(static function (Family $family) use ($at): array { - return [ - 'text' => view('selects/family', ['family' => $family]), - 'value' => $at . $family->xref() . $at, - ]; - }); + return $results->map(static fn(Family $family): array => [ + 'text' => view('selects/family', ['family' => $family]), + 'value' => $at . $family->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectIndividual.php b/app/Http/RequestHandlers/TomSelectIndividual.php index 985405460b..502ffedb8b 100644 --- a/app/Http/RequestHandlers/TomSelectIndividual.php +++ b/app/Http/RequestHandlers/TomSelectIndividual.php @@ -67,11 +67,9 @@ class TomSelectIndividual extends AbstractTomSelectHandler $results = $this->search_service->searchIndividualNames([$tree], $search, $offset, $limit); } - return $results->map(static function (Individual $individual) use ($at): array { - return [ - 'text' => view('selects/individual', ['individual' => $individual]), - 'value' => $at . $individual->xref() . $at, - ]; - }); + return $results->map(static fn(Individual $individual): array => [ + 'text' => view('selects/individual', ['individual' => $individual]), + 'value' => $at . $individual->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectLocation.php b/app/Http/RequestHandlers/TomSelectLocation.php index fe9b82ce2f..43f5288414 100644 --- a/app/Http/RequestHandlers/TomSelectLocation.php +++ b/app/Http/RequestHandlers/TomSelectLocation.php @@ -68,11 +68,9 @@ class TomSelectLocation extends AbstractTomSelectHandler $results = $this->search_service->searchLocations([$tree], $search, $offset, $limit); } - return $results->map(static function (Location $location) use ($at): array { - return [ - 'text' => view('selects/location', ['location' => $location]), - 'value' => $at . $location->xref() . $at, - ]; - }); + return $results->map(static fn(Location $location): array => [ + 'text' => view('selects/location', ['location' => $location]), + 'value' => $at . $location->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectMediaObject.php b/app/Http/RequestHandlers/TomSelectMediaObject.php index aa93e4331d..fbb85c2edc 100644 --- a/app/Http/RequestHandlers/TomSelectMediaObject.php +++ b/app/Http/RequestHandlers/TomSelectMediaObject.php @@ -68,11 +68,9 @@ class TomSelectMediaObject extends AbstractTomSelectHandler $results = $this->search_service->searchMedia([$tree], $search, $offset, $limit); } - return $results->map(static function (Media $media) use ($at): array { - return [ - 'text' => view('selects/media', ['media' => $media]), - 'value' => $at . $media->xref() . $at, - ]; - }); + return $results->map(static fn(Media $media): array => [ + 'text' => view('selects/media', ['media' => $media]), + 'value' => $at . $media->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectNote.php b/app/Http/RequestHandlers/TomSelectNote.php index 5ade740499..20436a257b 100644 --- a/app/Http/RequestHandlers/TomSelectNote.php +++ b/app/Http/RequestHandlers/TomSelectNote.php @@ -68,11 +68,9 @@ class TomSelectNote extends AbstractTomSelectHandler $results = $this->search_service->searchNotes([$tree], $search, $offset, $limit); } - return $results->map(static function (Note $note) use ($at): array { - return [ - 'text' => view('selects/shared-note', ['note' => $note]), - 'value' => $at . $note->xref() . $at, - ]; - }); + return $results->map(static fn(Note $note): array => [ + 'text' => view('selects/shared-note', ['note' => $note]), + 'value' => $at . $note->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectPlace.php b/app/Http/RequestHandlers/TomSelectPlace.php index 6da2924a11..e32ad6ac61 100644 --- a/app/Http/RequestHandlers/TomSelectPlace.php +++ b/app/Http/RequestHandlers/TomSelectPlace.php @@ -54,11 +54,9 @@ class TomSelectPlace extends AbstractTomSelectHandler { return $this->search_service ->searchPlaces($tree, $query, $offset, $limit) - ->map(static function (Place $place): array { - return [ - 'text' => $place->gedcomName(), - 'value' => (string) $place->id(), - ]; - }); + ->map(static fn(Place $place): array => [ + 'text' => $place->gedcomName(), + 'value' => (string) $place->id(), + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectRepository.php b/app/Http/RequestHandlers/TomSelectRepository.php index 834f275031..158e565d7d 100644 --- a/app/Http/RequestHandlers/TomSelectRepository.php +++ b/app/Http/RequestHandlers/TomSelectRepository.php @@ -68,11 +68,9 @@ class TomSelectRepository extends AbstractTomSelectHandler $results = $this->search_service->searchRepositories([$tree], $search, $offset, $limit); } - return $results->map(static function (Repository $repository) use ($at): array { - return [ - 'text' => view('selects/repository', ['repository' => $repository]), - 'value' => $at . $repository->xref() . $at, - ]; - }); + return $results->map(static fn(Repository $repository): array => [ + 'text' => view('selects/repository', ['repository' => $repository]), + 'value' => $at . $repository->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectSharedNote.php b/app/Http/RequestHandlers/TomSelectSharedNote.php index 3dc6e2a435..0b8a2b079f 100644 --- a/app/Http/RequestHandlers/TomSelectSharedNote.php +++ b/app/Http/RequestHandlers/TomSelectSharedNote.php @@ -68,11 +68,9 @@ class TomSelectSharedNote extends AbstractTomSelectHandler $results = $this->search_service->searchSharedNotes([$tree], $search, $offset, $limit); } - return $results->map(static function (SharedNote $note) use ($at): array { - return [ - 'text' => view('selects/shared-note', ['note' => $note]), - 'value' => $at . $note->xref() . $at, - ]; - }); + return $results->map(static fn(SharedNote $note): array => [ + 'text' => view('selects/shared-note', ['note' => $note]), + 'value' => $at . $note->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectSource.php b/app/Http/RequestHandlers/TomSelectSource.php index 23cd23377d..879cd6af67 100644 --- a/app/Http/RequestHandlers/TomSelectSource.php +++ b/app/Http/RequestHandlers/TomSelectSource.php @@ -68,11 +68,9 @@ class TomSelectSource extends AbstractTomSelectHandler $results = $this->search_service->searchSourcesByName([$tree], $search, $offset, $limit); } - return $results->map(static function (Source $source) use ($at): array { - return [ - 'text' => view('selects/source', ['source' => $source]), - 'value' => $at . $source->xref() . $at, - ]; - }); + return $results->map(static fn(Source $source): array => [ + 'text' => view('selects/source', ['source' => $source]), + 'value' => $at . $source->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectSubmission.php b/app/Http/RequestHandlers/TomSelectSubmission.php index 3087ddb941..ca95cd0b92 100644 --- a/app/Http/RequestHandlers/TomSelectSubmission.php +++ b/app/Http/RequestHandlers/TomSelectSubmission.php @@ -68,11 +68,9 @@ class TomSelectSubmission extends AbstractTomSelectHandler $results = $this->search_service->searchSubmissions([$tree], $search, $offset, $limit); } - return $results->map(static function (Submission $submission) use ($at): array { - return [ - 'text' => view('selects/submission', ['submission' => $submission]), - 'value' => $at . $submission->xref() . $at, - ]; - }); + return $results->map(static fn(Submission $submission): array => [ + 'text' => view('selects/submission', ['submission' => $submission]), + 'value' => $at . $submission->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TomSelectSubmitter.php b/app/Http/RequestHandlers/TomSelectSubmitter.php index f9fe2be105..d63a89b29d 100644 --- a/app/Http/RequestHandlers/TomSelectSubmitter.php +++ b/app/Http/RequestHandlers/TomSelectSubmitter.php @@ -68,11 +68,9 @@ class TomSelectSubmitter extends AbstractTomSelectHandler $results = $this->search_service->searchSubmitters([$tree], $search, $offset, $limit); } - return $results->map(static function (Submitter $submitter) use ($at): array { - return [ - 'text' => view('selects/submitter', ['submitter' => $submitter]), - 'value' => $at . $submitter->xref() . $at, - ]; - }); + return $results->map(static fn(Submitter $submitter): array => [ + 'text' => view('selects/submitter', ['submitter' => $submitter]), + 'value' => $at . $submitter->xref() . $at, + ]); } } diff --git a/app/Http/RequestHandlers/TreePageUpdate.php b/app/Http/RequestHandlers/TreePageUpdate.php index 6da8e5a286..8fd3d89b66 100644 --- a/app/Http/RequestHandlers/TreePageUpdate.php +++ b/app/Http/RequestHandlers/TreePageUpdate.php @@ -61,13 +61,9 @@ class TreePageUpdate implements RequestHandlerInterface $default_tree = new Tree(-1, 'DEFAULT', 'DEFAULT'); $main_blocks = $this->home_page_service->treeBlocks($default_tree, $user, ModuleBlockInterface::MAIN_BLOCKS) - ->map(static function (ModuleBlockInterface $block) { - return $block->name(); - }); + ->map(static fn(ModuleBlockInterface $block) => $block->name()); $side_blocks = $this->home_page_service->treeBlocks($default_tree, $user, ModuleBlockInterface::SIDE_BLOCKS) - ->map(static function (ModuleBlockInterface $block) { - return $block->name(); - }); + ->map(static fn(ModuleBlockInterface $block) => $block->name()); } else { $main_blocks = new Collection(Validator::parsedBody($request)->array(ModuleBlockInterface::MAIN_BLOCKS)); $side_blocks = new Collection(Validator::parsedBody($request)->array(ModuleBlockInterface::SIDE_BLOCKS)); diff --git a/app/Http/RequestHandlers/TreePreferencesPage.php b/app/Http/RequestHandlers/TreePreferencesPage.php index 547e267949..17980ff346 100644 --- a/app/Http/RequestHandlers/TreePreferencesPage.php +++ b/app/Http/RequestHandlers/TreePreferencesPage.php @@ -133,9 +133,7 @@ class TreePreferencesPage implements RequestHandlerInterface $pedigree_individual = Registry::individualFactory()->make($tree->getPreference('PEDIGREE_ROOT_ID'), $tree); - $members = $this->user_service->all()->filter(static function (UserInterface $user) use ($tree): bool { - return Auth::isMember($tree, $user); - }); + $members = $this->user_service->all()->filter(static fn(UserInterface $user): bool => Auth::isMember($tree, $user)); $ignore_facts = ['CHAN', 'CHIL', 'FAMC', 'FAMS', 'HUSB', 'SUBM', 'WIFE', 'NAME', 'SEX']; diff --git a/app/Http/RequestHandlers/TreePrivacyPage.php b/app/Http/RequestHandlers/TreePrivacyPage.php index 0d99f001db..dcc62b0a4c 100644 --- a/app/Http/RequestHandlers/TreePrivacyPage.php +++ b/app/Http/RequestHandlers/TreePrivacyPage.php @@ -132,9 +132,7 @@ class TreePrivacyPage implements RequestHandlerInterface return $row; }) - ->sort(static function (object $x, object $y): int { - return I18N::comparator()($x->tag_label, $y->tag_label); - }) + ->sort(static fn(object $x, object $y): int => I18N::comparator()($x->tag_label, $y->tag_label)) ->all(); } diff --git a/app/Http/RequestHandlers/UnconnectedPage.php b/app/Http/RequestHandlers/UnconnectedPage.php index ddeb2d70f9..f34ab5d2dc 100644 --- a/app/Http/RequestHandlers/UnconnectedPage.php +++ b/app/Http/RequestHandlers/UnconnectedPage.php @@ -75,9 +75,7 @@ class UnconnectedPage implements RequestHandlerInterface $graph = DB::table('individuals') ->where('i_file', '=', $tree->id()) ->pluck('i_id') - ->mapWithKeys(static function (string $xref): array { - return [$xref => []]; - }) + ->mapWithKeys(static fn(string $xref): array => [$xref => []]) ->all(); foreach ($rows as $row) { diff --git a/app/Http/RequestHandlers/UserPageUpdate.php b/app/Http/RequestHandlers/UserPageUpdate.php index ab299eb7f1..3efb27080c 100644 --- a/app/Http/RequestHandlers/UserPageUpdate.php +++ b/app/Http/RequestHandlers/UserPageUpdate.php @@ -62,14 +62,10 @@ class UserPageUpdate implements RequestHandlerInterface $main_blocks = $this->home_page_service ->userBlocks($default_tree, $user, ModuleBlockInterface::MAIN_BLOCKS) - ->map(static function (ModuleBlockInterface $block) { - return $block->name(); - }); + ->map(static fn(ModuleBlockInterface $block) => $block->name()); $side_blocks = $this->home_page_service ->userBlocks($default_tree, $user, ModuleBlockInterface::SIDE_BLOCKS) - ->map(static function (ModuleBlockInterface $block) { - return $block->name(); - }); + ->map(static fn(ModuleBlockInterface $block) => $block->name()); } else { $main_blocks = new Collection(Validator::parsedBody($request)->array(ModuleBlockInterface::MAIN_BLOCKS)); $side_blocks = new Collection(Validator::parsedBody($request)->array(ModuleBlockInterface::SIDE_BLOCKS)); |
