@@ -726,7 +726,7 @@ |
||
| 726 | 726 | |
| 727 | 727 | $lines = explode("\n", $str); |
| 728 | 728 | |
| 729 | - $lines = array_map(fn (string $string): string => $this->utf8WordWrap($string, $line_width), $lines); |
|
| 729 | + $lines = array_map(fn(string $string): string => $this->utf8WordWrap($string, $line_width), $lines); |
|
| 730 | 730 | |
| 731 | 731 | return implode("\n", $lines); |
| 732 | 732 | } |
@@ -259,7 +259,7 @@ |
||
| 259 | 259 | private function fetchIpRangesForAsn(string $asn): array |
| 260 | 260 | { |
| 261 | 261 | return Registry::cache()->file()->remember('whois-asn-' . $asn, static function () use ($asn): array { |
| 262 | - $mapper = static fn (AsnRouteInfo $route_info): ?RangeInterface => IPFactory::parseRangeString($route_info->route ?: $route_info->route6); |
|
| 262 | + $mapper = static fn(AsnRouteInfo $route_info): ?RangeInterface => IPFactory::parseRangeString($route_info->route ?: $route_info->route6); |
|
| 263 | 263 | |
| 264 | 264 | try { |
| 265 | 265 | $loader = new CurlLoader(self::WHOIS_TIMEOUT); |
@@ -173,19 +173,19 @@ |
||
| 173 | 173 | $ignore_facts = ['CHAN', 'CHIL', 'FAMC', 'FAMS', 'HUSB', 'NOTE', 'OBJE', 'SOUR', 'SUBM', 'WIFE']; |
| 174 | 174 | |
| 175 | 175 | $all_family_facts = Collection::make(Registry::elementFactory()->make('FAM')->subtags()) |
| 176 | - ->filter(static fn (string $value, string $key): bool => !in_array($key, $ignore_facts, true)) |
|
| 177 | - ->mapWithKeys(static fn (string $value, string $key): array => [$key => 'FAM:' . $key]) |
|
| 178 | - ->map(static fn (string $tag): ElementInterface => Registry::elementFactory()->make($tag)) |
|
| 179 | - ->filter(static fn (ElementInterface $element): bool => !$element instanceof UnknownElement) |
|
| 180 | - ->map(static fn (ElementInterface $element): string => $element->label()) |
|
| 176 | + ->filter(static fn(string $value, string $key): bool => !in_array($key, $ignore_facts, true)) |
|
| 177 | + ->mapWithKeys(static fn(string $value, string $key): array => [$key => 'FAM:' . $key]) |
|
| 178 | + ->map(static fn(string $tag): ElementInterface => Registry::elementFactory()->make($tag)) |
|
| 179 | + ->filter(static fn(ElementInterface $element): bool => !$element instanceof UnknownElement) |
|
| 180 | + ->map(static fn(ElementInterface $element): string => $element->label()) |
|
| 181 | 181 | ->sort(I18N::comparator()); |
| 182 | 182 | |
| 183 | 183 | $all_individual_facts = Collection::make(Registry::elementFactory()->make('INDI')->subtags()) |
| 184 | - ->filter(static fn (string $value, string $key): bool => !in_array($key, $ignore_facts, true)) |
|
| 185 | - ->mapWithKeys(static fn (string $value, string $key): array => [$key => 'INDI:' . $key]) |
|
| 186 | - ->map(static fn (string $tag): ElementInterface => Registry::elementFactory()->make($tag)) |
|
| 187 | - ->filter(static fn (ElementInterface $element): bool => !$element instanceof UnknownElement) |
|
| 188 | - ->map(static fn (ElementInterface $element): string => $element->label()) |
|
| 184 | + ->filter(static fn(string $value, string $key): bool => !in_array($key, $ignore_facts, true)) |
|
| 185 | + ->mapWithKeys(static fn(string $value, string $key): array => [$key => 'INDI:' . $key]) |
|
| 186 | + ->map(static fn(string $tag): ElementInterface => Registry::elementFactory()->make($tag)) |
|
| 187 | + ->filter(static fn(ElementInterface $element): bool => !$element instanceof UnknownElement) |
|
| 188 | + ->map(static fn(ElementInterface $element): string => $element->label()) |
|
| 189 | 189 | ->sort(I18N::comparator()); |
| 190 | 190 | |
| 191 | 191 | $all_surname_traditions = SurnameTradition::allDescriptions(); |
@@ -202,7 +202,7 @@ |
||
| 202 | 202 | ->where('id', '=', $location->id) |
| 203 | 203 | ->delete(); |
| 204 | 204 | } else { |
| 205 | - $place_ids = $places->map(static fn (object $place): int => (int) $place->p_id)->all(); |
|
| 205 | + $place_ids = $places->map(static fn(object $place): int => (int) $place->p_id)->all(); |
|
| 206 | 206 | $this->deleteUnusedLocations((int) $location->id, $place_ids); |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | } catch (GuzzleException $ex) { |
| 67 | 67 | // Service down? Quota exceeded? |
| 68 | 68 | // Don't try for another hour. |
| 69 | - $cache->remember($key, fn () => [], 3600); |
|
| 69 | + $cache->remember($key, fn() => [], 3600); |
|
| 70 | 70 | |
| 71 | 71 | return []; |
| 72 | 72 | } |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | $timestamps = array_filter(explode(',', $history)); |
| 107 | 107 | |
| 108 | 108 | // Filter events within our time window. |
| 109 | - $filter = fn (string $x): bool => (int) $x >= $this->now - $seconds && (int) $x <= $this->now; |
|
| 109 | + $filter = fn(string $x): bool => (int) $x >= $this->now - $seconds && (int) $x <= $this->now; |
|
| 110 | 110 | $in_window = array_filter($timestamps, $filter); |
| 111 | 111 | |
| 112 | 112 | if (count($in_window) >= $num) { |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Sort the facts |
| 78 | - $callback = static fn (string $x, string $y): int => array_search($x, $order, true) <=> array_search($y, $order, true); |
|
| 78 | + $callback = static fn(string $x, string $y): int => array_search($x, $order, true) <=> array_search($y, $order, true); |
|
| 79 | 79 | uksort($sort_facts, $callback); |
| 80 | 80 | |
| 81 | 81 | // Merge the facts |
@@ -158,7 +158,7 @@ |
||
| 158 | 158 | $updated = 0; |
| 159 | 159 | |
| 160 | 160 | // Remove places with 0,0 coordinates at lower levels. |
| 161 | - $callback = static fn (array $place): bool => !str_contains($place['name'], ',') || $place['longitude'] !== 0.0 || $place['latitude'] !== 0.0; |
|
| 161 | + $callback = static fn(array $place): bool => !str_contains($place['name'], ',') || $place['longitude'] !== 0.0 || $place['latitude'] !== 0.0; |
|
| 162 | 162 | |
| 163 | 163 | $places = array_filter($places, $callback); |
| 164 | 164 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | */ |
| 81 | 81 | public function isBetween(int $minimum, int $maximum): self |
| 82 | 82 | { |
| 83 | - $this->rules[] = static function (?int $value) use ($minimum, $maximum): ?int { |
|
| 83 | + $this->rules[] = static function (?int $value) use ($minimum, $maximum) : ?int { |
|
| 84 | 84 | if (is_int($value) && $value >= $minimum && $value <= $maximum) { |
| 85 | 85 | return $value; |
| 86 | 86 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function isLocalUrl(string $base_url): self |
| 100 | 100 | { |
| 101 | - $this->rules[] = static function (?string $value) use ($base_url): ?string { |
|
| 101 | + $this->rules[] = static function (?string $value) use ($base_url) : ?string { |
|
| 102 | 102 | if (is_string($value)) { |
| 103 | 103 | $value_info = parse_url($value); |
| 104 | 104 | $base_url_info = parse_url($base_url); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $value = null; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - $callback = static fn (?array $value, Closure $rule): ?array => $rule($value); |
|
| 158 | + $callback = static fn(?array $value, Closure $rule) : ?array => $rule($value); |
|
| 159 | 159 | |
| 160 | 160 | return array_reduce($this->rules, $callback, $value); |
| 161 | 161 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $value = null; |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - $callback = static fn (?int $value, Closure $rule): ?int => $rule($value); |
|
| 178 | + $callback = static fn(?int $value, Closure $rule) : ?int => $rule($value); |
|
| 179 | 179 | |
| 180 | 180 | return array_reduce($this->rules, $callback, $value); |
| 181 | 181 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | $value = null; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - $callback = static fn (?string $value, Closure $rule): ?string => $rule($value); |
|
| 196 | + $callback = static fn(?string $value, Closure $rule) : ?string => $rule($value); |
|
| 197 | 197 | |
| 198 | 198 | return array_reduce($this->rules, $callback, $value); |
| 199 | 199 | } |