@@ -75,13 +75,13 @@ |
||
75 | 75 | $canonical = $this->canonical($value); |
76 | 76 | |
77 | 77 | return preg_replace_callback_array([ |
78 | - '/CHILD/' => fn () => I18N::translate('Child'), |
|
79 | - '/INFANT/' => fn () => I18N::translate('Infant'), |
|
80 | - '/STILLBORN/' => fn () => I18N::translate('Stillborn'), |
|
81 | - '/\b(\d+)y\b/' => fn (array $match) => I18N::plural('%s year', '%s years', (int) $match[1], I18N::number((float) $match[1])), |
|
82 | - '/\b(\d+)m\b/' => fn (array $match) => I18N::plural('%s month', '%s months', (int) $match[1], I18N::number((float) $match[1])), |
|
83 | - '/\b(\d+)w\b/' => fn (array $match) => I18N::plural('%s week', '%s weeks', (int) $match[1], I18N::number((float) $match[1])), |
|
84 | - '/\b(\d+)d\b/' => fn (array $match) => I18N::plural('%s day', '%s days', (int) $match[1], I18N::number((float) $match[1])), |
|
78 | + '/CHILD/' => fn() => I18N::translate('Child'), |
|
79 | + '/INFANT/' => fn() => I18N::translate('Infant'), |
|
80 | + '/STILLBORN/' => fn() => I18N::translate('Stillborn'), |
|
81 | + '/\b(\d+)y\b/' => fn(array $match) => I18N::plural('%s year', '%s years', (int) $match[1], I18N::number((float) $match[1])), |
|
82 | + '/\b(\d+)m\b/' => fn(array $match) => I18N::plural('%s month', '%s months', (int) $match[1], I18N::number((float) $match[1])), |
|
83 | + '/\b(\d+)w\b/' => fn(array $match) => I18N::plural('%s week', '%s weeks', (int) $match[1], I18N::number((float) $match[1])), |
|
84 | + '/\b(\d+)d\b/' => fn(array $match) => I18N::plural('%s day', '%s days', (int) $match[1], I18N::number((float) $match[1])), |
|
85 | 85 | ], e($canonical)); |
86 | 86 | } |
87 | 87 | } |
@@ -74,7 +74,7 @@ |
||
74 | 74 | $record = Auth::checkRecordAccess($record, true); |
75 | 75 | |
76 | 76 | // Find the fact to edit |
77 | - $fact = $record->facts()->first(fn (Fact $fact): bool => $fact->id() === $fact_id && $fact->canEdit()); |
|
77 | + $fact = $record->facts()->first(fn(Fact $fact): bool => $fact->id() === $fact_id && $fact->canEdit()); |
|
78 | 78 | |
79 | 79 | if ($fact === null) { |
80 | 80 | return redirect($record->url()); |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | try { |
299 | 299 | $files = $filesystem |
300 | 300 | ->listContents($folder, $subfolders) |
301 | - ->filter(fn (StorageAttributes $attributes): bool => $attributes->isFile()) |
|
302 | - ->filter(fn (StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path())) |
|
303 | - ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
301 | + ->filter(fn(StorageAttributes $attributes): bool => $attributes->isFile()) |
|
302 | + ->filter(fn(StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path())) |
|
303 | + ->map(fn(StorageAttributes $attributes): string => $attributes->path()) |
|
304 | 304 | ->toArray(); |
305 | 305 | } catch (FilesystemException $ex) { |
306 | 306 | $files = []; |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | { |
349 | 349 | $folders = Registry::filesystem()->media($tree) |
350 | 350 | ->listContents('', FilesystemReader::LIST_DEEP) |
351 | - ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir()) |
|
352 | - ->filter(fn (StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path())) |
|
353 | - ->map(fn (StorageAttributes $attributes): string => $attributes->path()) |
|
351 | + ->filter(fn(StorageAttributes $attributes): bool => $attributes->isDir()) |
|
352 | + ->filter(fn(StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path())) |
|
353 | + ->map(fn(StorageAttributes $attributes): string => $attributes->path()) |
|
354 | 354 | ->toArray(); |
355 | 355 | |
356 | 356 | return new Collection($folders); |
@@ -395,9 +395,9 @@ discard block |
||
395 | 395 | foreach ($media_roots as $media_folder) { |
396 | 396 | $tmp = $data_filesystem |
397 | 397 | ->listContents($media_folder, FilesystemReader::LIST_DEEP) |
398 | - ->filter(fn (StorageAttributes $attributes): bool => $attributes->isDir()) |
|
399 | - ->filter(fn (StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path())) |
|
400 | - ->map(fn (StorageAttributes $attributes): string => $attributes->path() . '/') |
|
398 | + ->filter(fn(StorageAttributes $attributes): bool => $attributes->isDir()) |
|
399 | + ->filter(fn(StorageAttributes $attributes): bool => !$this->ignorePath($attributes->path())) |
|
400 | + ->map(fn(StorageAttributes $attributes): string => $attributes->path() . '/') |
|
401 | 401 | ->toArray(); |
402 | 402 | |
403 | 403 | $disk_folders = $disk_folders->concat($tmp); |
@@ -457,7 +457,7 @@ |
||
457 | 457 | public function addYears(int $years, string $qualifier = ''): Date |
458 | 458 | { |
459 | 459 | $tmp = clone $this; |
460 | - $tmp->date1->year += $years; |
|
460 | + $tmp->date1->year += $years; |
|
461 | 461 | $tmp->date1->month = 0; |
462 | 462 | $tmp->date1->day = 0; |
463 | 463 | $tmp->date1->setJdFromYmd(); |
@@ -431,7 +431,7 @@ |
||
431 | 431 | ]); |
432 | 432 | |
433 | 433 | $text_lines = array_map( |
434 | - fn (string $line): string => $this->fitTextToPixelWidth($line, $max_text_length), |
|
434 | + fn(string $line): string => $this->fitTextToPixelWidth($line, $max_text_length), |
|
435 | 435 | $text_lines |
436 | 436 | ); |
437 | 437 |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | 'generations' => 3, |
118 | 118 | 'layout' => PedigreeChartModule::STYLE_RIGHT, |
119 | 119 | ]); |
120 | - $content = view('modules/charts/chart', [ |
|
120 | + $content = view('modules/charts/chart', [ |
|
121 | 121 | 'block_id' => $block_id, |
122 | 122 | 'chart_url' => $chart_url, |
123 | 123 | ]); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | 'generations' => 2, |
138 | 138 | 'chart_style' => DescendancyChartModule::CHART_STYLE_TREE, |
139 | 139 | ]); |
140 | - $content = view('modules/charts/chart', [ |
|
140 | + $content = view('modules/charts/chart', [ |
|
141 | 141 | 'block_id' => $block_id, |
142 | 142 | 'chart_url' => $chart_url, |
143 | 143 | ]); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'ajax' => true, |
158 | 158 | 'generations' => 2, |
159 | 159 | ]); |
160 | - $content = view('modules/charts/chart', [ |
|
160 | + $content = view('modules/charts/chart', [ |
|
161 | 161 | 'block_id' => $block_id, |
162 | 162 | 'chart_url' => $chart_url, |
163 | 163 | ]); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $parts = array_filter($parts); |
125 | 125 | |
126 | 126 | $parts = array_map( |
127 | - static fn (string $tag, string $value): string => "\n2 " . $tag . ' ' . $value, |
|
127 | + static fn(string $tag, string $value): string => "\n2 " . $tag . ' ' . $value, |
|
128 | 128 | array_keys($parts), |
129 | 129 | $parts |
130 | 130 | ); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if ($individual instanceof Individual) { |
149 | 149 | $fact = $individual |
150 | 150 | ->facts(['NAME']) |
151 | - ->first(fn (Fact $fact): bool => in_array($fact->attribute('TYPE'), ['', 'birth', 'change'], true)); |
|
151 | + ->first(fn(Fact $fact): bool => in_array($fact->attribute('TYPE'), ['', 'birth', 'change'], true)); |
|
152 | 152 | |
153 | 153 | if ($fact instanceof Fact) { |
154 | 154 | return $fact->value(); |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $path = (string) parse_url($url, PHP_URL_PATH); |
69 | 69 | |
70 | 70 | // Paths containing UTF-8 characters need special handling. |
71 | - $path = implode('/', array_map(static fn (string $x): string => rawurlencode($x), explode('/', $path))); |
|
71 | + $path = implode('/', array_map(static fn(string $x): string => rawurlencode($x), explode('/', $path))); |
|
72 | 72 | |
73 | 73 | session_name($secure ? self::SECURE_SESSION_NAME : self::SESSION_NAME); |
74 | 74 | session_register_shutdown(); |
@@ -438,15 +438,15 @@ discard block |
||
438 | 438 | { |
439 | 439 | $subtags = Registry::elementFactory()->make($record->tag())->subtags(); |
440 | 440 | |
441 | - $subtags = array_filter($subtags, static fn (string $v, string $k) => !str_ends_with($v, ':1') || $record->facts([$k])->isEmpty(), ARRAY_FILTER_USE_BOTH); |
|
441 | + $subtags = array_filter($subtags, static fn(string $v, string $k) => !str_ends_with($v, ':1') || $record->facts([$k])->isEmpty(), ARRAY_FILTER_USE_BOTH); |
|
442 | 442 | |
443 | 443 | $subtags = array_keys($subtags); |
444 | 444 | |
445 | 445 | // Don't include facts/events that we have hidden in the control panel. |
446 | - $subtags = array_filter($subtags, fn (string $subtag): bool => !$this->isHiddenTag($record->tag() . ':' . $subtag)); |
|
446 | + $subtags = array_filter($subtags, fn(string $subtag): bool => !$this->isHiddenTag($record->tag() . ':' . $subtag)); |
|
447 | 447 | |
448 | 448 | if (!$include_hidden) { |
449 | - $fn_hidden = fn (string $t): bool => !$this->isHiddenTag($record->tag() . ':' . $t); |
|
449 | + $fn_hidden = fn(string $t): bool => !$this->isHiddenTag($record->tag() . ':' . $t); |
|
450 | 450 | $subtags = array_filter($subtags, $fn_hidden); |
451 | 451 | } |
452 | 452 | |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | private function isHiddenTag(string $tag): bool |
540 | 540 | { |
541 | 541 | // Function to filter hidden tags. |
542 | - $fn_hide = static fn (string $x): bool => (bool) Site::getPreference('HIDE_' . $x); |
|
542 | + $fn_hide = static fn(string $x): bool => (bool) Site::getPreference('HIDE_' . $x); |
|
543 | 543 | |
544 | 544 | $preferences = array_filter(Gedcom::HIDDEN_TAGS, $fn_hide, ARRAY_FILTER_USE_KEY); |
545 | 545 | $preferences = array_values($preferences); |