@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | protected string $gedcom; |
78 | 78 | |
79 | 79 | // GEDCOM data (after any pending edits) |
80 | - protected string|null $pending; |
|
80 | + protected string | null $pending; |
|
81 | 81 | |
82 | 82 | /** @var array<Fact> Facts extracted from $gedcom/$pending */ |
83 | 83 | protected array $facts; |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | protected array $getAllNames = []; |
87 | 87 | |
88 | 88 | /** @var int|null Cached result */ |
89 | - private int|null $getPrimaryName = null; |
|
89 | + private int | null $getPrimaryName = null; |
|
90 | 90 | |
91 | 91 | /** @var int|null Cached result */ |
92 | - private int|null $getSecondaryName = null; |
|
92 | + private int | null $getSecondaryName = null; |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Create a GedcomRecord object from raw GEDCOM data. |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * empty string for records with pending deletions |
101 | 101 | * @param Tree $tree |
102 | 102 | */ |
103 | - public function __construct(string $xref, string $gedcom, string|null $pending, Tree $tree) |
|
103 | + public function __construct(string $xref, string $gedcom, string | null $pending, Tree $tree) |
|
104 | 104 | { |
105 | 105 | $this->xref = $xref; |
106 | 106 | $this->gedcom = $gedcom; |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @return bool |
241 | 241 | */ |
242 | - public function canShow(int|null $access_level = null): bool |
|
242 | + public function canShow(int | null $access_level = null): bool |
|
243 | 243 | { |
244 | 244 | $access_level ??= Auth::accessLevel($this->tree); |
245 | 245 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | * |
262 | 262 | * @return bool |
263 | 263 | */ |
264 | - public function canShowName(int|null $access_level = null): bool |
|
264 | + public function canShowName(int | null $access_level = null): bool |
|
265 | 265 | { |
266 | 266 | return $this->canShow($access_level); |
267 | 267 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @return void |
425 | 425 | */ |
426 | - public function setPrimaryName(int|null $n = null): void |
|
426 | + public function setPrimaryName(int | null $n = null): void |
|
427 | 427 | { |
428 | 428 | $this->getPrimaryName = $n; |
429 | 429 | $this->getSecondaryName = null; |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | * |
475 | 475 | * @return string|null |
476 | 476 | */ |
477 | - public function alternateName(): string|null |
|
477 | + public function alternateName(): string | null |
|
478 | 478 | { |
479 | 479 | if ($this->canShowName() && $this->getPrimaryName() !== $this->getSecondaryName()) { |
480 | 480 | $all_names = $this->getAllNames(); |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | public function facts( |
603 | 603 | array $filter = [], |
604 | 604 | bool $sort = false, |
605 | - int|null $access_level = null, |
|
605 | + int | null $access_level = null, |
|
606 | 606 | bool $ignore_deleted = false |
607 | 607 | ): Collection { |
608 | 608 | $access_level ??= Auth::accessLevel($this->tree); |
@@ -344,7 +344,7 @@ |
||
344 | 344 | private function fetchIpRangesForAsn(string $asn): array |
345 | 345 | { |
346 | 346 | return Registry::cache()->file()->remember('whois-asn-' . $asn, static function () use ($asn): array { |
347 | - $mapper = static fn (AsnRouteInfo $route_info): RangeInterface|null => IPFactory::parseRangeString($route_info->route ?: $route_info->route6); |
|
347 | + $mapper = static fn (AsnRouteInfo $route_info): RangeInterface | null => IPFactory::parseRangeString($route_info->route ?: $route_info->route6); |
|
348 | 348 | |
349 | 349 | try { |
350 | 350 | $loader = new CurlLoader(self::WHOIS_TIMEOUT); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | return $response; |
101 | 101 | } |
102 | 102 | |
103 | - protected function compressionMethod(RequestInterface $request): string|null |
|
103 | + protected function compressionMethod(RequestInterface $request): string | null |
|
104 | 104 | { |
105 | 105 | $accept_encoding = strtolower($request->getHeaderLine('accept-encoding')); |
106 | 106 | $zlib_available = extension_loaded('zlib'); |
@@ -69,7 +69,7 @@ |
||
69 | 69 | * |
70 | 70 | * @return object{id:string,year:int,fact:string,type:string}|null |
71 | 71 | */ |
72 | - private function eventQuery(string $fact, string $operation): object|null |
|
72 | + private function eventQuery(string $fact, string $operation): object | null |
|
73 | 73 | { |
74 | 74 | return DB::table('dates') |
75 | 75 | ->select(['d_gid as id', 'd_year as year', 'd_fact AS fact', 'd_type AS type']) |
@@ -218,7 +218,7 @@ |
||
218 | 218 | * |
219 | 219 | * @return object{id:string,year:int,fact:string,type:string}|null |
220 | 220 | */ |
221 | - private function eventQuery(string $direction): object|null |
|
221 | + private function eventQuery(string $direction): object | null |
|
222 | 222 | { |
223 | 223 | return DB::table('dates') |
224 | 224 | ->select(['d_gid as id', 'd_year as year', 'd_fact AS fact', 'd_type AS type']) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @return bool |
57 | 57 | */ |
58 | - public static function isAdmin(UserInterface|null $user = null): bool |
|
58 | + public static function isAdmin(UserInterface | null $user = null): bool |
|
59 | 59 | { |
60 | 60 | $user ??= self::user(); |
61 | 61 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return bool |
72 | 72 | */ |
73 | - public static function isManager(Tree $tree, UserInterface|null $user = null): bool |
|
73 | + public static function isManager(Tree $tree, UserInterface | null $user = null): bool |
|
74 | 74 | { |
75 | 75 | $user ??= self::user(); |
76 | 76 | |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | * |
86 | 86 | * @return bool |
87 | 87 | */ |
88 | - public static function isModerator(Tree $tree, UserInterface|null $user = null): bool |
|
88 | + public static function isModerator(Tree $tree, UserInterface | null $user = null): bool |
|
89 | 89 | { |
90 | 90 | $user ??= self::user(); |
91 | 91 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @return bool |
104 | 104 | */ |
105 | - public static function isEditor(Tree $tree, UserInterface|null $user = null): bool |
|
105 | + public static function isEditor(Tree $tree, UserInterface | null $user = null): bool |
|
106 | 106 | { |
107 | 107 | $user ??= self::user(); |
108 | 108 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return bool |
121 | 121 | */ |
122 | - public static function isMember(Tree $tree, UserInterface|null $user = null): bool |
|
122 | + public static function isMember(Tree $tree, UserInterface | null $user = null): bool |
|
123 | 123 | { |
124 | 124 | $user ??= self::user(); |
125 | 125 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * |
137 | 137 | * @return int |
138 | 138 | */ |
139 | - public static function accessLevel(Tree $tree, UserInterface|null $user = null): int |
|
139 | + public static function accessLevel(Tree $tree, UserInterface | null $user = null): int |
|
140 | 140 | { |
141 | 141 | $user ??= self::user(); |
142 | 142 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | /** |
155 | 155 | * The ID of the authenticated user, from the current session. |
156 | 156 | */ |
157 | - public static function id(): int|null |
|
157 | + public static function id(): int | null |
|
158 | 158 | { |
159 | 159 | $wt_user = Session::get('wt_user'); |
160 | 160 | |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @throws HttpNotFoundException |
222 | 222 | * @throws HttpAccessDeniedException |
223 | 223 | */ |
224 | - public static function checkFamilyAccess(Family|null $family, bool $edit = false): Family |
|
224 | + public static function checkFamilyAccess(Family | null $family, bool $edit = false): Family |
|
225 | 225 | { |
226 | 226 | $message = I18N::translate('This family does not exist or you do not have permission to view it.'); |
227 | 227 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | * @throws HttpNotFoundException |
251 | 251 | * @throws HttpAccessDeniedException |
252 | 252 | */ |
253 | - public static function checkHeaderAccess(Header|null $header, bool $edit = false): Header |
|
253 | + public static function checkHeaderAccess(Header | null $header, bool $edit = false): Header |
|
254 | 254 | { |
255 | 255 | $message = I18N::translate('This record does not exist or you do not have permission to view it.'); |
256 | 256 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @throws HttpNotFoundException |
281 | 281 | * @throws HttpAccessDeniedException |
282 | 282 | */ |
283 | - public static function checkIndividualAccess(Individual|null $individual, bool $edit = false, bool $chart = false): Individual |
|
283 | + public static function checkIndividualAccess(Individual | null $individual, bool $edit = false, bool $chart = false): Individual |
|
284 | 284 | { |
285 | 285 | $message = I18N::translate('This individual does not exist or you do not have permission to view it.'); |
286 | 286 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | * @throws HttpNotFoundException |
314 | 314 | * @throws HttpAccessDeniedException |
315 | 315 | */ |
316 | - public static function checkLocationAccess(Location|null $location, bool $edit = false): Location |
|
316 | + public static function checkLocationAccess(Location | null $location, bool $edit = false): Location |
|
317 | 317 | { |
318 | 318 | $message = I18N::translate('This record does not exist or you do not have permission to view it.'); |
319 | 319 | |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | * @throws HttpNotFoundException |
343 | 343 | * @throws HttpAccessDeniedException |
344 | 344 | */ |
345 | - public static function checkMediaAccess(Media|null $media, bool $edit = false): Media |
|
345 | + public static function checkMediaAccess(Media | null $media, bool $edit = false): Media |
|
346 | 346 | { |
347 | 347 | $message = I18N::translate('This media object does not exist or you do not have permission to view it.'); |
348 | 348 | |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | * @throws HttpNotFoundException |
372 | 372 | * @throws HttpAccessDeniedException |
373 | 373 | */ |
374 | - public static function checkNoteAccess(Note|null $note, bool $edit = false): Note |
|
374 | + public static function checkNoteAccess(Note | null $note, bool $edit = false): Note |
|
375 | 375 | { |
376 | 376 | $message = I18N::translate('This note does not exist or you do not have permission to view it.'); |
377 | 377 | |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | * @throws HttpNotFoundException |
401 | 401 | * @throws HttpAccessDeniedException |
402 | 402 | */ |
403 | - public static function checkSharedNoteAccess(SharedNote|null $shared_note, bool $edit = false): SharedNote |
|
403 | + public static function checkSharedNoteAccess(SharedNote | null $shared_note, bool $edit = false): SharedNote |
|
404 | 404 | { |
405 | 405 | $message = I18N::translate('This note does not exist or you do not have permission to view it.'); |
406 | 406 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | * @throws HttpNotFoundException |
430 | 430 | * @throws HttpAccessDeniedException |
431 | 431 | */ |
432 | - public static function checkRecordAccess(GedcomRecord|null $record, bool $edit = false): GedcomRecord |
|
432 | + public static function checkRecordAccess(GedcomRecord | null $record, bool $edit = false): GedcomRecord |
|
433 | 433 | { |
434 | 434 | $message = I18N::translate('This record does not exist or you do not have permission to view it.'); |
435 | 435 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | * @throws HttpNotFoundException |
459 | 459 | * @throws HttpAccessDeniedException |
460 | 460 | */ |
461 | - public static function checkRepositoryAccess(Repository|null $repository, bool $edit = false): Repository |
|
461 | + public static function checkRepositoryAccess(Repository | null $repository, bool $edit = false): Repository |
|
462 | 462 | { |
463 | 463 | $message = I18N::translate('This repository does not exist or you do not have permission to view it.'); |
464 | 464 | |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | * @throws HttpNotFoundException |
488 | 488 | * @throws HttpAccessDeniedException |
489 | 489 | */ |
490 | - public static function checkSourceAccess(Source|null $source, bool $edit = false): Source |
|
490 | + public static function checkSourceAccess(Source | null $source, bool $edit = false): Source |
|
491 | 491 | { |
492 | 492 | $message = I18N::translate('This source does not exist or you do not have permission to view it.'); |
493 | 493 | |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @throws HttpNotFoundException |
517 | 517 | * @throws HttpAccessDeniedException |
518 | 518 | */ |
519 | - public static function checkSubmitterAccess(Submitter|null $submitter, bool $edit = false): Submitter |
|
519 | + public static function checkSubmitterAccess(Submitter | null $submitter, bool $edit = false): Submitter |
|
520 | 520 | { |
521 | 521 | $message = I18N::translate('This record does not exist or you do not have permission to view it.'); |
522 | 522 | |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | * @throws HttpNotFoundException |
546 | 546 | * @throws HttpAccessDeniedException |
547 | 547 | */ |
548 | - public static function checkSubmissionAccess(Submission|null $submission, bool $edit = false): Submission |
|
548 | + public static function checkSubmissionAccess(Submission | null $submission, bool $edit = false): Submission |
|
549 | 549 | { |
550 | 550 | $message = I18N::translate('This record does not exist or you do not have permission to view it.'); |
551 | 551 |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @return int|null |
73 | 73 | */ |
74 | - public function id(): int|null |
|
74 | + public function id(): int | null |
|
75 | 75 | { |
76 | 76 | // The "top-level" location won't exist in the database. |
77 | 77 | if ($this->parts->isEmpty()) { |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | /** |
171 | 171 | * Latitude of the location. |
172 | 172 | */ |
173 | - public function latitude(): float|null |
|
173 | + public function latitude(): float | null |
|
174 | 174 | { |
175 | 175 | return $this->details()->latitude; |
176 | 176 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | /** |
179 | 179 | * Longitude of the location. |
180 | 180 | */ |
181 | - public function longitude(): float|null |
|
181 | + public function longitude(): float | null |
|
182 | 182 | { |
183 | 183 | return $this->details()->longitude; |
184 | 184 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | /** |
278 | 278 | * Get the PLAC:MAP:LATI for the fact. |
279 | 279 | */ |
280 | - public function latitude(): float|null |
|
280 | + public function latitude(): float | null |
|
281 | 281 | { |
282 | 282 | if (preg_match('/\n4 LATI (.+)/', $this->gedcom, $match)) { |
283 | 283 | $gedcom_service = new GedcomService(); |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | /** |
292 | 292 | * Get the PLAC:MAP:LONG for the fact. |
293 | 293 | */ |
294 | - public function longitude(): float|null |
|
294 | + public function longitude(): float | null |
|
295 | 295 | { |
296 | 296 | if (preg_match('/\n4 LONG (.+)/', $this->gedcom, $match)) { |
297 | 297 | $gedcom_service = new GedcomService(); |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | * |
310 | 310 | * @return bool |
311 | 311 | */ |
312 | - public function canShow(int|null $access_level = null): bool |
|
312 | + public function canShow(int | null $access_level = null): bool |
|
313 | 313 | { |
314 | 314 | $access_level ??= Auth::accessLevel($this->record->tree()); |
315 | 315 |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | */ |
126 | 126 | public function isBetween(int $minimum, int $maximum): self |
127 | 127 | { |
128 | - $this->rules[] = static function (int|null $value) use ($minimum, $maximum): int|null { |
|
128 | + $this->rules[] = static function (int | null $value) use ($minimum, $maximum): int | null { |
|
129 | 129 | if (is_int($value) && $value >= $minimum && $value <= $maximum) { |
130 | 130 | return $value; |
131 | 131 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | public function isInArray(array $values): self |
145 | 145 | { |
146 | - $this->rules[] = static fn (int|string|null $value): int|string|null => in_array($value, $values, true) ? $value : null; |
|
146 | + $this->rules[] = static fn (int | string | null $value): int | string | null => in_array($value, $values, true) ? $value : null; |
|
147 | 147 | |
148 | 148 | return $this; |
149 | 149 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | */ |
164 | 164 | public function isNotEmpty(): self |
165 | 165 | { |
166 | - $this->rules[] = static fn (string|null $value): string|null => $value !== null && $value !== '' ? $value : null; |
|
166 | + $this->rules[] = static fn (string | null $value): string | null => $value !== null && $value !== '' ? $value : null; |
|
167 | 167 | |
168 | 168 | return $this; |
169 | 169 | } |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | $base_url = $this->request->getAttribute('base_url', ''); |
177 | 177 | |
178 | - $this->rules[] = static function (string|null $value) use ($base_url): string|null { |
|
178 | + $this->rules[] = static function (string | null $value) use ($base_url): string | null { |
|
179 | 179 | if ($value !== null) { |
180 | 180 | $value_info = parse_url($value); |
181 | 181 | $base_url_info = parse_url($base_url); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function isTag(): self |
206 | 206 | { |
207 | - $this->rules[] = static function (string|null $value): string|null { |
|
207 | + $this->rules[] = static function (string | null $value): string | null { |
|
208 | 208 | if ($value !== null && preg_match('/^' . Gedcom::REGEX_TAG . '$/', $value) === 1) { |
209 | 209 | return $value; |
210 | 210 | } |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | * |
248 | 248 | * @return bool |
249 | 249 | */ |
250 | - public function boolean(string $parameter, bool|null $default = null): bool |
|
250 | + public function boolean(string $parameter, bool | null $default = null): bool |
|
251 | 251 | { |
252 | 252 | $value = $this->parameters[$parameter] ?? null; |
253 | 253 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); |
280 | 280 | } |
281 | 281 | |
282 | - $callback = static fn (array|null $value, Closure $rule): array|null => $rule($value); |
|
282 | + $callback = static fn (array | null $value, Closure $rule): array | null => $rule($value); |
|
283 | 283 | |
284 | 284 | return array_reduce($this->rules, $callback, $value) ?? []; |
285 | 285 | } |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @return float |
292 | 292 | */ |
293 | - public function float(string $parameter, float|null $default = null): float |
|
293 | + public function float(string $parameter, float | null $default = null): float |
|
294 | 294 | { |
295 | 295 | $value = $this->parameters[$parameter] ?? null; |
296 | 296 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | $value = null; |
301 | 301 | } |
302 | 302 | |
303 | - $callback = static fn (?float $value, Closure $rule): float|null => $rule($value); |
|
303 | + $callback = static fn (?float $value, Closure $rule) : float | null => $rule($value); |
|
304 | 304 | |
305 | 305 | $value = array_reduce($this->rules, $callback, $value) ?? $default; |
306 | 306 | |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @return int |
319 | 319 | */ |
320 | - public function integer(string $parameter, int|null $default = null): int |
|
320 | + public function integer(string $parameter, int | null $default = null): int |
|
321 | 321 | { |
322 | 322 | $value = $this->parameters[$parameter] ?? null; |
323 | 323 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | $value = null; |
334 | 334 | } |
335 | 335 | |
336 | - $callback = static fn (int|null $value, Closure $rule): int|null => $rule($value); |
|
336 | + $callback = static fn (int | null $value, Closure $rule): int | null => $rule($value); |
|
337 | 337 | |
338 | 338 | $value = array_reduce($this->rules, $callback, $value) ?? $default; |
339 | 339 | |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @return string |
368 | 368 | */ |
369 | - public function string(string $parameter, string|null $default = null): string |
|
369 | + public function string(string $parameter, string | null $default = null): string |
|
370 | 370 | { |
371 | 371 | $value = $this->parameters[$parameter] ?? null; |
372 | 372 | |
@@ -374,9 +374,9 @@ discard block |
||
374 | 374 | $value = null; |
375 | 375 | } |
376 | 376 | |
377 | - $callback = static fn (string|null $value, Closure $rule): string|null => $rule($value); |
|
377 | + $callback = static fn (string | null $value, Closure $rule): string | null => $rule($value); |
|
378 | 378 | |
379 | - $value = array_reduce($this->rules, $callback, $value) ?? $default; |
|
379 | + $value = array_reduce($this->rules, $callback, $value) ?? $default; |
|
380 | 380 | |
381 | 381 | if ($value === null) { |
382 | 382 | throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | throw new HttpBadRequestException(I18N::translate('The parameter “%s” is missing.', $parameter)); |
402 | 402 | } |
403 | 403 | |
404 | - public function treeOptional(string $parameter = 'tree'): Tree|null |
|
404 | + public function treeOptional(string $parameter = 'tree'): Tree | null |
|
405 | 405 | { |
406 | 406 | $value = $this->parameters[$parameter] ?? null; |
407 | 407 |