@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $path = (string) parse_url($url, PHP_URL_PATH); |
| 70 | 70 | |
| 71 | 71 | // Paths containing UTF-8 characters need special handling. |
| 72 | - $path = implode('/', array_map(static fn (string $x): string => rawurlencode($x), explode('/', $path))); |
|
| 72 | + $path = implode('/', array_map(static fn(string $x): string => rawurlencode($x), explode('/', $path))); |
|
| 73 | 73 | |
| 74 | 74 | session_name($secure ? self::SECURE_SESSION_NAME : self::SESSION_NAME); |
| 75 | 75 | session_register_shutdown(); |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @return array|bool|int|null|string |
| 111 | 111 | */ |
| 112 | - public static function get(string $name, array|bool|int|string $default = null) |
|
| 112 | + public static function get(string $name, array | bool | int | string $default = null) |
|
| 113 | 113 | { |
| 114 | 114 | return $_SESSION[$name] ?? $default; |
| 115 | 115 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | * |
| 122 | 122 | * @return array|bool|int|null|string |
| 123 | 123 | */ |
| 124 | - public static function pull(string $name): array|bool|int|null|string |
|
| 124 | + public static function pull(string $name): array | bool | int | null | string |
|
| 125 | 125 | { |
| 126 | 126 | $value = self::get($name); |
| 127 | 127 | self::forget($name); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * |
| 166 | 166 | * @return void |
| 167 | 167 | */ |
| 168 | - public static function put(string $name, array|bool|int|null|string $value): void |
|
| 168 | + public static function put(string $name, array | bool | int | null | string $value): void |
|
| 169 | 169 | { |
| 170 | 170 | $_SESSION[$name] = $value; |
| 171 | 171 | } |
@@ -296,7 +296,7 @@ |
||
| 296 | 296 | * @param string $abstract |
| 297 | 297 | * @param string|object $concrete |
| 298 | 298 | */ |
| 299 | - public static function set(string $abstract, string|object $concrete): void |
|
| 299 | + public static function set(string $abstract, string | object $concrete): void |
|
| 300 | 300 | { |
| 301 | 301 | if (is_string($concrete)) { |
| 302 | 302 | Container::getInstance()->bind($abstract, $concrete); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * |
| 81 | 81 | * @param array<string>|int|AbstractCalendarDate $date |
| 82 | 82 | */ |
| 83 | - protected function __construct(array|int|AbstractCalendarDate $date) |
|
| 83 | + protected function __construct(array | int | AbstractCalendarDate $date) |
|
| 84 | 84 | { |
| 85 | 85 | // Construct from an integer (a julian day number) |
| 86 | 86 | if (is_int($date)) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $this->month = static::MONTH_TO_NUMBER[$date[1]] ?? 0; |
| 98 | 98 | |
| 99 | 99 | if ($this->month === 0) { |
| 100 | - $this->day = 0; |
|
| 100 | + $this->day = 0; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $this->year = $this->extractYear($date[0]); |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | - public static function digits(string|int $n): string |
|
| 272 | + public static function digits(string | int $n): string |
|
| 273 | 273 | { |
| 274 | 274 | return self::$locale->digits((string) $n); |
| 275 | 275 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | self::$language = $module_service |
| 326 | 326 | ->findByInterface(ModuleLanguageInterface::class) |
| 327 | - ->first(fn (ModuleLanguageInterface $module): bool => $module->locale()->languageTag() === $code); |
|
| 327 | + ->first(fn(ModuleLanguageInterface $module): bool => $module->locale()->languageTag() === $code); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | // Create a translator |
@@ -565,10 +565,10 @@ discard block |
||
| 565 | 565 | public static function comparator(): Closure |
| 566 | 566 | { |
| 567 | 567 | if (self::$collator instanceof Collator) { |
| 568 | - return static fn (string $x, string $y): int => (int) self::$collator->compare($x, $y); |
|
| 568 | + return static fn(string $x, string $y): int => (int) self::$collator->compare($x, $y); |
|
| 569 | 569 | } |
| 570 | 570 | |
| 571 | - return static fn (string $x, string $y): int => strcmp(self::strtolower($x), self::strtolower($y)); |
|
| 571 | + return static fn(string $x, string $y): int => strcmp(self::strtolower($x), self::strtolower($y)); |
|
| 572 | 572 | } |
| 573 | 573 | |
| 574 | 574 | |
@@ -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)); |