From cd3af7f2ff2387cccbbd3a6e1fa404f6b5b30d74 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Thu, 7 Nov 2024 17:55:19 +0100 Subject: [PATCH] chore: fix tests --- framework/core/src/Api/Resource/Concerns/HasHooks.php | 2 +- .../core/src/Database/Exception/MigrationKeyMissing.php | 2 +- framework/core/src/Extend/ApiResource.php | 6 +++--- framework/core/src/Extend/Frontend.php | 2 +- framework/core/src/Extend/Settings.php | 4 ++-- framework/core/src/Extend/Theme.php | 2 +- .../core/src/Extension/Exception/ExtensionBootError.php | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/framework/core/src/Api/Resource/Concerns/HasHooks.php b/framework/core/src/Api/Resource/Concerns/HasHooks.php index 056eea1dc0..8d93a86d7d 100644 --- a/framework/core/src/Api/Resource/Concerns/HasHooks.php +++ b/framework/core/src/Api/Resource/Concerns/HasHooks.php @@ -180,7 +180,7 @@ public function deleted(object $model, Context $context): void // } - public function dispatchEventsFor(mixed $entity, User $actor = null): void + public function dispatchEventsFor(mixed $entity, ?User $actor = null): void { if (method_exists($entity, 'releaseEvents')) { $this->traitDispatchEventsFor($entity, $actor); diff --git a/framework/core/src/Database/Exception/MigrationKeyMissing.php b/framework/core/src/Database/Exception/MigrationKeyMissing.php index 50c31e1851..73e25c339c 100644 --- a/framework/core/src/Database/Exception/MigrationKeyMissing.php +++ b/framework/core/src/Database/Exception/MigrationKeyMissing.php @@ -19,7 +19,7 @@ public function __construct(protected string $direction, ?string $file = null) parent::__construct("Migration file $fileNameWithSpace should contain an array with up/down (looking for $direction)"); } - public function withFile(string $file = null): self + public function withFile(?string $file = null): self { return new self($this->direction, $file); } diff --git a/framework/core/src/Extend/ApiResource.php b/framework/core/src/Extend/ApiResource.php index 303900a3d6..bdd682de99 100644 --- a/framework/core/src/Extend/ApiResource.php +++ b/framework/core/src/Extend/ApiResource.php @@ -59,7 +59,7 @@ public function endpoints(callable|string $endpoints): self * @param array $endpoints must be an array of names of the endpoints. * @param callable|class-string|null $condition a callable that returns a boolean or a string that represents whether this should be applied. */ - public function removeEndpoints(array $endpoints, callable|string $condition = null): self + public function removeEndpoints(array $endpoints, callable|string|null $condition = null): self { $this->removeEndpoints[] = [$endpoints, $condition]; @@ -99,7 +99,7 @@ public function fields(callable|string $fields): self * @param array $fields must be an array of field names. * @param callable|class-string|null $condition a callable that returns a boolean or a string that represents whether this should be applied. */ - public function removeFields(array $fields, callable|string $condition = null): self + public function removeFields(array $fields, callable|string|null $condition = null): self { $this->removeFields[] = [$fields, $condition]; @@ -139,7 +139,7 @@ public function sorts(callable|string $sorts): self * @param array $sorts must be an array of sort names. * @param callable|class-string|null $condition a callable that returns a boolean or a string that represents whether this should be applied. */ - public function removeSorts(array $sorts, callable|string $condition = null): self + public function removeSorts(array $sorts, callable|string|null $condition = null): self { $this->removeSorts[] = [$sorts, $condition]; diff --git a/framework/core/src/Extend/Frontend.php b/framework/core/src/Extend/Frontend.php index 55888621dc..fb166f531a 100644 --- a/framework/core/src/Extend/Frontend.php +++ b/framework/core/src/Extend/Frontend.php @@ -101,7 +101,7 @@ public function jsDirectory(string $path): self * * @return self */ - public function route(string $path, string $name, callable|string $content = null): self + public function route(string $path, string $name, callable|string|null $content = null): self { $this->routes[] = compact('path', 'name', 'content'); diff --git a/framework/core/src/Extend/Settings.php b/framework/core/src/Extend/Settings.php index 9543b9653b..68a9555d28 100644 --- a/framework/core/src/Extend/Settings.php +++ b/framework/core/src/Extend/Settings.php @@ -43,7 +43,7 @@ class Settings implements ExtenderInterface * * @return self */ - public function serializeToForum(string $attributeName, string $key, callable|string $callback = null): self + public function serializeToForum(string $attributeName, string $key, callable|string|null $callback = null): self { $this->settings[$key] = compact('attributeName', 'callback'); @@ -94,7 +94,7 @@ public function resetWhen(string $key, callable|string $callback): self * * @return self */ - public function registerLessConfigVar(string $configName, string $key, callable|string $callback = null): self + public function registerLessConfigVar(string $configName, string $key, callable|string|null $callback = null): self { $this->lessConfigs[$configName] = compact('key', 'callback'); diff --git a/framework/core/src/Extend/Theme.php b/framework/core/src/Extend/Theme.php index d75244eb8b..f878e42b1d 100644 --- a/framework/core/src/Extend/Theme.php +++ b/framework/core/src/Extend/Theme.php @@ -48,7 +48,7 @@ public function overrideLessImport(string $file, string $newFilePath, ?string $e * @param string|null $extensionId : If overriding an extension file, specify its ID, for example: `flarum-tags`. * @return self */ - public function overrideFileSource(string $file, string $newFilePath, string $extensionId = null): self + public function overrideFileSource(string $file, string $newFilePath, ?string $extensionId = null): self { $this->fileSourceOverrides[] = compact('file', 'newFilePath', 'extensionId'); diff --git a/framework/core/src/Extension/Exception/ExtensionBootError.php b/framework/core/src/Extension/Exception/ExtensionBootError.php index 2a75698e24..8d673493a8 100644 --- a/framework/core/src/Extension/Exception/ExtensionBootError.php +++ b/framework/core/src/Extension/Exception/ExtensionBootError.php @@ -18,7 +18,7 @@ class ExtensionBootError extends Exception public function __construct( public Extension $extension, public object $extender, - Throwable $previous = null + ?Throwable $previous = null ) { $extenderClass = $extender::class;