@@ -64,7 +64,7 @@ |
||
64 | 64 | $record = Auth::checkRecordAccess($record, true); |
65 | 65 | |
66 | 66 | // Find the fact to edit |
67 | - $fact = $record->facts()->first(fn (Fact $fact): bool => $fact->id() === $fact_id && $fact->canEdit()); |
|
67 | + $fact = $record->facts()->first(fn(Fact $fact): bool => $fact->id() === $fact_id && $fact->canEdit()); |
|
68 | 68 | |
69 | 69 | if ($fact === null) { |
70 | 70 | return Registry::responseFactory()->redirectUrl($record->url()); |
@@ -108,7 +108,7 @@ |
||
108 | 108 | if (is_string($content)) { |
109 | 109 | $headers['Content-Type'] ??= 'text/html; charset=UTF-8'; |
110 | 110 | } else { |
111 | - $content = json_encode($content, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE); |
|
111 | + $content = json_encode($content, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE); |
|
112 | 112 | $headers['Content-Type'] ??= 'application/json'; |
113 | 113 | } |
114 | 114 |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function isBetween(int $minimum, int $maximum): self |
104 | 104 | { |
105 | - $this->rules[] = static function (?int $value) use ($minimum, $maximum): ?int { |
|
105 | + $this->rules[] = static function (?int $value) use ($minimum, $maximum) : ?int { |
|
106 | 106 | if (is_int($value) && $value >= $minimum && $value <= $maximum) { |
107 | 107 | return $value; |
108 | 108 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | public function isInArray(array $values): self |
122 | 122 | { |
123 | - $this->rules[] = static fn (?string $value): ?string => $value !== null && in_array($value, $values, true) ? $value : null; |
|
123 | + $this->rules[] = static fn(?string $value) : ?string => $value !== null && in_array($value, $values, true) ? $value : null; |
|
124 | 124 | |
125 | 125 | return $this; |
126 | 126 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | */ |
131 | 131 | public function isNotEmpty(): self |
132 | 132 | { |
133 | - $this->rules[] = static fn (?string $value): ?string => $value !== null && $value !== '' ? $value : null; |
|
133 | + $this->rules[] = static fn(?string $value) : ?string => $value !== null && $value !== '' ? $value : null; |
|
134 | 134 | |
135 | 135 | return $this; |
136 | 136 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function isLocalUrl(string $base_url): self |
144 | 144 | { |
145 | - $this->rules[] = static function (?string $value) use ($base_url): ?string { |
|
145 | + $this->rules[] = static function (?string $value) use ($base_url) : ?string { |
|
146 | 146 | if ($value !== null) { |
147 | 147 | $value_info = parse_url($value); |
148 | 148 | $base_url_info = parse_url($base_url); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); |
241 | 241 | } |
242 | 242 | |
243 | - $callback = static fn (?array $value, Closure $rule): ?array => $rule($value); |
|
243 | + $callback = static fn(?array $value, Closure $rule) : ?array => $rule($value); |
|
244 | 244 | |
245 | 245 | $value = array_reduce($this->rules, $callback, $value); |
246 | 246 | $value ??= []; |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $value = null; |
273 | 273 | } |
274 | 274 | |
275 | - $callback = static fn (?int $value, Closure $rule): ?int => $rule($value); |
|
275 | + $callback = static fn(?int $value, Closure $rule) : ?int => $rule($value); |
|
276 | 276 | |
277 | 277 | $value = array_reduce($this->rules, $callback, $value); |
278 | 278 | |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | $value = null; |
316 | 316 | } |
317 | 317 | |
318 | - $callback = static fn (?string $value, Closure $rule): ?string => $rule($value); |
|
318 | + $callback = static fn(?string $value, Closure $rule) : ?string => $rule($value); |
|
319 | 319 | |
320 | - $value = array_reduce($this->rules, $callback, $value); |
|
320 | + $value = array_reduce($this->rules, $callback, $value); |
|
321 | 321 | $value ??= $default; |
322 | 322 | |
323 | 323 | if ($value === null || preg_match('//u', $value) !== 1) { |
@@ -68,7 +68,7 @@ |
||
68 | 68 | |
69 | 69 | // webtrees uses http_build_query() to generate URLs - which maps false onto "0". |
70 | 70 | // Aura uses rawurlencode(), which maps false onto "" - which does not work as an aura URL parameter. |
71 | - $parameters = array_map(static fn ($var) => is_bool($var) ? (int) $var : $var, $parameters); |
|
71 | + $parameters = array_map(static fn($var) => is_bool($var) ? (int) $var : $var, $parameters); |
|
72 | 72 | |
73 | 73 | $url = $router_container->getGenerator()->generate($route_name, $parameters); |
74 | 74 |
@@ -146,8 +146,8 @@ discard block |
||
146 | 146 | { |
147 | 147 | $default_events = implode(',', self::DEFAULT_EVENTS); |
148 | 148 | |
149 | - $days = (int)$this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); |
|
150 | - $filter = (bool)$this->getBlockSetting($block_id, 'filter', self::DEFAULT_FILTER); |
|
149 | + $days = (int) $this->getBlockSetting($block_id, 'days', self::DEFAULT_DAYS); |
|
150 | + $filter = (bool) $this->getBlockSetting($block_id, 'filter', self::DEFAULT_FILTER); |
|
151 | 151 | $infoStyle = $this->getBlockSetting($block_id, 'infoStyle', self::DEFAULT_STYLE); |
152 | 152 | $sortStyle = $this->getBlockSetting($block_id, 'sortStyle', self::DEFAULT_SORT); |
153 | 153 | $events = $this->getBlockSetting($block_id, 'events', $default_events); |
@@ -256,8 +256,8 @@ discard block |
||
256 | 256 | $sort_style = Validator::parsedBody($request)->isInArrayKeys($this->sortStyles())->string('sortStyle'); |
257 | 257 | $events = Validator::parsedBody($request)->array('events'); |
258 | 258 | |
259 | - $this->setBlockSetting($block_id, 'days', (string)$days); |
|
260 | - $this->setBlockSetting($block_id, 'filter', (string)$filter); |
|
259 | + $this->setBlockSetting($block_id, 'days', (string) $days); |
|
260 | + $this->setBlockSetting($block_id, 'filter', (string) $filter); |
|
261 | 261 | $this->setBlockSetting($block_id, 'infoStyle', $info_style); |
262 | 262 | $this->setBlockSetting($block_id, 'sortStyle', $sort_style); |
263 | 263 | $this->setBlockSetting($block_id, 'events', implode(',', $events)); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | foreach ($components as $component) { |
95 | 95 | // Allow for upper/lower-case mismatches, and all-numeric XREFs |
96 | - $component = array_map(static fn ($x): string => strtolower((string) $x), $component); |
|
96 | + $component = array_map(static fn($x): string => strtolower((string) $x), $component); |
|
97 | 97 | |
98 | 98 | if (!in_array(strtolower($xref), $component, true)) { |
99 | 99 | $individual_groups[] = DB::table('individuals') |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } |
106 | 106 | } |
107 | 107 | |
108 | - usort($individual_groups, static fn (Collection $x, Collection $y): int => count($x) <=> count($y)); |
|
108 | + usort($individual_groups, static fn(Collection $x, Collection $y): int => count($x) <=> count($y)); |
|
109 | 109 | |
110 | 110 | $title = I18N::translate('Find unrelated individuals') . ' — ' . e($tree->title()); |
111 | 111 |
@@ -75,7 +75,7 @@ |
||
75 | 75 | ->union($union) |
76 | 76 | ->pluck('l_from'); |
77 | 77 | |
78 | - return $xrefs->map(static fn (string $xref) => Registry::gedcomRecordFactory()->make($xref, $record->tree())); |
|
78 | + return $xrefs->map(static fn(string $xref) => Registry::gedcomRecordFactory()->make($xref, $record->tree())); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $currentLen = $endPos + 2; |
200 | 200 | $directive = substr($workingText, 0, $currentLen); |
201 | 201 | $workingText = substr($workingText, $currentLen); |
202 | - $result .= self::$waitingText . $directive; |
|
202 | + $result .= self::$waitingText . $directive; |
|
203 | 203 | self::$waitingText = ''; |
204 | 204 | break; |
205 | 205 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ($openParIndex !== false) { |
311 | 311 | // Opening parentheses always inherit the following directionality |
312 | 312 | self::$waitingText .= $currentLetter; |
313 | - $workingText = substr($workingText, $currentLen); |
|
313 | + $workingText = substr($workingText, $currentLen); |
|
314 | 314 | while (true) { |
315 | 315 | if ($workingText === '') { |
316 | 316 | break; |
@@ -318,13 +318,13 @@ discard block |
||
318 | 318 | if (str_starts_with($workingText, ' ')) { |
319 | 319 | // Spaces following this left parenthesis inherit the following directionality too |
320 | 320 | self::$waitingText .= ' '; |
321 | - $workingText = substr($workingText, 1); |
|
321 | + $workingText = substr($workingText, 1); |
|
322 | 322 | continue; |
323 | 323 | } |
324 | 324 | if (str_starts_with($workingText, ' ')) { |
325 | 325 | // Spaces following this left parenthesis inherit the following directionality too |
326 | 326 | self::$waitingText .= ' '; |
327 | - $workingText = substr($workingText, 6); |
|
327 | + $workingText = substr($workingText, 6); |
|
328 | 328 | continue; |
329 | 329 | } |
330 | 330 | break; |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | // Exceptions to this rule will be handled later during final clean-up. |
342 | 342 | // |
343 | 343 | self::$waitingText .= $currentLetter; |
344 | - $workingText = substr($workingText, $currentLen); |
|
344 | + $workingText = substr($workingText, $currentLen); |
|
345 | 345 | if (self::$currentState !== '') { |
346 | - $result .= self::$waitingText; |
|
346 | + $result .= self::$waitingText; |
|
347 | 347 | self::$waitingText = ''; |
348 | 348 | } |
349 | 349 | break 2; // double break because we're waiting for more information |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | } |
473 | 473 | if (substr($result . "\n", 0, self::LENGTH_START) !== self::START_LTR && substr($result . "\n", 0, self::LENGTH_START) !== self::START_RTL) { |
474 | 474 | $leadingText .= substr($result, 0, 1); |
475 | - $result = substr($result, 1); |
|
475 | + $result = substr($result, 1); |
|
476 | 476 | continue; |
477 | 477 | } |
478 | 478 | $result = substr($result, 0, self::LENGTH_START) . $leadingText . substr($result, self::LENGTH_START); |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | private static function breakCurrentSpan(string &$result): void |
615 | 615 | { |
616 | 616 | // Interrupt the current span, insert that <br>, and then continue the current span |
617 | - $result .= self::$waitingText; |
|
617 | + $result .= self::$waitingText; |
|
618 | 618 | self::$waitingText = ''; |
619 | 619 | |
620 | 620 | $breakString = '<' . self::$currentState . 'br>'; |
621 | - $result .= $breakString; |
|
621 | + $result .= $breakString; |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | /** |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | break; |
676 | 676 | } // No more numeric strings |
677 | 677 | |
678 | - $tempResult .= substr($textSpan, 0, $posLRE + 3); // Copy everything preceding the numeric string |
|
678 | + $tempResult .= substr($textSpan, 0, $posLRE + 3); // Copy everything preceding the numeric string |
|
679 | 679 | $numericString = substr($textSpan, $posLRE + 3, $posPDF - $posLRE); // Separate the entire numeric string |
680 | 680 | $textSpan = substr($textSpan, $posPDF + 3); |
681 | 681 | $posColon = strpos($numericString, ':'); |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | |
1143 | 1143 | // We're done: finish the span |
1144 | 1144 | $textSpan = self::starredName($textSpan, 'RTL'); // Wrap starred name in <u> and </u> tags |
1145 | - $result .= $textSpan . self::END_RTL; |
|
1145 | + $result .= $textSpan . self::END_RTL; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | if (self::$currentState !== 'LTR' && self::$currentState !== 'RTL') { |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | */ |
87 | 87 | public function relationships(): array |
88 | 88 | { |
89 | - $pra = static fn (int $n, string $nominative, string $genitive): array => [ |
|
89 | + $pra = static fn(int $n, string $nominative, string $genitive): array => [ |
|
90 | 90 | ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $nominative, |
91 | 91 | ($n > 3 ? 'pra ×' . $n . ' ' : str_repeat('pra-', $n)) . $genitive, |
92 | 92 | ]; |
93 | 93 | |
94 | - $cousin = static fn (int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [ |
|
94 | + $cousin = static fn(int $n, array $cousins, string $nominative, string $genitive): array => $cousins[$n] ?? [ |
|
95 | 95 | $nominative . ' z ' . $n . '. kolena', |
96 | 96 | $genitive . '%s z ' . $n . '. kolena', |
97 | 97 | ]; |
@@ -147,9 +147,9 @@ discard block |
||
147 | 147 | Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->mother(), |
148 | 148 | Relationship::fixed('prastarý otec', '%s prastarého otca')->parent()->parent()->parent(), |
149 | 149 | // Ancestors |
150 | - Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'prastarý otec', '%s prastarého otca'))->ancestor()->male(), |
|
151 | - Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'prastará matka', '%s prastarej matky'))->ancestor()->female(), |
|
152 | - Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'prastarý rodič', '%s prastarého rodiča'))->ancestor(), |
|
150 | + Relationship::dynamic(static fn(int $n) => $pra($n - 1, 'prastarý otec', '%s prastarého otca'))->ancestor()->male(), |
|
151 | + Relationship::dynamic(static fn(int $n) => $pra($n - 1, 'prastará matka', '%s prastarej matky'))->ancestor()->female(), |
|
152 | + Relationship::dynamic(static fn(int $n) => $pra($n - 1, 'prastarý rodič', '%s prastarého rodiča'))->ancestor(), |
|
153 | 153 | // Grandchildren |
154 | 154 | Relationship::fixed('vnuk', '%s vnuka')->child()->son(), |
155 | 155 | Relationship::fixed('vnučka', '%s vnučky')->child()->daughter(), |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | Relationship::fixed('pravnučka', '%s pravnučky')->child()->child()->daughter(), |
160 | 160 | Relationship::fixed('pravnúča', '%s pravnúčaťa')->child()->child()->child(), |
161 | 161 | // Descendants |
162 | - Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'pravnuk', '%s pravnuka'))->ancestor()->male(), |
|
163 | - Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'pravnučka', '%s pravnučky'))->ancestor()->female(), |
|
164 | - Relationship::dynamic(static fn (int $n) => $pra($n - 1, 'pravnúča', '%s pravnúčaťa'))->ancestor(), |
|
162 | + Relationship::dynamic(static fn(int $n) => $pra($n - 1, 'pravnuk', '%s pravnuka'))->ancestor()->male(), |
|
163 | + Relationship::dynamic(static fn(int $n) => $pra($n - 1, 'pravnučka', '%s pravnučky'))->ancestor()->female(), |
|
164 | + Relationship::dynamic(static fn(int $n) => $pra($n - 1, 'pravnúča', '%s pravnúčaťa'))->ancestor(), |
|
165 | 165 | // Aunts and uncles |
166 | 166 | Relationship::fixed('ujo', '%s uja')->mother()->brother(), |
167 | 167 | Relationship::fixed('ujčiná', '%s ujčinej')->mother()->brother()->wife(), |
@@ -169,20 +169,20 @@ discard block |
||
169 | 169 | Relationship::fixed('strýko', '%s strýka')->parent()->brother(), |
170 | 170 | Relationship::fixed('teta', '%s tety')->parent()->sister(), |
171 | 171 | // Great-aunts and great-uncles |
172 | - Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'prastrýko', '%s prastrýka'))->ancestor()->brother(), |
|
173 | - Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'prateta', '%s pratety'))->ancestor()->sister(), |
|
172 | + Relationship::dynamic(static fn(int $n) => $pra($n - 2, 'prastrýko', '%s prastrýka'))->ancestor()->brother(), |
|
173 | + Relationship::dynamic(static fn(int $n) => $pra($n - 2, 'prateta', '%s pratety'))->ancestor()->sister(), |
|
174 | 174 | // Nieces and nephews |
175 | 175 | Relationship::fixed('synovec', '%s synovca')->sibling()->son(), |
176 | 176 | Relationship::fixed('neter', '%s netere')->sibling()->daughter(), |
177 | 177 | // Great-nieces and great-nephews |
178 | 178 | Relationship::fixed('prasynovec', '%s prasynovca')->sibling()->child()->son(), |
179 | 179 | Relationship::fixed('praneter', '%s pranetere')->sibling()->child()->daughter(), |
180 | - Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'prasynovec', '%s prasynovca'))->sibling()->descendant()->son(), |
|
181 | - Relationship::dynamic(static fn (int $n) => $pra($n - 2, 'praneter', '%s pranetere'))->sibling()->descendant()->daughter(), |
|
180 | + Relationship::dynamic(static fn(int $n) => $pra($n - 2, 'prasynovec', '%s prasynovca'))->sibling()->descendant()->son(), |
|
181 | + Relationship::dynamic(static fn(int $n) => $pra($n - 2, 'praneter', '%s pranetere'))->sibling()->descendant()->daughter(), |
|
182 | 182 | // Cousins |
183 | - Relationship::dynamic(static fn (int $n): array => $cousin($n, static::FEMALE_COUSINS, '', ''))->symmetricCousin()->female(), |
|
184 | - Relationship::dynamic(static fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin()->male(), |
|
185 | - Relationship::dynamic(static fn (int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin(), |
|
183 | + Relationship::dynamic(static fn(int $n): array => $cousin($n, static::FEMALE_COUSINS, '', ''))->symmetricCousin()->female(), |
|
184 | + Relationship::dynamic(static fn(int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin()->male(), |
|
185 | + Relationship::dynamic(static fn(int $n): array => $cousin($n, static::MALE_COUSINS, '', ''))->symmetricCousin(), |
|
186 | 186 | ]; |
187 | 187 | } |
188 | 188 | } |