diff --git a/formwork/fields/array.php b/formwork/fields/array.php index 9ae799025..a5211ff15 100644 --- a/formwork/fields/array.php +++ b/formwork/fields/array.php @@ -4,7 +4,6 @@ use Formwork\Data\Contracts\Arrayable; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/checkbox.php b/formwork/fields/checkbox.php index 3558eb3d0..75c22fda3 100644 --- a/formwork/fields/checkbox.php +++ b/formwork/fields/checkbox.php @@ -3,7 +3,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/duration.php b/formwork/fields/duration.php index 8b9564465..c39bc5629 100644 --- a/formwork/fields/duration.php +++ b/formwork/fields/duration.php @@ -2,7 +2,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; - use Formwork\Fields\Field; return function (App $app) { diff --git a/formwork/fields/email.php b/formwork/fields/email.php index 533f70de5..562e71761 100644 --- a/formwork/fields/email.php +++ b/formwork/fields/email.php @@ -3,7 +3,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/image.php b/formwork/fields/image.php index 97c7cb0b2..440a31299 100644 --- a/formwork/fields/image.php +++ b/formwork/fields/image.php @@ -3,7 +3,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/number.php b/formwork/fields/number.php index 3a6186e3c..514d650be 100644 --- a/formwork/fields/number.php +++ b/formwork/fields/number.php @@ -2,7 +2,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; - use Formwork\Fields\Field; return function (App $app) { diff --git a/formwork/fields/password.php b/formwork/fields/password.php index 0fa9d469e..341a1320e 100644 --- a/formwork/fields/password.php +++ b/formwork/fields/password.php @@ -3,7 +3,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/range.php b/formwork/fields/range.php index 8b9564465..c39bc5629 100644 --- a/formwork/fields/range.php +++ b/formwork/fields/range.php @@ -2,7 +2,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; - use Formwork\Fields\Field; return function (App $app) { diff --git a/formwork/fields/select.php b/formwork/fields/select.php index 6f7143eeb..db3a7047f 100644 --- a/formwork/fields/select.php +++ b/formwork/fields/select.php @@ -2,7 +2,6 @@ use Formwork\Cms\App; use Formwork\Fields\Field; - use Formwork\Utils\Arr; return function (App $app) { diff --git a/formwork/fields/slug.php b/formwork/fields/slug.php index e24c92ef7..a5fcbd572 100644 --- a/formwork/fields/slug.php +++ b/formwork/fields/slug.php @@ -3,7 +3,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/tags.php b/formwork/fields/tags.php index e87ee6df8..618c4baa5 100644 --- a/formwork/fields/tags.php +++ b/formwork/fields/tags.php @@ -31,7 +31,7 @@ } if ($field->has('pattern')) { - $value = array_filter($value, static fn ($item): bool => Constraint::matchesRegex($item, $field->get('pattern'))); + $value = array_filter($value, static fn($item): bool => Constraint::matchesRegex($item, $field->get('pattern'))); } return array_values(array_filter($value)); diff --git a/formwork/fields/text.php b/formwork/fields/text.php index 0fa9d469e..341a1320e 100644 --- a/formwork/fields/text.php +++ b/formwork/fields/text.php @@ -3,7 +3,6 @@ use Formwork\Cms\App; use Formwork\Fields\Exceptions\ValidationException; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/fields/togglegroup.php b/formwork/fields/togglegroup.php index f0aeb4706..a3a590f88 100644 --- a/formwork/fields/togglegroup.php +++ b/formwork/fields/togglegroup.php @@ -2,7 +2,6 @@ use Formwork\Cms\App; use Formwork\Fields\Field; - use Formwork\Utils\Constraint; return function (App $app) { diff --git a/formwork/helpers.php b/formwork/helpers.php index 06b7a23f1..991cf4a2b 100644 --- a/formwork/helpers.php +++ b/formwork/helpers.php @@ -64,6 +64,6 @@ return Date::formatTimestampAsDistance($timestamp, $app->translations()->getCurrent()); }, - 'translate' => fn (string $key, ...$arguments) => $app->translations()->getCurrent()->translate($key, ...$arguments), + 'translate' => fn(string $key, ...$arguments) => $app->translations()->getCurrent()->translate($key, ...$arguments), ]; }; diff --git a/formwork/server.php b/formwork/server.php index 2002e6f5d..502c7b63d 100644 --- a/formwork/server.php +++ b/formwork/server.php @@ -18,7 +18,7 @@ } // Log requests to the console as if they were not rewritten -register_shutdown_function(fn () => error_log(sprintf( +register_shutdown_function(fn() => error_log(sprintf( '%s:%d [%d]: %s %s', $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], diff --git a/formwork/src/Backup/Backupper.php b/formwork/src/Backup/Backupper.php index ccbfc9af4..f896bdfa9 100644 --- a/formwork/src/Backup/Backupper.php +++ b/formwork/src/Backup/Backupper.php @@ -19,8 +19,7 @@ final class Backupper */ public function __construct( private array $options, - ) { - } + ) {} /** * Make a backup of all site files diff --git a/formwork/src/Cache/CacheItem.php b/formwork/src/Cache/CacheItem.php index d0aa5e716..4ae541486 100644 --- a/formwork/src/Cache/CacheItem.php +++ b/formwork/src/Cache/CacheItem.php @@ -8,8 +8,7 @@ public function __construct( protected mixed $value, protected int $expirationTime, protected int $cachedTime, - ) { - } + ) {} /** * Return the cached value diff --git a/formwork/src/Cms/App.php b/formwork/src/Cms/App.php index c5e217812..97ee96a22 100644 --- a/formwork/src/Cms/App.php +++ b/formwork/src/Cms/App.php @@ -190,9 +190,9 @@ private function loadServices(Container $container): void ->alias('config'); $container->define(ViewFactory::class) - ->parameter('methods', fn (Container $container) => $container->call(require SYSTEM_PATH . '/helpers.php')); + ->parameter('methods', fn(Container $container) => $container->call(require SYSTEM_PATH . '/helpers.php')); - $container->define(Request::class, fn () => Request::fromGlobals()) + $container->define(Request::class, fn() => Request::fromGlobals()) ->alias('request'); $container->define(ErrorsController::class) @@ -233,13 +233,13 @@ private function loadServices(Container $container): void ->alias('templates'); $container->define(Statistics::class) - ->parameter('path', fn (Config $config) => $config->get('system.statistics.path')) - ->parameter('translation', fn (Translations $translations) => $translations->getCurrent()) + ->parameter('path', fn(Config $config) => $config->get('system.statistics.path')) + ->parameter('translation', fn(Translations $translations) => $translations->getCurrent()) ->alias('statistics'); $container->define(FilesCache::class) - ->parameter('path', fn (Config $config) => $config->get('system.cache.path')) - ->parameter('defaultTtl', fn (Config $config) => $config->get('system.cache.time')) + ->parameter('path', fn(Config $config) => $config->get('system.cache.path')) + ->parameter('defaultTtl', fn(Config $config) => $config->get('system.cache.time')) ->alias(AbstractCache::class) ->alias('cache'); diff --git a/formwork/src/Cms/Site.php b/formwork/src/Cms/Site.php index 2ab6e67f0..da027fd22 100644 --- a/formwork/src/Cms/Site.php +++ b/formwork/src/Cms/Site.php @@ -131,7 +131,7 @@ public function defaults(): array { $defaults = $this->config->getDefaults('site'); - return [...$defaults, ...Arr::reject($this->fields()->pluck('default'), fn ($value) => $value === null)]; + return [...$defaults, ...Arr::reject($this->fields()->pluck('default'), fn($value) => $value === null)]; } public function parent(): Page|Site|null diff --git a/formwork/src/Commands/ServeCommand.php b/formwork/src/Commands/ServeCommand.php index aefff85ef..40204211d 100644 --- a/formwork/src/Commands/ServeCommand.php +++ b/formwork/src/Commands/ServeCommand.php @@ -135,7 +135,7 @@ private function handleOutput(array $lines): void $this->climate->br(); $input = $this->climate->input('➜ Enter another port:'); - $input->accept(fn (string $response) => ctype_digit($response)); + $input->accept(fn(string $response) => ctype_digit($response)); $this->port = (int) $input->prompt(); diff --git a/formwork/src/Config/Config.php b/formwork/src/Config/Config.php index bef257444..3c483da6f 100644 --- a/formwork/src/Config/Config.php +++ b/formwork/src/Config/Config.php @@ -28,8 +28,7 @@ class Config implements ArraySerializable final public function __construct( protected array $config = [], protected array $defaults = [], - ) { - } + ) {} /** * Check if a key exists in the config diff --git a/formwork/src/Config/Exceptions/ConfigResolutionException.php b/formwork/src/Config/Exceptions/ConfigResolutionException.php index ce98613ee..c2a1ca12f 100644 --- a/formwork/src/Config/Exceptions/ConfigResolutionException.php +++ b/formwork/src/Config/Exceptions/ConfigResolutionException.php @@ -4,6 +4,4 @@ use RuntimeException; -class ConfigResolutionException extends RuntimeException -{ -} +class ConfigResolutionException extends RuntimeException {} diff --git a/formwork/src/Config/Exceptions/UnresolvedConfigException.php b/formwork/src/Config/Exceptions/UnresolvedConfigException.php index 3c6fdce06..e3a763750 100644 --- a/formwork/src/Config/Exceptions/UnresolvedConfigException.php +++ b/formwork/src/Config/Exceptions/UnresolvedConfigException.php @@ -4,6 +4,4 @@ use RuntimeException; -class UnresolvedConfigException extends RuntimeException -{ -} +class UnresolvedConfigException extends RuntimeException {} diff --git a/formwork/src/Data/AbstractCollection.php b/formwork/src/Data/AbstractCollection.php index 9591d85bf..b8c92c17f 100644 --- a/formwork/src/Data/AbstractCollection.php +++ b/formwork/src/Data/AbstractCollection.php @@ -62,7 +62,7 @@ public function __construct(array $data = []) )); } - if ($this->dataType !== null && !Arr::every($data, fn ($value) => Constraint::isOfType($value, $this->dataType, unionTypes: true))) { + if ($this->dataType !== null && !Arr::every($data, fn($value) => Constraint::isOfType($value, $this->dataType, unionTypes: true))) { throw new LogicException('Typed collections cannot be created from data of different types'); } @@ -245,7 +245,7 @@ public function clone(): static public function deepClone(): static { $clone = $this->clone(); - $clone->data = Arr::map($clone->data, fn ($value) => is_object($value) ? clone $value : $value); + $clone->data = Arr::map($clone->data, fn($value) => is_object($value) ? clone $value : $value); return $clone; } @@ -416,7 +416,7 @@ public function filterBy(string $key, mixed $value = true, mixed $default = null $strict ??= true; } - return $this->filter(fn ($v, $k) => Constraint::isEqualTo($values[$k], $comparison ??= $value, $strict ??= false)); + return $this->filter(fn($v, $k) => Constraint::isEqualTo($values[$k], $comparison ??= $value, $strict ??= false)); } /** @@ -440,7 +440,7 @@ public function sortBy( public function groupBy(string $key, mixed $default = null): array { $values = $this->pluck($key, $default); - return $this->group(fn ($v, $k) => $values[$k]); + return $this->group(fn($v, $k) => $values[$k]); } /** diff --git a/formwork/src/Data/CollectionDataProxy.php b/formwork/src/Data/CollectionDataProxy.php index 4d5ec26cc..f96168f07 100644 --- a/formwork/src/Data/CollectionDataProxy.php +++ b/formwork/src/Data/CollectionDataProxy.php @@ -6,8 +6,7 @@ final class CollectionDataProxy { public function __construct( private AbstractCollection $collection, - ) { - } + ) {} public function __get(string $name): Collection { diff --git a/formwork/src/Exceptions/RecursionException.php b/formwork/src/Exceptions/RecursionException.php index 393400119..23aafc7ba 100644 --- a/formwork/src/Exceptions/RecursionException.php +++ b/formwork/src/Exceptions/RecursionException.php @@ -4,6 +4,4 @@ use RuntimeException; -class RecursionException extends RuntimeException -{ -} +class RecursionException extends RuntimeException {} diff --git a/formwork/src/Fields/Dynamic/DynamicFieldValue.php b/formwork/src/Fields/Dynamic/DynamicFieldValue.php index 187642d7d..95c566548 100644 --- a/formwork/src/Fields/Dynamic/DynamicFieldValue.php +++ b/formwork/src/Fields/Dynamic/DynamicFieldValue.php @@ -46,8 +46,7 @@ public function __construct( protected string $key, protected string $uncomputedValue, protected Field $field, - ) { - } + ) {} /** * Create an instance with an already computed value diff --git a/formwork/src/Fields/Exceptions/ValidationException.php b/formwork/src/Fields/Exceptions/ValidationException.php index e0dd2239d..fb3d1ac59 100644 --- a/formwork/src/Fields/Exceptions/ValidationException.php +++ b/formwork/src/Fields/Exceptions/ValidationException.php @@ -4,6 +4,4 @@ use Formwork\Data\Exceptions\InvalidValueException; -class ValidationException extends InvalidValueException -{ -} +class ValidationException extends InvalidValueException {} diff --git a/formwork/src/Fields/Field.php b/formwork/src/Fields/Field.php index 7096860e7..84a6250e6 100644 --- a/formwork/src/Fields/Field.php +++ b/formwork/src/Fields/Field.php @@ -353,7 +353,7 @@ protected function translate(mixed $value): mixed return $value; } - $interpolate = fn ($value) => is_string($value) ? Str::interpolate($value, fn ($key) => $this->translation->translate($key)) : $value; + $interpolate = fn($value) => is_string($value) ? Str::interpolate($value, fn($key) => $this->translation->translate($key)) : $value; if (is_array($value)) { return Arr::map($value, $interpolate); diff --git a/formwork/src/Fields/FieldCollection.php b/formwork/src/Fields/FieldCollection.php index df80343e4..1fa27ea76 100644 --- a/formwork/src/Fields/FieldCollection.php +++ b/formwork/src/Fields/FieldCollection.php @@ -77,7 +77,7 @@ public function validate(): static */ public function isValid(): bool { - return $this->every(fn ($field) => $field->isValid()); + return $this->every(fn($field) => $field->isValid()); } /** @@ -85,7 +85,7 @@ public function isValid(): bool */ public function isValidated(): bool { - return $this->every(fn ($field) => $field->isValidated()); + return $this->every(fn($field) => $field->isValidated()); } /** diff --git a/formwork/src/Fields/FieldFactory.php b/formwork/src/Fields/FieldFactory.php index 5a8b581bc..75a63b435 100644 --- a/formwork/src/Fields/FieldFactory.php +++ b/formwork/src/Fields/FieldFactory.php @@ -13,8 +13,7 @@ public function __construct( private Container $container, private Config $config, private Translations $translations, - ) { - } + ) {} /** * Create a new Field instance diff --git a/formwork/src/Fields/Layout/Section.php b/formwork/src/Fields/Layout/Section.php index 9212c2ce6..811dbd066 100644 --- a/formwork/src/Fields/Layout/Section.php +++ b/formwork/src/Fields/Layout/Section.php @@ -33,6 +33,6 @@ public function is(string $key, bool $default = false): bool */ public function label(): string { - return Str::interpolate($this->get('label', ''), fn ($key) => $this->translation->translate($key)); + return Str::interpolate($this->get('label', ''), fn($key) => $this->translation->translate($key)); } } diff --git a/formwork/src/Fields/Layout/SectionCollection.php b/formwork/src/Fields/Layout/SectionCollection.php index 7c98b4c3a..e0b3d3084 100644 --- a/formwork/src/Fields/Layout/SectionCollection.php +++ b/formwork/src/Fields/Layout/SectionCollection.php @@ -17,6 +17,6 @@ class SectionCollection extends AbstractCollection */ public function __construct(array $sections, Translation $translation) { - parent::__construct(Arr::map($sections, fn ($section) => new Section($section, $translation))); + parent::__construct(Arr::map($sections, fn($section) => new Section($section, $translation))); } } diff --git a/formwork/src/Files/Exceptions/FileUriGenerationException.php b/formwork/src/Files/Exceptions/FileUriGenerationException.php index f970b4b9b..39fafce93 100644 --- a/formwork/src/Files/Exceptions/FileUriGenerationException.php +++ b/formwork/src/Files/Exceptions/FileUriGenerationException.php @@ -4,6 +4,4 @@ use RuntimeException; -class FileUriGenerationException extends RuntimeException -{ -} +class FileUriGenerationException extends RuntimeException {} diff --git a/formwork/src/Files/File.php b/formwork/src/Files/File.php index 7b47a77f2..ef2b2f115 100644 --- a/formwork/src/Files/File.php +++ b/formwork/src/Files/File.php @@ -257,7 +257,7 @@ public function setScheme(Scheme $scheme): void private function matchExtensions(array $extensions): bool { $mimeTypes = array_map( - static fn (string $extension): string => MimeType::fromExtension($extension), + static fn(string $extension): string => MimeType::fromExtension($extension), $extensions ); return in_array($this->mimeType, $mimeTypes, true); diff --git a/formwork/src/Files/FileCollection.php b/formwork/src/Files/FileCollection.php index 014b6b7ef..2288bfe6e 100644 --- a/formwork/src/Files/FileCollection.php +++ b/formwork/src/Files/FileCollection.php @@ -17,7 +17,7 @@ class FileCollection extends AbstractCollection public function __construct(array $data = []) { if (!Arr::isAssociative($data)) { - $data = Arr::mapKeys($data, fn ($key, File $file) => $file->name()); + $data = Arr::mapKeys($data, fn($key, File $file) => $file->name()); } parent::__construct($data); diff --git a/formwork/src/Files/FileFactory.php b/formwork/src/Files/FileFactory.php index 7aafcd78d..59fecacd2 100644 --- a/formwork/src/Files/FileFactory.php +++ b/formwork/src/Files/FileFactory.php @@ -20,8 +20,7 @@ public function __construct( private Config $config, private Schemes $schemes, private array $associations = [], - ) { - } + ) {} /** * Create a new File instance diff --git a/formwork/src/Files/FileUriGenerator.php b/formwork/src/Files/FileUriGenerator.php index 68bb42ec1..4a9834f08 100644 --- a/formwork/src/Files/FileUriGenerator.php +++ b/formwork/src/Files/FileUriGenerator.php @@ -19,8 +19,7 @@ public function __construct( protected Router $router, protected Request $request, protected Site $site, - ) { - } + ) {} /** * Generate URI for the given File diff --git a/formwork/src/Files/Services/FileUploader.php b/formwork/src/Files/Services/FileUploader.php index 9e0700456..5fc6d6fd3 100644 --- a/formwork/src/Files/Services/FileUploader.php +++ b/formwork/src/Files/Services/FileUploader.php @@ -25,7 +25,7 @@ public function __construct( protected Config $config, protected FileFactory $fileFactory, ) { - $this->allowedMimeTypes = Arr::map($this->config->get('system.files.allowedExtensions'), fn (string $ext) => MimeType::fromExtension($ext)); + $this->allowedMimeTypes = Arr::map($this->config->get('system.files.allowedExtensions'), fn(string $ext) => MimeType::fromExtension($ext)); } /** diff --git a/formwork/src/Http/Client.php b/formwork/src/Http/Client.php index fefa5213d..a1db4f218 100644 --- a/formwork/src/Http/Client.php +++ b/formwork/src/Http/Client.php @@ -160,7 +160,7 @@ protected function connect(string $uri, array $options = []): array if (($handle = @fopen($uri, 'r', false, $context)) === false) { $messages = implode("\n", array_map( - static fn (int $i, array $error): string => sprintf('#%d %s', $i, str_replace("\n", ' ', $error['message'])), + static fn(int $i, array $error): string => sprintf('#%d %s', $i, str_replace("\n", ' ', $error['message'])), array_keys($errors), $errors )); diff --git a/formwork/src/Http/Exceptions/ConnectionException.php b/formwork/src/Http/Exceptions/ConnectionException.php index 8e48c1d92..547854861 100644 --- a/formwork/src/Http/Exceptions/ConnectionException.php +++ b/formwork/src/Http/Exceptions/ConnectionException.php @@ -4,6 +4,4 @@ use RuntimeException; -class ConnectionException extends RuntimeException -{ -} +class ConnectionException extends RuntimeException {} diff --git a/formwork/src/Http/FilesData.php b/formwork/src/Http/FilesData.php index a68f938a5..85de593bf 100644 --- a/formwork/src/Http/FilesData.php +++ b/formwork/src/Http/FilesData.php @@ -15,7 +15,7 @@ public function isEmpty(): bool if (parent::isEmpty()) { return true; } - return Arr::every($this->getAll(), fn (UploadedFile $uploadedFile) => $uploadedFile->isEmpty()); + return Arr::every($this->getAll(), fn(UploadedFile $uploadedFile) => $uploadedFile->isEmpty()); } /** diff --git a/formwork/src/Http/ServerData.php b/formwork/src/Http/ServerData.php index 5fb27626b..1b22b500d 100644 --- a/formwork/src/Http/ServerData.php +++ b/formwork/src/Http/ServerData.php @@ -27,6 +27,6 @@ public function getHeaders(): array } }); - return Arr::mapKeys($headers, fn ($key) => Str::after($key, 'HTTP_')); + return Arr::mapKeys($headers, fn($key) => Str::after($key, 'HTTP_')); } } diff --git a/formwork/src/Images/Exif/ExifReader.php b/formwork/src/Images/Exif/ExifReader.php index faeb01cbc..6c7e1cbaa 100644 --- a/formwork/src/Images/Exif/ExifReader.php +++ b/formwork/src/Images/Exif/ExifReader.php @@ -168,7 +168,7 @@ public function read(string &$data): array case 'rational': $parsedValue = is_array($value) - ? array_map(fn (string $value): float => $this->parseRational($value), $value) + ? array_map(fn(string $value): float => $this->parseRational($value), $value) : $this->parseRational($value); break; @@ -257,7 +257,7 @@ protected function parseBinary(string $value): string protected function parseCoordinates(array $value, ?string $cardinalRef): float { [$degrees, $minutes, $seconds] = array_map( - fn (string $value): float => $this->parseRational($value), + fn(string $value): float => $this->parseRational($value), array_replace(['0', '0', '0'], $value) ); $direction = ($cardinalRef === 'S' || $cardinalRef === 'W') ? -1 : 1; diff --git a/formwork/src/Images/Exif/tables/Exif.php b/formwork/src/Images/Exif/tables/Exif.php index f1765e450..552dfded3 100644 --- a/formwork/src/Images/Exif/tables/Exif.php +++ b/formwork/src/Images/Exif/tables/Exif.php @@ -90,7 +90,7 @@ ], 'ComponentsConfiguration' => [ 'type' => 'binary', - 'description' => fn (string $value) => array_map(fn (string $char) => match ((int) $char) { + 'description' => fn(string $value) => array_map(fn(string $char) => match ((int) $char) { 1 => 'Y', 2 => 'Cb', 3 => 'Cr', @@ -392,7 +392,7 @@ ], 'GPSVersion' => [ 'type' => 'binary', - 'description' => fn (string $value) => sprintf('%d.%d.%d.%d', $value[0], $value[1], $value[2], $value[3]), + 'description' => fn(string $value) => sprintf('%d.%d.%d.%d', $value[0], $value[1], $value[2], $value[3]), ], 'GPSLatitude' => [ 'type' => 'coords', diff --git a/formwork/src/Images/Handler/Exceptions/UnsupportedFeatureException.php b/formwork/src/Images/Handler/Exceptions/UnsupportedFeatureException.php index 566ff9fc0..de9672d59 100644 --- a/formwork/src/Images/Handler/Exceptions/UnsupportedFeatureException.php +++ b/formwork/src/Images/Handler/Exceptions/UnsupportedFeatureException.php @@ -4,6 +4,4 @@ use Exception; -class UnsupportedFeatureException extends Exception -{ -} +class UnsupportedFeatureException extends Exception {} diff --git a/formwork/src/Images/ImageFactory.php b/formwork/src/Images/ImageFactory.php index cc2a9cc47..7640d682c 100644 --- a/formwork/src/Images/ImageFactory.php +++ b/formwork/src/Images/ImageFactory.php @@ -8,8 +8,7 @@ final class ImageFactory { public function __construct( private Config $config, - ) { - } + ) {} /** * Create a new Image instance diff --git a/formwork/src/Images/Transform/Desaturate.php b/formwork/src/Images/Transform/Desaturate.php index 45d5e435d..27b40e698 100644 --- a/formwork/src/Images/Transform/Desaturate.php +++ b/formwork/src/Images/Transform/Desaturate.php @@ -7,9 +7,7 @@ final class Desaturate extends AbstractTransform { - public function __construct() - { - } + public function __construct() {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/EdgeDetect.php b/formwork/src/Images/Transform/EdgeDetect.php index 0d85472d4..e3e7fb7e5 100644 --- a/formwork/src/Images/Transform/EdgeDetect.php +++ b/formwork/src/Images/Transform/EdgeDetect.php @@ -7,9 +7,7 @@ final class EdgeDetect extends AbstractTransform { - public function __construct() - { - } + public function __construct() {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Emboss.php b/formwork/src/Images/Transform/Emboss.php index d6d6cf8c4..2897a7d7b 100644 --- a/formwork/src/Images/Transform/Emboss.php +++ b/formwork/src/Images/Transform/Emboss.php @@ -7,9 +7,7 @@ final class Emboss extends AbstractTransform { - public function __construct() - { - } + public function __construct() {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Flip.php b/formwork/src/Images/Transform/Flip.php index 508f0c723..64d4102a5 100644 --- a/formwork/src/Images/Transform/Flip.php +++ b/formwork/src/Images/Transform/Flip.php @@ -20,8 +20,7 @@ final class Flip extends AbstractTransform public function __construct( private FlipDirection $flipDirection, - ) { - } + ) {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Invert.php b/formwork/src/Images/Transform/Invert.php index 8d046dac3..a4e8a8a1d 100644 --- a/formwork/src/Images/Transform/Invert.php +++ b/formwork/src/Images/Transform/Invert.php @@ -7,9 +7,7 @@ final class Invert extends AbstractTransform { - public function __construct() - { - } + public function __construct() {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Pixelate.php b/formwork/src/Images/Transform/Pixelate.php index a87c88964..e73670f93 100644 --- a/formwork/src/Images/Transform/Pixelate.php +++ b/formwork/src/Images/Transform/Pixelate.php @@ -9,8 +9,7 @@ final class Pixelate extends AbstractTransform { public function __construct( private int $amount, - ) { - } + ) {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Rotate.php b/formwork/src/Images/Transform/Rotate.php index 6969a9f6f..d93e6075b 100644 --- a/formwork/src/Images/Transform/Rotate.php +++ b/formwork/src/Images/Transform/Rotate.php @@ -10,8 +10,7 @@ final class Rotate extends AbstractTransform { public function __construct( private float $angle, - ) { - } + ) {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Sharpen.php b/formwork/src/Images/Transform/Sharpen.php index bd48ffaf3..29da22373 100644 --- a/formwork/src/Images/Transform/Sharpen.php +++ b/formwork/src/Images/Transform/Sharpen.php @@ -7,9 +7,7 @@ final class Sharpen extends AbstractTransform { - public function __construct() - { - } + public function __construct() {} public static function fromArray(array $data): self { diff --git a/formwork/src/Images/Transform/Smoothen.php b/formwork/src/Images/Transform/Smoothen.php index f6b9e698b..f3436547e 100644 --- a/formwork/src/Images/Transform/Smoothen.php +++ b/formwork/src/Images/Transform/Smoothen.php @@ -7,9 +7,7 @@ final class Smoothen extends AbstractTransform { - public function __construct() - { - } + public function __construct() {} public static function fromArray(array $data): self { diff --git a/formwork/src/Interpolator/Errors/SyntaxError.php b/formwork/src/Interpolator/Errors/SyntaxError.php index d512a93db..b695ab836 100644 --- a/formwork/src/Interpolator/Errors/SyntaxError.php +++ b/formwork/src/Interpolator/Errors/SyntaxError.php @@ -4,6 +4,4 @@ use Error; -class SyntaxError extends Error -{ -} +class SyntaxError extends Error {} diff --git a/formwork/src/Interpolator/Exceptions/InterpolationException.php b/formwork/src/Interpolator/Exceptions/InterpolationException.php index 018ef7565..0398a3142 100644 --- a/formwork/src/Interpolator/Exceptions/InterpolationException.php +++ b/formwork/src/Interpolator/Exceptions/InterpolationException.php @@ -4,6 +4,4 @@ use RuntimeException; -class InterpolationException extends RuntimeException -{ -} +class InterpolationException extends RuntimeException {} diff --git a/formwork/src/Interpolator/NodeInterpolator.php b/formwork/src/Interpolator/NodeInterpolator.php index 5084e3a34..cb698f455 100644 --- a/formwork/src/Interpolator/NodeInterpolator.php +++ b/formwork/src/Interpolator/NodeInterpolator.php @@ -21,8 +21,7 @@ class NodeInterpolator public function __construct( protected AbstractNode $node, protected array $vars, - ) { - } + ) {} /** * Return the value interpolated from the node diff --git a/formwork/src/Interpolator/Parser.php b/formwork/src/Interpolator/Parser.php index 65bed2492..682d16db6 100644 --- a/formwork/src/Interpolator/Parser.php +++ b/formwork/src/Interpolator/Parser.php @@ -16,8 +16,7 @@ class Parser implements ParserInterface { public function __construct( protected TokenStream $tokenStream, - ) { - } + ) {} /** * Parse the tokens diff --git a/formwork/src/Interpolator/Token.php b/formwork/src/Interpolator/Token.php index b0b02b5f7..fdbfe50ea 100644 --- a/formwork/src/Interpolator/Token.php +++ b/formwork/src/Interpolator/Token.php @@ -40,8 +40,7 @@ public function __construct( protected string $type, protected ?string $value, protected int $position, - ) { - } + ) {} public function __toString(): string { diff --git a/formwork/src/Languages/LanguageCollection.php b/formwork/src/Languages/LanguageCollection.php index a3fc309a7..b41dfc5f4 100644 --- a/formwork/src/Languages/LanguageCollection.php +++ b/formwork/src/Languages/LanguageCollection.php @@ -16,6 +16,6 @@ class LanguageCollection extends AbstractCollection */ public function __construct(array $data) { - parent::__construct(Arr::fromEntries(Arr::map($data, fn (string $code) => [$code, new Language($code)]))); + parent::__construct(Arr::fromEntries(Arr::map($data, fn(string $code) => [$code, new Language($code)]))); } } diff --git a/formwork/src/Model/Attributes/ReadonlyModelProperty.php b/formwork/src/Model/Attributes/ReadonlyModelProperty.php index 13b1350d7..2ae48ba79 100644 --- a/formwork/src/Model/Attributes/ReadonlyModelProperty.php +++ b/formwork/src/Model/Attributes/ReadonlyModelProperty.php @@ -5,6 +5,4 @@ use Attribute; #[Attribute(Attribute::TARGET_PROPERTY)] -class ReadonlyModelProperty -{ -} +class ReadonlyModelProperty {} diff --git a/formwork/src/Pages/Exceptions/PageNotFoundException.php b/formwork/src/Pages/Exceptions/PageNotFoundException.php index 1e20b1db3..64a2c1b91 100644 --- a/formwork/src/Pages/Exceptions/PageNotFoundException.php +++ b/formwork/src/Pages/Exceptions/PageNotFoundException.php @@ -4,6 +4,4 @@ use RuntimeException; -class PageNotFoundException extends RuntimeException -{ -} +class PageNotFoundException extends RuntimeException {} diff --git a/formwork/src/Pages/Page.php b/formwork/src/Pages/Page.php index 53af62f46..02e4d85ac 100644 --- a/formwork/src/Pages/Page.php +++ b/formwork/src/Pages/Page.php @@ -235,7 +235,7 @@ public function defaults(): array ]; // Merge with scheme default field values - $defaults = [...$defaults, ...Arr::reject($this->fields()->pluck('default'), fn ($value) => $value === null)]; + $defaults = [...$defaults, ...Arr::reject($this->fields()->pluck('default'), fn($value) => $value === null)]; // If the page doesn't have a route, by default it won't be routable nor cacheable if ($this->route() === null) { @@ -545,7 +545,7 @@ public function videos(): FileCollection */ public function media(): FileCollection { - return $this->files()->filterBy('type', fn (string $type) => in_array($type, ['image', 'video'], true)); + return $this->files()->filterBy('type', fn(string $type) => in_array($type, ['image', 'video'], true)); } /** diff --git a/formwork/src/Pages/PageCollection.php b/formwork/src/Pages/PageCollection.php index fe4927b74..ae0aa02d4 100644 --- a/formwork/src/Pages/PageCollection.php +++ b/formwork/src/Pages/PageCollection.php @@ -99,7 +99,7 @@ public function search(string $query, int $min = 4): static $keywords = explode(' ', $query); - $keywords = array_filter($keywords, fn (string $item): bool => strlen($item) > $min); + $keywords = array_filter($keywords, fn(string $item): bool => strlen($item) > $min); $queryRegex = '/\b' . preg_quote($query, '/') . '\b/iu'; $keywordsRegex = '/(?:\b' . implode('\b|\b', $keywords) . '\b)/iu'; diff --git a/formwork/src/Pages/PageCollectionFactory.php b/formwork/src/Pages/PageCollectionFactory.php index 80af938e3..f5aed2201 100644 --- a/formwork/src/Pages/PageCollectionFactory.php +++ b/formwork/src/Pages/PageCollectionFactory.php @@ -6,8 +6,7 @@ final class PageCollectionFactory { public function __construct( private PaginationFactory $paginationFactory, - ) { - } + ) {} /** * Create a new PageCollection instance diff --git a/formwork/src/Pages/PageFactory.php b/formwork/src/Pages/PageFactory.php index e23b2fa1b..3d94e6f28 100644 --- a/formwork/src/Pages/PageFactory.php +++ b/formwork/src/Pages/PageFactory.php @@ -8,8 +8,7 @@ final class PageFactory { public function __construct( private Container $container, - ) { - } + ) {} /** * Create a new Page instance diff --git a/formwork/src/Pages/PaginationFactory.php b/formwork/src/Pages/PaginationFactory.php index e0788bbc4..e0ed3f614 100644 --- a/formwork/src/Pages/PaginationFactory.php +++ b/formwork/src/Pages/PaginationFactory.php @@ -10,8 +10,7 @@ final class PaginationFactory public function __construct( private App $app, private Router $router, - ) { - } + ) {} /** * Create a new Pagination instance diff --git a/formwork/src/Panel/ContentHistory/ContentHistory.php b/formwork/src/Panel/ContentHistory/ContentHistory.php index 0e880c49b..09c799c22 100644 --- a/formwork/src/Panel/ContentHistory/ContentHistory.php +++ b/formwork/src/Panel/ContentHistory/ContentHistory.php @@ -26,8 +26,7 @@ class ContentHistory public function __construct( protected string $path, protected int $limit = self::HISTORY_DEFAULT_LIMIT, - ) { - } + ) {} /** * Get history file path @@ -57,7 +56,7 @@ public function items(): ContentHistoryItemCollection return $this->items = new ContentHistoryItemCollection(); } $items = Json::parse(FileSystem::read(FileSystem::joinPaths($this->path, self::HISTORY_FILENAME))); - return $this->items = new ContentHistoryItemCollection(Arr::map($items, fn ($item) => ContentHistoryItem::fromArray($item))); + return $this->items = new ContentHistoryItemCollection(Arr::map($items, fn($item) => ContentHistoryItem::fromArray($item))); } /** @@ -92,7 +91,7 @@ public function update(ContentHistoryEvent $contentHistoryEvent, string $user, i */ public function save(): void { - $data = $this->items()->map(fn ($item) => $item->toArray())->toArray(); + $data = $this->items()->map(fn($item) => $item->toArray())->toArray(); FileSystem::write(FileSystem::joinPaths($this->path, self::HISTORY_FILENAME), Json::encode($data)); } } diff --git a/formwork/src/Panel/ContentHistory/ContentHistoryItem.php b/formwork/src/Panel/ContentHistory/ContentHistoryItem.php index 0ec5b4565..42f57b997 100644 --- a/formwork/src/Panel/ContentHistory/ContentHistoryItem.php +++ b/formwork/src/Panel/ContentHistory/ContentHistoryItem.php @@ -10,8 +10,7 @@ final public function __construct( protected ContentHistoryEvent $contentHistoryEvent, protected string $user, protected int $time, - ) { - } + ) {} /** * Get the event of the history item diff --git a/formwork/src/Panel/Controllers/ToolsController.php b/formwork/src/Panel/Controllers/ToolsController.php index 195fd0443..5bac06fc8 100644 --- a/formwork/src/Panel/Controllers/ToolsController.php +++ b/formwork/src/Panel/Controllers/ToolsController.php @@ -42,7 +42,7 @@ public function backups(): Response $backupper = new Backupper([...$this->config->get('system.backup'), 'hostname' => $this->request->host()]); - $backups = Arr::map($backupper->getBackups(), fn (string $path, int $timestamp): array => [ + $backups = Arr::map($backupper->getBackups(), fn(string $path, int $timestamp): array => [ 'name' => basename($path), 'encodedName' => urlencode(base64_encode(basename($path))), 'timestamp' => $timestamp, @@ -107,12 +107,12 @@ public function info(): Response $warnings[] = 'Debug mode enabled, remember to turn it off in production'; } - $missingExtensions = Arr::reject($this->getRequiredExtensions(), fn ($extension) => extension_loaded($extension)); + $missingExtensions = Arr::reject($this->getRequiredExtensions(), fn($extension) => extension_loaded($extension)); if (($missingCount = count($missingExtensions)) > 0) { $warnings[] = sprintf( $missingCount > 1 ? 'Required PHP extensions %s not loaded, check PHP configuration' : 'Required PHP extension %s not loaded, check PHP configuration', - implode(', ', Arr::map($missingExtensions, fn ($extension) => Str::wrap($extension, '`'))) + implode(', ', Arr::map($missingExtensions, fn($extension) => Str::wrap($extension, '`'))) ); } diff --git a/formwork/src/Panel/Modals/Modal.php b/formwork/src/Panel/Modals/Modal.php index 084aa0a63..69f61e836 100644 --- a/formwork/src/Panel/Modals/Modal.php +++ b/formwork/src/Panel/Modals/Modal.php @@ -94,7 +94,7 @@ public function fields(): FieldCollection $fieldCollection = new FieldCollection(); // @phpstan-ignore argument.templateType - $fieldCollection->setMultiple(Arr::map($this->data['fields'] ?? [], fn ($data, $name) => $this->fieldFactory->make($this->id . '.' . $name, $data, $fieldCollection))); + $fieldCollection->setMultiple(Arr::map($this->data['fields'] ?? [], fn($data, $name) => $this->fieldFactory->make($this->id . '.' . $name, $data, $fieldCollection))); return $fieldCollection; } @@ -105,7 +105,7 @@ public function fields(): FieldCollection public function buttons(): ModalButtonCollection { if (!isset($this->buttons)) { - $this->buttons = new ModalButtonCollection(Arr::map($this->data['buttons'] ?? [], fn (array $data) => new ModalButton($data, $this->translation))); + $this->buttons = new ModalButtonCollection(Arr::map($this->data['buttons'] ?? [], fn(array $data) => new ModalButton($data, $this->translation))); } return $this->buttons; } @@ -138,10 +138,10 @@ protected function defaults(): array */ protected function translate(): void { - $this->data['title'] = Str::interpolate($this->data['title'], fn ($key) => $this->translation->translate($key)); + $this->data['title'] = Str::interpolate($this->data['title'], fn($key) => $this->translation->translate($key)); if (isset($this->data['message'])) { - $this->data['message'] = Str::interpolate($this->data['message'], fn ($key) => $this->translation->translate($key)); + $this->data['message'] = Str::interpolate($this->data['message'], fn($key) => $this->translation->translate($key)); } } } diff --git a/formwork/src/Panel/Modals/ModalButton.php b/formwork/src/Panel/Modals/ModalButton.php index 1ee5fd803..d2de8e782 100644 --- a/formwork/src/Panel/Modals/ModalButton.php +++ b/formwork/src/Panel/Modals/ModalButton.php @@ -86,6 +86,6 @@ protected function defaults(): array protected function translate(): void { - $this->data['label'] = Str::interpolate($this->data['label'], fn ($key) => $this->translation->translate($key)); + $this->data['label'] = Str::interpolate($this->data['label'], fn($key) => $this->translation->translate($key)); } } diff --git a/formwork/src/Panel/Modals/ModalFactory.php b/formwork/src/Panel/Modals/ModalFactory.php index 17d085d31..1546cfd1d 100644 --- a/formwork/src/Panel/Modals/ModalFactory.php +++ b/formwork/src/Panel/Modals/ModalFactory.php @@ -14,8 +14,7 @@ public function __construct( private Config $config, private Translations $translations, private FieldFactory $fieldFactory, - ) { - } + ) {} /** * Create a new Modal instance diff --git a/formwork/src/Panel/Panel.php b/formwork/src/Panel/Panel.php index a47f53a27..264eae3e6 100644 --- a/formwork/src/Panel/Panel.php +++ b/formwork/src/Panel/Panel.php @@ -28,8 +28,7 @@ public function __construct( private Config $config, private Request $request, private Users $users, - ) { - } + ) {} /** * Return whether a user is logged in diff --git a/formwork/src/Parsers/Extensions/CommonMark/ImageAltProcessor.php b/formwork/src/Parsers/Extensions/CommonMark/ImageAltProcessor.php index 998e988a2..ee32202a7 100644 --- a/formwork/src/Parsers/Extensions/CommonMark/ImageAltProcessor.php +++ b/formwork/src/Parsers/Extensions/CommonMark/ImageAltProcessor.php @@ -10,8 +10,7 @@ class ImageAltProcessor { public function __construct( protected ConfigurationInterface $configuration, - ) { - } + ) {} public function __invoke(DocumentParsedEvent $documentParsedEvent): void { diff --git a/formwork/src/Parsers/Extensions/CommonMark/LinkBaseProcessor.php b/formwork/src/Parsers/Extensions/CommonMark/LinkBaseProcessor.php index d595ef6d1..efb7fab49 100644 --- a/formwork/src/Parsers/Extensions/CommonMark/LinkBaseProcessor.php +++ b/formwork/src/Parsers/Extensions/CommonMark/LinkBaseProcessor.php @@ -12,8 +12,7 @@ class LinkBaseProcessor { public function __construct( protected ConfigurationInterface $configuration, - ) { - } + ) {} public function __invoke(DocumentParsedEvent $documentParsedEvent): void { diff --git a/formwork/src/Router/CompiledRoute.php b/formwork/src/Router/CompiledRoute.php index e1584faa7..b880beae1 100644 --- a/formwork/src/Router/CompiledRoute.php +++ b/formwork/src/Router/CompiledRoute.php @@ -11,8 +11,7 @@ public function __construct( protected string $path, protected string $regex, protected array $params, - ) { - } + ) {} /** * Get route path diff --git a/formwork/src/Router/Exceptions/InvalidRouteException.php b/formwork/src/Router/Exceptions/InvalidRouteException.php index 3f64cac7b..6ed9181c9 100644 --- a/formwork/src/Router/Exceptions/InvalidRouteException.php +++ b/formwork/src/Router/Exceptions/InvalidRouteException.php @@ -4,6 +4,4 @@ use LogicException; -class InvalidRouteException extends LogicException -{ -} +class InvalidRouteException extends LogicException {} diff --git a/formwork/src/Router/Exceptions/RouteNotFoundException.php b/formwork/src/Router/Exceptions/RouteNotFoundException.php index ba0ad0e41..2ec4f44eb 100644 --- a/formwork/src/Router/Exceptions/RouteNotFoundException.php +++ b/formwork/src/Router/Exceptions/RouteNotFoundException.php @@ -4,6 +4,4 @@ use RuntimeException; -class RouteNotFoundException extends RuntimeException -{ -} +class RouteNotFoundException extends RuntimeException {} diff --git a/formwork/src/Router/Route.php b/formwork/src/Router/Route.php index 761b67c6a..326f1dd9a 100644 --- a/formwork/src/Router/Route.php +++ b/formwork/src/Router/Route.php @@ -49,8 +49,7 @@ class Route public function __construct( protected string $name, protected string $path, - ) { - } + ) {} /** * Get route name diff --git a/formwork/src/Sanitizer/DomSanitizer.php b/formwork/src/Sanitizer/DomSanitizer.php index 57025e011..cd4e52bd0 100644 --- a/formwork/src/Sanitizer/DomSanitizer.php +++ b/formwork/src/Sanitizer/DomSanitizer.php @@ -65,8 +65,7 @@ class DomSanitizer public function __construct( protected DomParserInterface $domParser = new Html5Parser(), - ) { - } + ) {} /** * Set the method used to sanitize elements diff --git a/formwork/src/Sanitizer/SvgSanitizer.php b/formwork/src/Sanitizer/SvgSanitizer.php index 6b13554ec..24d911f33 100644 --- a/formwork/src/Sanitizer/SvgSanitizer.php +++ b/formwork/src/Sanitizer/SvgSanitizer.php @@ -21,8 +21,7 @@ class SvgSanitizer extends DomSanitizer public function __construct( protected DomParserInterface $domParser = new PhpDomParser(), - ) { - } + ) {} protected function isValidDocument(?DOMDocumentFragment $domDocumentFragment): bool { diff --git a/formwork/src/Schemes/Scheme.php b/formwork/src/Schemes/Scheme.php index 72534d620..de26e8b8d 100644 --- a/formwork/src/Schemes/Scheme.php +++ b/formwork/src/Schemes/Scheme.php @@ -98,7 +98,7 @@ public function fields(): FieldCollection { $fieldCollection = new FieldCollection(); - $fieldCollection->setMultiple(Arr::map($this->data['fields'] ?? [], fn ($data, $name) => $this->fieldFactory->make($name, $data, $fieldCollection))); + $fieldCollection->setMultiple(Arr::map($this->data['fields'] ?? [], fn($data, $name) => $this->fieldFactory->make($name, $data, $fieldCollection))); $layout = new Layout($this->data['layout'] ?? ['type' => 'default', 'sections' => []], $this->translations->getCurrent()); @@ -134,7 +134,7 @@ protected function translate(mixed $value, Translation $translation): mixed return $value; } - $interpolate = fn ($value) => is_string($value) ? Str::interpolate($value, fn ($key) => $translation->translate($key)) : $value; + $interpolate = fn($value) => is_string($value) ? Str::interpolate($value, fn($key) => $translation->translate($key)) : $value; if (is_array($value)) { return Arr::map($value, $interpolate); diff --git a/formwork/src/Schemes/SchemeFactory.php b/formwork/src/Schemes/SchemeFactory.php index 1519698c3..a39cdd3ba 100644 --- a/formwork/src/Schemes/SchemeFactory.php +++ b/formwork/src/Schemes/SchemeFactory.php @@ -8,8 +8,7 @@ final class SchemeFactory { public function __construct( private Container $container, - ) { - } + ) {} /** * Create a new Scheme instance diff --git a/formwork/src/Schemes/Schemes.php b/formwork/src/Schemes/Schemes.php index e070ea89c..a71b23942 100644 --- a/formwork/src/Schemes/Schemes.php +++ b/formwork/src/Schemes/Schemes.php @@ -23,8 +23,7 @@ class Schemes public function __construct( protected SchemeFactory $schemeFactory, - ) { - } + ) {} /** * Load a scheme diff --git a/formwork/src/Security/CsrfToken.php b/formwork/src/Security/CsrfToken.php index a8cb34972..0216a5a8a 100644 --- a/formwork/src/Security/CsrfToken.php +++ b/formwork/src/Security/CsrfToken.php @@ -13,8 +13,7 @@ final class CsrfToken public function __construct( private Request $request, - ) { - } + ) {} /** * Generate a new CSRF token diff --git a/formwork/src/Services/Exceptions/ServiceResolutionException.php b/formwork/src/Services/Exceptions/ServiceResolutionException.php index bd0ccb95e..a7e0bc6a3 100644 --- a/formwork/src/Services/Exceptions/ServiceResolutionException.php +++ b/formwork/src/Services/Exceptions/ServiceResolutionException.php @@ -4,6 +4,4 @@ use RuntimeException; -class ServiceResolutionException extends RuntimeException -{ -} +class ServiceResolutionException extends RuntimeException {} diff --git a/formwork/src/Services/Loaders/LanguagesServiceLoader.php b/formwork/src/Services/Loaders/LanguagesServiceLoader.php index cc79fc7b8..6dd7babd3 100644 --- a/formwork/src/Services/Loaders/LanguagesServiceLoader.php +++ b/formwork/src/Services/Loaders/LanguagesServiceLoader.php @@ -13,8 +13,7 @@ final class LanguagesServiceLoader implements ServiceLoaderInterface public function __construct( private Config $config, private Request $request, - ) { - } + ) {} public function load(Container $container): Languages { diff --git a/formwork/src/Services/Loaders/PanelServiceLoader.php b/formwork/src/Services/Loaders/PanelServiceLoader.php index fb4244a60..af3682ee2 100644 --- a/formwork/src/Services/Loaders/PanelServiceLoader.php +++ b/formwork/src/Services/Loaders/PanelServiceLoader.php @@ -26,8 +26,7 @@ public function __construct( private Request $request, private Schemes $schemes, private Translations $translations, - ) { - } + ) {} public function load(Container $container): Panel { diff --git a/formwork/src/Services/Loaders/SchemesServiceLoader.php b/formwork/src/Services/Loaders/SchemesServiceLoader.php index 49fe895b9..ce8e6a198 100644 --- a/formwork/src/Services/Loaders/SchemesServiceLoader.php +++ b/formwork/src/Services/Loaders/SchemesServiceLoader.php @@ -14,8 +14,7 @@ final class SchemesServiceLoader implements ResolutionAwareServiceLoaderInterfac { public function __construct( private Config $config, - ) { - } + ) {} public function load(Container $container): object { @@ -23,7 +22,7 @@ public function load(Container $container): object $container->define(FieldFactory::class); - DynamicFieldValue::$varsLoader = fn () => $container->call(require $this->config->get('system.fields.dynamic.vars.file')); + DynamicFieldValue::$varsLoader = fn() => $container->call(require $this->config->get('system.fields.dynamic.vars.file')); return $container->build(Schemes::class); } diff --git a/formwork/src/Services/Loaders/SiteServiceLoader.php b/formwork/src/Services/Loaders/SiteServiceLoader.php index 5bd0c6625..02d572061 100644 --- a/formwork/src/Services/Loaders/SiteServiceLoader.php +++ b/formwork/src/Services/Loaders/SiteServiceLoader.php @@ -11,8 +11,7 @@ final class SiteServiceLoader implements ResolutionAwareServiceLoaderInterface { public function __construct( private Config $config, - ) { - } + ) {} public function load(Container $container): Site { diff --git a/formwork/src/Services/Loaders/TemplatesServiceLoader.php b/formwork/src/Services/Loaders/TemplatesServiceLoader.php index 5dfc79aac..a085f8525 100644 --- a/formwork/src/Services/Loaders/TemplatesServiceLoader.php +++ b/formwork/src/Services/Loaders/TemplatesServiceLoader.php @@ -14,8 +14,7 @@ final class TemplatesServiceLoader implements ServiceLoaderInterface public function __construct( private Config $config, private TemplateFactory $templateFactory, - ) { - } + ) {} public function load(Container $container): Templates { diff --git a/formwork/src/Services/Loaders/TranslationsServiceLoader.php b/formwork/src/Services/Loaders/TranslationsServiceLoader.php index af477029a..5d3200c08 100644 --- a/formwork/src/Services/Loaders/TranslationsServiceLoader.php +++ b/formwork/src/Services/Loaders/TranslationsServiceLoader.php @@ -13,8 +13,7 @@ final class TranslationsServiceLoader implements ResolutionAwareServiceLoaderInt public function __construct( private Config $config, private Languages $languages, - ) { - } + ) {} public function load(Container $container): object { diff --git a/formwork/src/Services/Loaders/UsersServiceLoader.php b/formwork/src/Services/Loaders/UsersServiceLoader.php index 0ad21dd74..d59f9058f 100644 --- a/formwork/src/Services/Loaders/UsersServiceLoader.php +++ b/formwork/src/Services/Loaders/UsersServiceLoader.php @@ -24,8 +24,7 @@ public function __construct( private Config $config, private Translations $translations, private UserFactory $userFactory, - ) { - } + ) {} public function load(Container $container): Users { diff --git a/formwork/src/Services/ServiceDefinition.php b/formwork/src/Services/ServiceDefinition.php index a641548b5..ce5a48f31 100644 --- a/formwork/src/Services/ServiceDefinition.php +++ b/formwork/src/Services/ServiceDefinition.php @@ -28,8 +28,7 @@ public function __construct( protected string $name, protected ?object $object, protected Container $container, - ) { - } + ) {} /** * Get service name diff --git a/formwork/src/Statistics/Statistics.php b/formwork/src/Statistics/Statistics.php index bb4031069..a0a8010f0 100644 --- a/formwork/src/Statistics/Statistics.php +++ b/formwork/src/Statistics/Statistics.php @@ -123,7 +123,7 @@ public function getChartData(int $limit = self::CHART_LIMIT): array $labels = Arr::map( iterator_to_array($this->generateDays($limit)), - fn (string $day): string => Date::formatTimestamp(Date::toTimestamp($day, self::DATE_FORMAT), "D\nj M", $this->translation) + fn(string $day): string => Date::formatTimestamp(Date::toTimestamp($day, self::DATE_FORMAT), "D\nj M", $this->translation) ); return [ diff --git a/formwork/src/Templates/Template.php b/formwork/src/Templates/Template.php index 92768331a..4f85a7817 100644 --- a/formwork/src/Templates/Template.php +++ b/formwork/src/Templates/Template.php @@ -26,8 +26,7 @@ public function __construct( protected Scheme $scheme, protected Site $site, protected ViewFactory $viewFactory, - ) { - } + ) {} public function __toString(): string { diff --git a/formwork/src/Templates/TemplateFactory.php b/formwork/src/Templates/TemplateFactory.php index a8f58bf63..03052a2bd 100644 --- a/formwork/src/Templates/TemplateFactory.php +++ b/formwork/src/Templates/TemplateFactory.php @@ -17,8 +17,7 @@ public function __construct( private App $app, private Config $config, private Schemes $schemes, - ) { - } + ) {} /** * Create a new Template instance @@ -36,7 +35,7 @@ public function make(string $name): Template 'name' => $name, 'path' => $path, 'methods' => [ - 'assets' => fn () => $assets, + 'assets' => fn() => $assets, ], 'vars' => [ 'router' => $this->app->router(), diff --git a/formwork/src/Templates/Templates.php b/formwork/src/Templates/Templates.php index d33bad0ee..3d63f1e51 100644 --- a/formwork/src/Templates/Templates.php +++ b/formwork/src/Templates/Templates.php @@ -2,6 +2,4 @@ namespace Formwork\Templates; -class Templates extends TemplateCollection -{ -} +class Templates extends TemplateCollection {} diff --git a/formwork/src/Translations/Translation.php b/formwork/src/Translations/Translation.php index 0572e8224..21dfda55f 100644 --- a/formwork/src/Translations/Translation.php +++ b/formwork/src/Translations/Translation.php @@ -15,8 +15,7 @@ class Translation public function __construct( protected string $code, protected array $data, - ) { - } + ) {} /** * Set the fallback translation diff --git a/formwork/src/Translations/Translations.php b/formwork/src/Translations/Translations.php index d2984e5f8..b560f5114 100644 --- a/formwork/src/Translations/Translations.php +++ b/formwork/src/Translations/Translations.php @@ -28,8 +28,7 @@ class Translations public function __construct( protected Config $config, - ) { - } + ) {} /** * Load a translation file diff --git a/formwork/src/Users/Exceptions/AuthenticationFailedException.php b/formwork/src/Users/Exceptions/AuthenticationFailedException.php index 98db2686b..7208f726c 100644 --- a/formwork/src/Users/Exceptions/AuthenticationFailedException.php +++ b/formwork/src/Users/Exceptions/AuthenticationFailedException.php @@ -4,6 +4,4 @@ use RuntimeException; -class AuthenticationFailedException extends RuntimeException -{ -} +class AuthenticationFailedException extends RuntimeException {} diff --git a/formwork/src/Users/Exceptions/UserImageNotFoundException.php b/formwork/src/Users/Exceptions/UserImageNotFoundException.php index f3dc833da..205bc6c2c 100644 --- a/formwork/src/Users/Exceptions/UserImageNotFoundException.php +++ b/formwork/src/Users/Exceptions/UserImageNotFoundException.php @@ -4,6 +4,4 @@ use RuntimeException; -class UserImageNotFoundException extends RuntimeException -{ -} +class UserImageNotFoundException extends RuntimeException {} diff --git a/formwork/src/Users/Exceptions/UserNotFoundException.php b/formwork/src/Users/Exceptions/UserNotFoundException.php index 9ec3914e6..6b0713cf7 100644 --- a/formwork/src/Users/Exceptions/UserNotFoundException.php +++ b/formwork/src/Users/Exceptions/UserNotFoundException.php @@ -4,6 +4,4 @@ use RuntimeException; -class UserNotFoundException extends RuntimeException -{ -} +class UserNotFoundException extends RuntimeException {} diff --git a/formwork/src/Users/Exceptions/UserNotLoggedException.php b/formwork/src/Users/Exceptions/UserNotLoggedException.php index 255f83806..852e0f424 100644 --- a/formwork/src/Users/Exceptions/UserNotLoggedException.php +++ b/formwork/src/Users/Exceptions/UserNotLoggedException.php @@ -4,6 +4,4 @@ use RuntimeException; -class UserNotLoggedException extends RuntimeException -{ -} +class UserNotLoggedException extends RuntimeException {} diff --git a/formwork/src/Users/Role.php b/formwork/src/Users/Role.php index e210aee46..dca6c8f52 100644 --- a/formwork/src/Users/Role.php +++ b/formwork/src/Users/Role.php @@ -12,8 +12,7 @@ public function __construct( protected string $title, protected Permissions $permissions, protected Translations $translations, - ) { - } + ) {} /** * Return role id @@ -28,7 +27,7 @@ public function id(): string */ public function title(): string { - return Str::interpolate($this->title, fn ($key) => $this->translations->getCurrent()->translate($key)); + return Str::interpolate($this->title, fn($key) => $this->translations->getCurrent()->translate($key)); } /** diff --git a/formwork/src/Users/UserCollection.php b/formwork/src/Users/UserCollection.php index cf45f27a6..83019aaa4 100644 --- a/formwork/src/Users/UserCollection.php +++ b/formwork/src/Users/UserCollection.php @@ -37,6 +37,6 @@ public function availableRoles(): array */ public function loggedIn(): ?User { - return $this->find(fn (User $user): bool => $user->isLoggedIn()); + return $this->find(fn(User $user): bool => $user->isLoggedIn()); } } diff --git a/formwork/src/Users/UserFactory.php b/formwork/src/Users/UserFactory.php index 50a4ef66d..63ee8bfac 100644 --- a/formwork/src/Users/UserFactory.php +++ b/formwork/src/Users/UserFactory.php @@ -8,8 +8,7 @@ final class UserFactory { public function __construct( private Container $container, - ) { - } + ) {} /** * Create a new User instance diff --git a/formwork/src/Users/Users.php b/formwork/src/Users/Users.php index b0b4cb0a4..3e66d308b 100644 --- a/formwork/src/Users/Users.php +++ b/formwork/src/Users/Users.php @@ -2,6 +2,4 @@ namespace Formwork\Users; -class Users extends UserCollection -{ -} +class Users extends UserCollection {} diff --git a/formwork/src/Utils/Arr.php b/formwork/src/Utils/Arr.php index 652e0c833..60afd699d 100644 --- a/formwork/src/Utils/Arr.php +++ b/formwork/src/Utils/Arr.php @@ -432,7 +432,7 @@ public static function filter(array $array, callable $callback): array */ public static function reject(array $array, callable $callback): array { - return self::filter($array, fn ($value, $key) => !$callback($value, $key)); + return self::filter($array, fn($value, $key) => !$callback($value, $key)); } /** @@ -503,7 +503,7 @@ public static function find(array $array, callable $callback): mixed */ public static function pluck(array $array, string $key, mixed $default = null): array { - return self::map($array, fn ($value) => self::get(self::from($value), $key, $default)); + return self::map($array, fn($value) => self::get(self::from($value), $key, $default)); } /** diff --git a/formwork/src/Utils/Constraint.php b/formwork/src/Utils/Constraint.php index ff94e9a4e..736a6dc26 100644 --- a/formwork/src/Utils/Constraint.php +++ b/formwork/src/Utils/Constraint.php @@ -107,7 +107,7 @@ public static function isInIntegerRange( public static function isOfType(mixed $value, string $type, bool $unionTypes = false): bool { if ($unionTypes) { - return Arr::some(explode('|', $type), fn ($type) => self::isOfType($value, $type, unionTypes: false)); + return Arr::some(explode('|', $type), fn($type) => self::isOfType($value, $type, unionTypes: false)); } if (is_object($value)) { return $value instanceof $type; diff --git a/formwork/src/Utils/Date.php b/formwork/src/Utils/Date.php index 1ed1424b6..62dd95c5c 100644 --- a/formwork/src/Utils/Date.php +++ b/formwork/src/Utils/Date.php @@ -108,7 +108,7 @@ public static function formatToPattern(string $format): string $map = array_flip(self::PATTERN_TO_DATE_FORMAT); return preg_replace_callback( self::DATE_FORMAT_REGEX, - fn (array $matches): string => match (true) { + fn(array $matches): string => match (true) { isset($matches['invalid']) => '', isset($matches['escaped']) => '[' . str_replace('\\', '', $matches['escaped']) . ']', default => $map[$matches[0]] ?? '', @@ -126,7 +126,7 @@ public static function patternToFormat(string $pattern): string { return preg_replace_callback( self::PATTERN_REGEX, - fn (array $matches): string => match (true) { + fn(array $matches): string => match (true) { isset($matches['invalid']) => '', isset($matches['escaped']) => addcslashes($matches['escaped'], 'A..Za..z'), default => self::PATTERN_TO_DATE_FORMAT[$matches[0]] ?? '', @@ -142,7 +142,7 @@ public static function formatDateTime(DateTime $dateTime, string $format, Transl { return preg_replace_callback( self::DATE_FORMAT_REGEX, - fn (array $matches): string => match ($matches[0]) { + fn(array $matches): string => match ($matches[0]) { 'M' => $translation->getStrings('date.months.short')[$dateTime->format('n') - 1], 'F' => $translation->getStrings('date.months.long')[$dateTime->format('n') - 1], 'D' => $translation->getStrings('date.weekdays.short')[(int) $dateTime->format('w')], diff --git a/formwork/src/Utils/Exceptions/FileNotFoundException.php b/formwork/src/Utils/Exceptions/FileNotFoundException.php index a0f93a0ac..0f9acd2c5 100644 --- a/formwork/src/Utils/Exceptions/FileNotFoundException.php +++ b/formwork/src/Utils/Exceptions/FileNotFoundException.php @@ -2,6 +2,4 @@ namespace Formwork\Utils\Exceptions; -class FileNotFoundException extends FileSystemException -{ -} +class FileNotFoundException extends FileSystemException {} diff --git a/formwork/src/Utils/Exceptions/FileSystemException.php b/formwork/src/Utils/Exceptions/FileSystemException.php index 8848e97c2..1483ac740 100644 --- a/formwork/src/Utils/Exceptions/FileSystemException.php +++ b/formwork/src/Utils/Exceptions/FileSystemException.php @@ -4,6 +4,4 @@ use RuntimeException; -class FileSystemException extends RuntimeException -{ -} +class FileSystemException extends RuntimeException {} diff --git a/formwork/src/Utils/MimeType.php b/formwork/src/Utils/MimeType.php index 6eca2d961..1fe943260 100644 --- a/formwork/src/Utils/MimeType.php +++ b/formwork/src/Utils/MimeType.php @@ -1328,6 +1328,6 @@ public static function toExtension(string $mimeType): ?string */ public static function extensionTypes(): array { - return Arr::mapKeys(Arr::map(self::MIME_TYPES, fn ($value, $key) => sprintf('.%s (%s)', $key, $value)), fn ($key) => '.' . $key); + return Arr::mapKeys(Arr::map(self::MIME_TYPES, fn($value, $key) => sprintf('.%s (%s)', $key, $value)), fn($key) => '.' . $key); } } diff --git a/formwork/src/Utils/Str.php b/formwork/src/Utils/Str.php index 42049fc72..b5676a56d 100644 --- a/formwork/src/Utils/Str.php +++ b/formwork/src/Utils/Str.php @@ -293,7 +293,7 @@ public static function removeEnd(string $haystack, string $needle): string public static function dotNotationToBrackets(string $string): string { $segments = explode('.', $string); - return array_shift($segments) . implode('', Arr::map($segments, fn ($segment) => '[' . $segment . ']')); + return array_shift($segments) . implode('', Arr::map($segments, fn($segment) => '[' . $segment . ']')); } /** diff --git a/formwork/src/View/Exceptions/RenderingException.php b/formwork/src/View/Exceptions/RenderingException.php index 6a522f6ce..0955364ad 100644 --- a/formwork/src/View/Exceptions/RenderingException.php +++ b/formwork/src/View/Exceptions/RenderingException.php @@ -4,6 +4,4 @@ use RuntimeException; -class RenderingException extends RuntimeException -{ -} +class RenderingException extends RuntimeException {} diff --git a/formwork/src/View/ViewFactory.php b/formwork/src/View/ViewFactory.php index b67c9e881..344f9243a 100644 --- a/formwork/src/View/ViewFactory.php +++ b/formwork/src/View/ViewFactory.php @@ -15,8 +15,7 @@ public function __construct( private array $methods, private App $app, private Config $config, - ) { - } + ) {} /** * Create a new View instance diff --git a/panel/helpers.php b/panel/helpers.php index 7535a500a..e0ab823f3 100644 --- a/panel/helpers.php +++ b/panel/helpers.php @@ -8,6 +8,6 @@ return [ 'assets' => $panel->assets(...), - 'icon' => fn (string $icon) => FileSystem::read(FileSystem::joinPaths($config->get('system.panel.paths.assets'), '/icons/svg/', $icon . '.svg')), + 'icon' => fn(string $icon) => FileSystem::read(FileSystem::joinPaths($config->get('system.panel.paths.assets'), '/icons/svg/', $icon . '.svg')), ]; }; diff --git a/panel/routes.php b/panel/routes.php index 2777d1854..9787d4203 100644 --- a/panel/routes.php +++ b/panel/routes.php @@ -19,7 +19,7 @@ 'routes' => [ 'panel.index' => [ 'path' => '/', - 'action' => fn (Panel $panel) => new RedirectResponse($panel->uri('/dashboard/')), + 'action' => fn(Panel $panel) => new RedirectResponse($panel->uri('/dashboard/')), ], 'panel.login' => [