diff --git a/framework/core/src/Admin/Content/AdminPayload.php b/framework/core/src/Admin/Content/AdminPayload.php
index 134340a552..2450dda4b6 100644
--- a/framework/core/src/Admin/Content/AdminPayload.php
+++ b/framework/core/src/Admin/Content/AdminPayload.php
@@ -54,9 +54,7 @@ public function __invoke(Document $document, Request $request): void
$document->payload['extensions'] = $this->extensions->getExtensions()->toArray();
$document->payload['displayNameDrivers'] = array_keys($this->container->make('flarum.user.display_name.supported_drivers'));
- $document->payload['slugDrivers'] = array_map(function ($resourceDrivers) {
- return array_keys($resourceDrivers);
- }, $this->container->make('flarum.http.slugDrivers'));
+ $document->payload['slugDrivers'] = array_map(array_keys(...), $this->container->make('flarum.http.slugDrivers'));
$document->payload['searchDrivers'] = $this->getSearchDrivers();
$document->payload['phpVersion'] = $this->appInfo->identifyPHPVersion();
diff --git a/framework/core/src/Api/Controller/UninstallExtensionController.php b/framework/core/src/Api/Controller/UninstallExtensionController.php
index 8f0cfb01ef..2d567dc4ce 100644
--- a/framework/core/src/Api/Controller/UninstallExtensionController.php
+++ b/framework/core/src/Api/Controller/UninstallExtensionController.php
@@ -27,7 +27,7 @@ protected function delete(ServerRequestInterface $request): void
$name = Arr::get($request->getQueryParams(), 'name');
- if ($this->extensions->getExtension($name) == null) {
+ if ($this->extensions->getExtension($name) === null) {
return;
}
diff --git a/framework/core/src/Api/Endpoint/Concerns/ExtractsListingParams.php b/framework/core/src/Api/Endpoint/Concerns/ExtractsListingParams.php
index 046d010461..e0609fdf46 100644
--- a/framework/core/src/Api/Endpoint/Concerns/ExtractsListingParams.php
+++ b/framework/core/src/Api/Endpoint/Concerns/ExtractsListingParams.php
@@ -103,7 +103,7 @@ public function defaultExtracts(Context $context): array
return [
'filter' => RequestUtil::extractFilter($context->request),
'sort' => RequestUtil::extractSort($context->request, $this->defaultSort, $this->getAvailableSorts($context)),
- 'limit' => $limit = (RequestUtil::extractLimit($context->request, $this->limit, $this->maxLimit) ?? null),
+ 'limit' => $limit = RequestUtil::extractLimit($context->request, $this->limit, $this->maxLimit),
'offset' => RequestUtil::extractOffset($context->request, $limit),
];
}
diff --git a/framework/core/src/Api/Endpoint/Concerns/HasEagerLoading.php b/framework/core/src/Api/Endpoint/Concerns/HasEagerLoading.php
index 19c3bb4f82..2890d6e6b5 100644
--- a/framework/core/src/Api/Endpoint/Concerns/HasEagerLoading.php
+++ b/framework/core/src/Api/Endpoint/Concerns/HasEagerLoading.php
@@ -13,7 +13,6 @@
use Flarum\Api\Resource\AbstractDatabaseResource;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
-use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Str;
use Tobyz\JsonApiServer\Context;
@@ -147,13 +146,10 @@ protected function compileSimpleEagerLoads(Context $context, array $included): a
protected function compileWhereEagerLoads(Context $context): array
{
- $relations = [];
-
- foreach ($this->loadRelationWhere as $name => $callable) {
- $relations[$name] = function ($query) use ($callable, $context) {
- $callable($query, $context);
- };
- }
+ $relations = array_map(
+ callback: fn ($callable) => fn ($query) => $callable($query, $context),
+ array: $this->loadRelationWhere
+ );
return $relations;
}
diff --git a/framework/core/src/Api/Endpoint/Create.php b/framework/core/src/Api/Endpoint/Create.php
index cdc3061fa4..f9029a90aa 100644
--- a/framework/core/src/Api/Endpoint/Create.php
+++ b/framework/core/src/Api/Endpoint/Create.php
@@ -89,7 +89,7 @@ public function setUp(): void
final protected function fillDefaultValues(Context $context, array &$data): void
{
foreach ($context->fields($context->resource) as $field) {
- if (! has_value($data, $field) && ($default = $field->default)) {
+ if (($default = $field->default) && ! has_value($data, $field)) {
set_value($data, $field, $default($context->withField($field)));
}
}
diff --git a/framework/core/src/Api/Endpoint/Index.php b/framework/core/src/Api/Endpoint/Index.php
index c6f815f7c1..e023bc1139 100644
--- a/framework/core/src/Api/Endpoint/Index.php
+++ b/framework/core/src/Api/Endpoint/Index.php
@@ -44,7 +44,6 @@ class Index extends Endpoint
use HasCustomHooks;
public Closure $paginationResolver;
- public ?string $defaultSort = null;
protected ?Closure $query = null;
public function __construct(string $name)
diff --git a/framework/core/src/Api/Middleware/FakeHttpMethods.php b/framework/core/src/Api/Middleware/FakeHttpMethods.php
index 489ae3e53d..bb46419b2c 100644
--- a/framework/core/src/Api/Middleware/FakeHttpMethods.php
+++ b/framework/core/src/Api/Middleware/FakeHttpMethods.php
@@ -16,7 +16,7 @@
class FakeHttpMethods implements Middleware
{
- const HEADER_NAME = 'x-http-method-override';
+ public const HEADER_NAME = 'x-http-method-override';
public function process(Request $request, Handler $handler): Response
{
diff --git a/framework/core/src/Api/Middleware/ThrottleApi.php b/framework/core/src/Api/Middleware/ThrottleApi.php
index 317695678b..fb68cd8ab0 100644
--- a/framework/core/src/Api/Middleware/ThrottleApi.php
+++ b/framework/core/src/Api/Middleware/ThrottleApi.php
@@ -42,7 +42,9 @@ public function throttle(Request $request): bool
// Anything else is ignored.
if ($result === false) {
return false;
- } elseif ($result === true) {
+ }
+
+ if ($result === true) {
$throttle = true;
}
}
diff --git a/framework/core/src/Api/Resource/AbstractDatabaseResource.php b/framework/core/src/Api/Resource/AbstractDatabaseResource.php
index b7a7a0bb54..cc953871b1 100644
--- a/framework/core/src/Api/Resource/AbstractDatabaseResource.php
+++ b/framework/core/src/Api/Resource/AbstractDatabaseResource.php
@@ -74,9 +74,9 @@ public function getValue(object $model, Field $field, Context $context): mixed
{
if ($field instanceof Relationship) {
return $this->getRelationshipValue($model, $field, $context);
- } else {
- return $this->getAttributeValue($model, $field, $context);
}
+
+ return $this->getAttributeValue($model, $field, $context);
}
/**
diff --git a/framework/core/src/Api/Resource/AccessTokenResource.php b/framework/core/src/Api/Resource/AccessTokenResource.php
index e6f487550c..1a0f5492be 100644
--- a/framework/core/src/Api/Resource/AccessTokenResource.php
+++ b/framework/core/src/Api/Resource/AccessTokenResource.php
@@ -79,18 +79,18 @@ public function fields(): array
{
return [
Schema\Str::make('token')
- ->visible(function (AccessToken $token, Context $context) {
+ ->visible(function (#[\SensitiveParameter] AccessToken $token, Context $context) {
return $context->getActor()->id === $token->user_id && ! in_array('token', $token->getHidden(), true);
}),
Schema\Integer::make('userId'),
Schema\DateTime::make('createdAt'),
Schema\DateTime::make('lastActivityAt'),
Schema\Boolean::make('isCurrent')
- ->get(function (AccessToken $token, Context $context) {
+ ->get(function (#[\SensitiveParameter] AccessToken $token, Context $context) {
return $token->token === $context->request->getAttribute('session')->get('access_token');
}),
Schema\Boolean::make('isSessionToken')
- ->get(function (AccessToken $token) {
+ ->get(function (#[\SensitiveParameter] AccessToken $token) {
return in_array($token->type, [SessionAccessToken::$type, RememberAccessToken::$type], true);
}),
Schema\Str::make('title')
@@ -99,7 +99,7 @@ public function fields(): array
->maxLength(255),
Schema\Str::make('lastIpAddress'),
Schema\Str::make('device')
- ->get(function (AccessToken $token) {
+ ->get(function (#[\SensitiveParameter] AccessToken $token) {
$agent = new Agent();
$agent->setUserAgent($token->last_user_agent);
diff --git a/framework/core/src/Api/Resource/Contracts/Listable.php b/framework/core/src/Api/Resource/Contracts/Listable.php
index 956faf0879..0ff9ce5fad 100644
--- a/framework/core/src/Api/Resource/Contracts/Listable.php
+++ b/framework/core/src/Api/Resource/Contracts/Listable.php
@@ -21,15 +21,11 @@ interface Listable
{
/**
* Create a query object for the current request.
- *
- * @param Context $context
*/
public function query(Context $context): object;
/**
* Get results from the given query.
- *
- * @param Context $context
*/
public function results(object $query, Context $context): iterable;
diff --git a/framework/core/src/Api/Resource/UserResource.php b/framework/core/src/Api/Resource/UserResource.php
index 5160dc3eba..3d5f88d373 100644
--- a/framework/core/src/Api/Resource/UserResource.php
+++ b/framework/core/src/Api/Resource/UserResource.php
@@ -377,7 +377,7 @@ public function saving(object $model, \Tobyz\JsonApiServer\Context $context): ?o
return $model;
}
- private function applyToken(User $user, RegistrationToken $token): void
+ private function applyToken(User $user, #[\SensitiveParameter] RegistrationToken $token): void
{
foreach ($token->user_attributes as $k => $v) {
if ($k === 'avatar_url') {
@@ -435,7 +435,7 @@ private function retrieveAvatarFromUrl(string $url): ?string
try {
$response = $client->get($url);
- } catch (\Exception $e) {
+ } catch (\Exception) {
return null;
}
@@ -446,7 +446,7 @@ private function retrieveAvatarFromUrl(string $url): ?string
return $response->getBody()->getContents();
}
- private function fulfillToken(User $user, RegistrationToken $token): void
+ private function fulfillToken(User $user, #[\SensitiveParameter] RegistrationToken $token): void
{
$token->delete();
diff --git a/framework/core/src/Api/Serializer.php b/framework/core/src/Api/Serializer.php
index 15678c0a96..cd0352df98 100644
--- a/framework/core/src/Api/Serializer.php
+++ b/framework/core/src/Api/Serializer.php
@@ -93,8 +93,8 @@ private function addToMap(Resource $resource, mixed $model, array $include): arr
$this->whenResolved($value, function (mixed $value) use ($key, $field, $context) {
if (
- ($value = $field->serializeValue($value, $context)) ||
- ! $field instanceof Relationship
+ ! $field instanceof Relationship ||
+ ($value = $field->serializeValue($value, $context))
) {
set_value($this->map[$key], $field, $value);
}
diff --git a/framework/core/src/Console/Server.php b/framework/core/src/Console/Server.php
index fa61d3a923..fe39e8385f 100644
--- a/framework/core/src/Console/Server.php
+++ b/framework/core/src/Console/Server.php
@@ -23,10 +23,10 @@
use Symfony\Component\Console\Event\ConsoleTerminateEvent;
use Symfony\Component\EventDispatcher\EventDispatcher;
-class Server
+readonly class Server
{
public function __construct(
- private readonly SiteInterface $site
+ private SiteInterface $site
) {
}
diff --git a/framework/core/src/Database/DatabaseMigrationRepository.php b/framework/core/src/Database/DatabaseMigrationRepository.php
index 3fb06fba3d..a47522cc0b 100644
--- a/framework/core/src/Database/DatabaseMigrationRepository.php
+++ b/framework/core/src/Database/DatabaseMigrationRepository.php
@@ -51,8 +51,6 @@ public function delete(string $file, ?string $extension = null): void
/**
* Create the migration repository data store.
- *
- * @return void
*/
public function createRepository(): void
{
diff --git a/framework/core/src/Database/Migrator.php b/framework/core/src/Database/Migrator.php
index 11e7c50e46..8dccce81c4 100644
--- a/framework/core/src/Database/Migrator.php
+++ b/framework/core/src/Database/Migrator.php
@@ -50,7 +50,7 @@ public function runMigrationList(string $path, array $migrations, ?Extension $ex
// First we will just make sure that there are any migrations to run. If there
// aren't, we will just make a note of it to the developer so they're aware
// that all the migrations have been run against this database system.
- if (count($migrations) == 0) {
+ if (count($migrations) === 0) {
$this->note('Nothing to migrate.');
return;
@@ -115,7 +115,7 @@ protected function runUp(string $path, string $file, ?Extension $extension = nul
public function reset(string $path, ?Extension $extension = null): int
{
$migrations = array_reverse($this->repository->getRan(
- $extension ? $extension->getId() : null
+ $extension?->getId()
));
$count = count($migrations);
@@ -176,11 +176,8 @@ protected function resolveAndRunClosureMigration(string $path, string $file, str
/**
* Get all of the migration files in a given path.
- *
- * @param string $path
- * @return array
*/
- public function getMigrationFiles($path)
+ public function getMigrationFiles(string $path): array
{
$files = $this->files->glob($path.'/*_*.php');
diff --git a/framework/core/src/Discussion/Discussion.php b/framework/core/src/Discussion/Discussion.php
index 87d88ff6d2..27d74e19c9 100644
--- a/framework/core/src/Discussion/Discussion.php
+++ b/framework/core/src/Discussion/Discussion.php
@@ -283,8 +283,6 @@ public function comments(): HasMany
/**
* Query the discussion's participants (a list of unique users who have
* posted in the discussion).
- *
- * @return Builder
*/
public function participants(): Builder
{
diff --git a/framework/core/src/Discussion/DiscussionMetadataUpdater.php b/framework/core/src/Discussion/DiscussionMetadataUpdater.php
index 3e9966ab2e..c392084408 100644
--- a/framework/core/src/Discussion/DiscussionMetadataUpdater.php
+++ b/framework/core/src/Discussion/DiscussionMetadataUpdater.php
@@ -30,7 +30,7 @@ public function whenPostWasPosted(Posted $event): void
{
$discussion = $event->post->discussion;
- if ($discussion && $discussion->exists) {
+ if ($discussion?->exists) {
$discussion->refreshCommentCount();
$discussion->refreshLastPost();
$discussion->refreshParticipantCount();
@@ -58,7 +58,7 @@ public function whenPostWasRestored(Restored $event): void
{
$discussion = $event->post->discussion;
- if ($discussion && $discussion->exists) {
+ if ($discussion?->exists) {
$discussion->refreshCommentCount();
$discussion->refreshParticipantCount();
$discussion->refreshLastPost();
@@ -70,7 +70,7 @@ protected function removePost(Post $post): void
{
$discussion = $post->discussion;
- if ($discussion && $discussion->exists) {
+ if ($discussion?->exists) {
$discussion->refreshCommentCount();
$discussion->refreshParticipantCount();
diff --git a/framework/core/src/Discussion/DiscussionRepository.php b/framework/core/src/Discussion/DiscussionRepository.php
index 61cec343eb..8914d94e79 100644
--- a/framework/core/src/Discussion/DiscussionRepository.php
+++ b/framework/core/src/Discussion/DiscussionRepository.php
@@ -36,7 +36,6 @@ public function findOrFail(int|string $id, ?User $user = null): Discussion
/**
* Get a query containing the IDs of discussions which a user has read completely.
*
- * @param User $user
* @return Builder
*/
public function getReadIdsQuery(User $user): Builder
@@ -52,7 +51,6 @@ public function getReadIdsQuery(User $user): Builder
* Scope a query to only include records that are visible to a user.
*
* @param Builder $query
- * @param User|null $user
* @return Builder
*/
protected function scopeVisibleTo(Builder $query, ?User $user = null): Builder
diff --git a/framework/core/src/Discussion/Search/FulltextFilter.php b/framework/core/src/Discussion/Search/FulltextFilter.php
index 0a890ca836..9320d466b0 100644
--- a/framework/core/src/Discussion/Search/FulltextFilter.php
+++ b/framework/core/src/Discussion/Search/FulltextFilter.php
@@ -42,7 +42,6 @@ public function search(SearchState $state, string $value): void
protected function sqlite(DatabaseSearchState $state, string $value): void
{
- /** @var Builder $query */
$query = $state->getQuery();
$query->where(function (Builder $query) use ($state, $value) {
@@ -63,7 +62,6 @@ protected function sqlite(DatabaseSearchState $state, string $value): void
protected function mysql(DatabaseSearchState $state, string $value): void
{
- /** @var Builder $query */
$query = $state->getQuery();
// Replace all non-word characters with spaces.
@@ -119,7 +117,6 @@ protected function pgsql(DatabaseSearchState $state, string $value): void
{
$searchConfig = $this->settings->get('pgsql_search_configuration');
- /** @var Builder $query */
$query = $state->getQuery();
$grammar = $query->getGrammar();
diff --git a/framework/core/src/Extend/Auth.php b/framework/core/src/Extend/Auth.php
index 6e5e711240..27d7b78517 100644
--- a/framework/core/src/Extend/Auth.php
+++ b/framework/core/src/Extend/Auth.php
@@ -35,8 +35,6 @@ class Auth implements ExtenderInterface
* password checkers can run.
* - `false` if the given password is invalid, and no other checkers should be considered.
* Evaluation will be immediately halted if any checkers return `false`.
- *
- * @return self
*/
public function addPasswordChecker(string $identifier, callable|string $callback): self
{
@@ -49,7 +47,6 @@ public function addPasswordChecker(string $identifier, callable|string $callback
* Remove a password checker.
*
* @param string $identifier: The unique identifier of the password checker to remove.
- * @return self
*/
public function removePasswordChecker(string $identifier): self
{
diff --git a/framework/core/src/Extend/Conditional.php b/framework/core/src/Extend/Conditional.php
index 2e04855ced..4b1accf308 100644
--- a/framework/core/src/Extend/Conditional.php
+++ b/framework/core/src/Extend/Conditional.php
@@ -38,7 +38,6 @@ class Conditional implements ExtenderInterface
*
* @param string $extensionId The ID of the extension.
* @param callable|string $extenders A callable returning an array of extenders, or an invokable class string.
- * @return self
*/
public function whenExtensionEnabled(string $extensionId, callable|string $extenders): self
{
@@ -52,7 +51,6 @@ public function whenExtensionEnabled(string $extensionId, callable|string $exten
*
* @param string $extensionId The ID of the extension.
* @param callable|string $extenders A callable returning an array of extenders, or an invokable class string.
- * @return self
*/
public function whenExtensionDisabled(string $extensionId, callable|string $extenders): self
{
@@ -67,7 +65,6 @@ public function whenExtensionDisabled(string $extensionId, callable|string $exte
* @param bool|callable $condition A boolean or callable that should return a boolean.
* If this evaluates to true, the extenders will be applied.
* @param callable|string $extenders A callable returning an array of extenders, or an invokable class string.
- * @return self
*/
public function when(callable|bool $condition, callable|string $extenders): self
{
@@ -81,10 +78,6 @@ public function when(callable|bool $condition, callable|string $extenders): self
/**
* Iterates over the conditions and applies the associated extenders if the conditions are met.
- *
- * @param Container $container
- * @param Extension|null $extension
- * @return void
*/
public function extend(Container $container, ?Extension $extension = null): void
{
diff --git a/framework/core/src/Extend/Console.php b/framework/core/src/Extend/Console.php
index e90f5e8ed5..5a7dc5986e 100644
--- a/framework/core/src/Extend/Console.php
+++ b/framework/core/src/Extend/Console.php
@@ -23,7 +23,6 @@ class Console implements ExtenderInterface
* Add a command to the console.
*
* @param class-string $command: ::class attribute of command class, which must extend \Flarum\Console\AbstractCommand.
- * @return self
*/
public function command(string $command): self
{
@@ -48,7 +47,6 @@ public function command(string $command): self
* for more information on available methods and what they do.
*
* @param array $args An array of args to call the command with.
- * @return self
*/
public function schedule(string $command, callable|string $callback, array $args = []): self
{
diff --git a/framework/core/src/Extend/Csrf.php b/framework/core/src/Extend/Csrf.php
index 761b4cff8e..1d2a09218c 100644
--- a/framework/core/src/Extend/Csrf.php
+++ b/framework/core/src/Extend/Csrf.php
@@ -18,9 +18,6 @@ class Csrf implements ExtenderInterface
/**
* Exempt a named route from CSRF checks.
- *
- * @param string $routeName
- * @return self
*/
public function exemptRoute(string $routeName): self
{
diff --git a/framework/core/src/Extend/ErrorHandling.php b/framework/core/src/Extend/ErrorHandling.php
index f15f9e5ddb..d040a2a697 100644
--- a/framework/core/src/Extend/ErrorHandling.php
+++ b/framework/core/src/Extend/ErrorHandling.php
@@ -32,7 +32,6 @@ class ErrorHandling implements ExtenderInterface
*
* @param string $errorType: Type of the error.
* @param int $httpStatus: The status code for this error.
- * @return self
*/
public function status(string $errorType, int $httpStatus): self
{
@@ -52,7 +51,6 @@ public function status(string $errorType, int $httpStatus): self
*
* @param string $exceptionClass: The ::class attribute of the exception class.
* @param string $errorType: Type of the error.
- * @return self
*/
public function type(string $exceptionClass, string $errorType): self
{
@@ -77,7 +75,6 @@ public function type(string $exceptionClass, string $errorType): self
*
* @param string $exceptionClass: The ::class attribute of the exception class.
* @param string $handlerClass: The ::class attribute of the handler class.
- * @return self
*/
public function handler(string $exceptionClass, string $handlerClass): self
{
@@ -99,7 +96,6 @@ public function handler(string $exceptionClass, string $handlerClass): self
* {@see Reporter} interface.
*
* @param class-string $reporterClass: The ::class attribute of the reporter class.
- * @return self
*/
public function reporter(string $reporterClass): self
{
diff --git a/framework/core/src/Extend/Event.php b/framework/core/src/Extend/Event.php
index 2c0c3e8786..f7f316e05a 100644
--- a/framework/core/src/Extend/Event.php
+++ b/framework/core/src/Extend/Event.php
@@ -29,8 +29,6 @@ class Event implements ExtenderInterface
* - The ::class attribute of a class with a public `handle` method, which accepts an instance of the event as a parameter.
* - An array, where the first argument is an object or class name, and the second argument is the method on the
* first argument that should be executed as the listener.
- *
- * @return self
*/
public function listen(string $event, callable|string $listener): self
{
@@ -47,7 +45,6 @@ public function listen(string $event, callable|string $listener): self
* @see https://laravel.com/docs/11.x/events#writing-event-subscribers
*
* @param string $subscriber: The ::class attribute of the subscriber class.
- * @return self
*/
public function subscribe(string $subscriber): self
{
diff --git a/framework/core/src/Extend/Filesystem.php b/framework/core/src/Extend/Filesystem.php
index 301c43c8b7..9fb50514b4 100644
--- a/framework/core/src/Extend/Filesystem.php
+++ b/framework/core/src/Extend/Filesystem.php
@@ -52,8 +52,6 @@ class Filesystem implements ExtenderInterface
* ```
*
* @see https://laravel.com/docs/11.x/filesystem#configuration
- *
- * @return self
*/
public function disk(string $name, callable|string $callback): self
{
@@ -68,7 +66,6 @@ public function disk(string $name, callable|string $callback): self
* @param string $name: The name of the driver.
* @param string $driverClass: The ::class attribute of the driver.
* Driver must implement `\Flarum\Filesystem\DriverInterface`.
- * @return self
*/
public function driver(string $name, string $driverClass): self
{
diff --git a/framework/core/src/Extend/Formatter.php b/framework/core/src/Extend/Formatter.php
index 2c4855b976..e048da575f 100644
--- a/framework/core/src/Extend/Formatter.php
+++ b/framework/core/src/Extend/Formatter.php
@@ -36,8 +36,6 @@ class Formatter implements ExtenderInterface, LifecycleInterface
* - \s9e\TextFormatter\Configurator $configurator
*
* The callable should return void.
- *
- * @return self
*/
public function configure(callable|string $callback): self
{
@@ -60,8 +58,6 @@ public function configure(callable|string $callback): self
*
* The callback should return:
* - string $text: The text to be parsed.
- *
- * @return self
*/
public function parse(callable|string $callback): self
{
@@ -82,8 +78,6 @@ public function parse(callable|string $callback): self
*
* The callback should return:
* - string $xml: The text to be unparsed.
- *
- * @return self
*/
public function unparse(callable|string $callback): self
{
@@ -106,8 +100,6 @@ public function unparse(callable|string $callback): self
*
* The callback should return:
* - string $xml: The xml to be rendered.
- *
- * @return self
*/
public function render(callable|string $callback): self
{
diff --git a/framework/core/src/Extend/Frontend.php b/framework/core/src/Extend/Frontend.php
index fb166f531a..e84ae9c7da 100644
--- a/framework/core/src/Extend/Frontend.php
+++ b/framework/core/src/Extend/Frontend.php
@@ -50,7 +50,6 @@ public function __construct(
* Add a CSS file to load in the frontend.
*
* @param string $path: The path to the CSS file.
- * @return self
*/
public function css(string $path): self
{
@@ -63,7 +62,6 @@ public function css(string $path): self
* Add a JavaScript file to load in the frontend.
*
* @param string $path: The path to the JavaScript file.
- * @return self
*/
public function js(string $path): self
{
@@ -98,8 +96,6 @@ public function jsDirectory(string $path): self
* - \Psr\Http\Message\ServerRequestInterface $request
*
* The callable should return void.
- *
- * @return self
*/
public function route(string $path, string $name, callable|string|null $content = null): self
{
@@ -113,7 +109,6 @@ public function route(string $path, string $name, callable|string|null $content
* This is necessary before overriding a route.
*
* @param string $name: The name of the route.
- * @return self
*/
public function removeRoute(string $name): self
{
@@ -133,8 +128,6 @@ public function removeRoute(string $name): self
*
* The callable should return void.
* @param int $priority: The priority of the content. Higher priorities are executed first.
- *
- * @return self
*/
public function content(callable|string|null $callback, int $priority = 0): self
{
@@ -165,9 +158,6 @@ public function content(callable|string|null $callback, int $priority = 0): self
* ]
* ]);
* ```
- *
- * @param callable|array $preloads
- * @return self
*/
public function preloads(callable|array $preloads): self
{
diff --git a/framework/core/src/Extend/Locales.php b/framework/core/src/Extend/Locales.php
index 83bed9eac9..73863e5cc9 100644
--- a/framework/core/src/Extend/Locales.php
+++ b/framework/core/src/Extend/Locales.php
@@ -15,13 +15,13 @@
use Illuminate\Contracts\Container\Container;
use Symfony\Component\Translation\MessageCatalogueInterface;
-class Locales implements ExtenderInterface, LifecycleInterface
+readonly class Locales implements ExtenderInterface, LifecycleInterface
{
/**
* @param string $directory: Directory of the locale files.
*/
public function __construct(
- private readonly string $directory
+ private string $directory
) {
}
diff --git a/framework/core/src/Extend/Mail.php b/framework/core/src/Extend/Mail.php
index 99d556243a..3d87eb40d8 100644
--- a/framework/core/src/Extend/Mail.php
+++ b/framework/core/src/Extend/Mail.php
@@ -22,7 +22,6 @@ class Mail implements ExtenderInterface
*
* @param string $identifier: Identifier for mail driver. E.g. 'smtp' for SmtpDriver.
* @param class-string $driver: ::class attribute of driver class, which must implement \Flarum\Mail\DriverInterface.
- * @return self
*/
public function driver(string $identifier, string $driver): self
{
diff --git a/framework/core/src/Extend/Middleware.php b/framework/core/src/Extend/Middleware.php
index 877cda0f90..578d99d07f 100644
--- a/framework/core/src/Extend/Middleware.php
+++ b/framework/core/src/Extend/Middleware.php
@@ -34,7 +34,6 @@ public function __construct(
*
* @param class-string $middleware: ::class attribute of the middleware class.
* Must implement \Psr\Http\Server\MiddlewareInterface.
- * @return self
*/
public function add(string $middleware): self
{
@@ -50,7 +49,6 @@ public function add(string $middleware): self
* Or container binding name.
* @param class-string $newMiddleware: ::class attribute of the middleware class.
* Must implement \Psr\Http\Server\MiddlewareInterface.
- * @return self
*/
public function replace(string $originalMiddleware, string $newMiddleware): self
{
@@ -63,7 +61,6 @@ public function replace(string $originalMiddleware, string $newMiddleware): self
* Removes a middleware from the frontend.
*
* @param class-string $middleware: ::class attribute of the middleware class.
- * @return self
*/
public function remove(string $middleware): self
{
@@ -79,7 +76,6 @@ public function remove(string $middleware): self
* Or container binding name.
* @param class-string $newMiddleware: ::class attribute of the middleware class.
* Must implement \Psr\Http\Server\MiddlewareInterface.
- * @return self
*/
public function insertBefore(string $originalMiddleware, string $newMiddleware): self
{
@@ -95,7 +91,6 @@ public function insertBefore(string $originalMiddleware, string $newMiddleware):
* Or container binding name.
* @param class-string $newMiddleware: ::class attribute of the middleware class.
* Must implement \Psr\Http\Server\MiddlewareInterface.
- * @return self
*/
public function insertAfter(string $originalMiddleware, string $newMiddleware): self
{
diff --git a/framework/core/src/Extend/Model.php b/framework/core/src/Extend/Model.php
index 3197ea726b..8c5db1f5c1 100644
--- a/framework/core/src/Extend/Model.php
+++ b/framework/core/src/Extend/Model.php
@@ -13,7 +13,6 @@
use Flarum\Extension\Extension;
use Flarum\Foundation\ContainerUtil;
use Illuminate\Contracts\Container\Container;
-use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Support\Arr;
/**
@@ -38,7 +37,6 @@ public function __construct(
*
* @param string $attribute: The new attribute name.
* @param string $cast: The cast type. See https://laravel.com/docs/11.x/eloquent-mutators#attribute-casting
- * @return self
*/
public function cast(string $attribute, string $cast): self
{
@@ -51,10 +49,6 @@ public function cast(string $attribute, string $cast): self
* Add a default value for a given attribute, which can be an explicit value, a closure,
* or an instance of an invokable class. Unlike with some other extenders,
* it CANNOT be the `::class` attribute of an invokable class.
- *
- * @param string $attribute
- * @param mixed $value
- * @return self
*/
public function default(string $attribute, mixed $value): self
{
@@ -74,7 +68,6 @@ public function default(string $attribute, mixed $value): self
* @param string $related: The ::class attribute of the model, which should extend \Flarum\Database\AbstractModel.
* @param string|null $foreignKey: The foreign key attribute of the parent model.
* @param string|null $ownerKey: The primary key attribute of the parent model.
- * @return self
*/
public function belongsTo(string $name, string $related, ?string $foreignKey = null, ?string $ownerKey = null): self
{
@@ -97,7 +90,6 @@ public function belongsTo(string $name, string $related, ?string $foreignKey = n
* @param string|null $relatedPivotKey: The associated key attribute of the relation.
* @param string|null $parentKey: The key name of the parent model.
* @param string|null $relatedKey: The key name of the related model.
- * @return self
*/
public function belongsToMany(
string $name,
@@ -124,7 +116,6 @@ public function belongsToMany(
* @param string $related: The ::class attribute of the model, which should extend \Flarum\Database\AbstractModel.
* @param string|null $foreignKey: The foreign key attribute of the parent model.
* @param string|null $localKey: The primary key attribute of the parent model.
- * @return self
*/
public function hasOne(string $name, string $related, ?string $foreignKey = null, ?string $localKey = null): self
{
@@ -144,7 +135,6 @@ public function hasOne(string $name, string $related, ?string $foreignKey = null
* @param string $related: The ::class attribute of the model, which should extend \Flarum\Database\AbstractModel.
* @param string|null $foreignKey: The foreign key attribute of the parent model.
* @param string|null $localKey: The primary key attribute of the parent model.
- * @return self
*/
public function hasMany(string $name, string $related, ?string $foreignKey = null, ?string $localKey = null): self
{
@@ -167,8 +157,6 @@ public function hasMany(string $name, string $related, ?string $foreignKey = nul
* The callable should return:
* - $relationship: A Laravel Relationship object. See relevant methods of models
* like \Flarum\User\User for examples of how relationships should be returned.
- *
- * @return self
*/
public function relationship(string $name, callable|string $callback): self
{
diff --git a/framework/core/src/Extend/ModelPrivate.php b/framework/core/src/Extend/ModelPrivate.php
index 3b63e12b79..7db1e462f2 100644
--- a/framework/core/src/Extend/ModelPrivate.php
+++ b/framework/core/src/Extend/ModelPrivate.php
@@ -55,8 +55,6 @@ public function __construct(
* - \Flarum\Database\AbstractModel $instance: An instance of the model.
*
* It should return `true` if the model instance should be made private.
- *
- * @return self
*/
public function checker(callable|string $callback): self
{
diff --git a/framework/core/src/Extend/ModelUrl.php b/framework/core/src/Extend/ModelUrl.php
index 1560242c44..6bccedfc11 100644
--- a/framework/core/src/Extend/ModelUrl.php
+++ b/framework/core/src/Extend/ModelUrl.php
@@ -32,7 +32,6 @@ public function __construct(
*
* @param string $identifier: Identifier for slug driver.
* @param string $driver: ::class attribute of driver class, which must implement Flarum\Http\SlugDriverInterface.
- * @return self
*/
public function addSlugDriver(string $identifier, string $driver): self
{
diff --git a/framework/core/src/Extend/ModelVisibility.php b/framework/core/src/Extend/ModelVisibility.php
index 21bd3e19e2..f9b0af918e 100644
--- a/framework/core/src/Extend/ModelVisibility.php
+++ b/framework/core/src/Extend/ModelVisibility.php
@@ -61,8 +61,6 @@ public function __construct(
* - \Illuminate\Database\Eloquent\Builder $query
*
* The callback should return void.
- *
- * @return self
*/
public function scope(callable|string $callback, string $ability = 'view'): self
{
@@ -82,8 +80,6 @@ public function scope(callable|string $callback, string $ability = 'view'): self
* - string $ability
*
* The callback should return void.
- *
- * @return self
*/
public function scopeAll(callable|string $callback): self
{
diff --git a/framework/core/src/Extend/Notification.php b/framework/core/src/Extend/Notification.php
index 4386fe1d51..1234f87044 100644
--- a/framework/core/src/Extend/Notification.php
+++ b/framework/core/src/Extend/Notification.php
@@ -28,7 +28,6 @@ class Notification implements ExtenderInterface
* This blueprint should implement \Flarum\Notification\Blueprint\BlueprintInterface.
* @param string[] $driversEnabledByDefault: The names of the drivers enabled by default for this notification type.
* (example: alert, email).
- * @return self
*/
public function type(string $blueprint, array $driversEnabledByDefault = []): self
{
@@ -42,7 +41,6 @@ public function type(string $blueprint, array $driversEnabledByDefault = []): se
* @param class-string $driver: The ::class attribute of the driver class.
* This driver should implement \Flarum\Notification\Driver\NotificationDriverInterface.
* @param string[] $typesEnabledByDefault: The names of blueprint classes of types enabled by default for this driver.
- * @return self
*/
public function driver(string $driverName, string $driver, array $typesEnabledByDefault = []): self
{
@@ -61,8 +59,6 @@ public function driver(string $driverName, string $driver, array $typesEnabledBy
*
* The callable should return an array of recipients.
* - \Flarum\User\User[] $newRecipients
- *
- * @return self
*/
public function beforeSending(callable|string $callback): self
{
diff --git a/framework/core/src/Extend/Policy.php b/framework/core/src/Extend/Policy.php
index ff1ab6c891..dae4687de5 100644
--- a/framework/core/src/Extend/Policy.php
+++ b/framework/core/src/Extend/Policy.php
@@ -22,7 +22,6 @@ class Policy implements ExtenderInterface
* Add a custom policy for when an ability check is ran without a model instance.
*
* @param class-string $policy: ::class attribute of policy class, which must extend \Flarum\User\Access\AbstractPolicy
- * @return self
*/
public function globalPolicy(string $policy): self
{
@@ -37,7 +36,6 @@ public function globalPolicy(string $policy): self
* @param string $modelClass: The ::class attribute of the model you are applying policies to.
* This model should extend from \Flarum\Database\AbstractModel.
* @param string $policy: ::class attribute of policy class, which must extend Flarum\User\Access\AbstractPolicy
- * @return self
*/
public function modelPolicy(string $modelClass, string $policy): self
{
diff --git a/framework/core/src/Extend/Post.php b/framework/core/src/Extend/Post.php
index 27282a4d23..775aec5e97 100644
--- a/framework/core/src/Extend/Post.php
+++ b/framework/core/src/Extend/Post.php
@@ -22,7 +22,6 @@ class Post implements ExtenderInterface
* such as those that appear when a discussion is renamed.
*
* @param string $postType: The ::class attribute of the custom Post type that is being added.
- * @return self
*/
public function type(string $postType): self
{
diff --git a/framework/core/src/Extend/Routes.php b/framework/core/src/Extend/Routes.php
index a2f7192924..cbe1b2824a 100644
--- a/framework/core/src/Extend/Routes.php
+++ b/framework/core/src/Extend/Routes.php
@@ -43,8 +43,6 @@ public function __construct(
*
* The handler should return:
* - \Psr\Http\Message\ResponseInterface $response
- *
- * @return self
*/
public function get(string $path, string $name, callable|string $handler): self
{
@@ -66,8 +64,6 @@ public function get(string $path, string $name, callable|string $handler): self
*
* The handler should return:
* - \Psr\Http\Message\ResponseInterface $response
- *
- * @return self
*/
public function post(string $path, string $name, callable|string $handler): self
{
@@ -89,8 +85,6 @@ public function post(string $path, string $name, callable|string $handler): self
*
* The handler should return:
* - \Psr\Http\Message\ResponseInterface $response
- *
- * @return self
*/
public function put(string $path, string $name, callable|string $handler): self
{
@@ -112,8 +106,6 @@ public function put(string $path, string $name, callable|string $handler): self
*
* The handler should return:
* - \Psr\Http\Message\ResponseInterface $response
- *
- * @return self
*/
public function patch(string $path, string $name, callable|string $handler): self
{
@@ -135,8 +127,6 @@ public function patch(string $path, string $name, callable|string $handler): sel
*
* The handler should return:
* - \Psr\Http\Message\ResponseInterface $response
- *
- * @return self
*/
public function delete(string $path, string $name, callable|string $handler): self
{
@@ -160,7 +150,6 @@ private function route(string $httpMethod, string $path, string $name, callable|
* Necessary before overriding a route.
*
* @param string $name: The name of the route.
- * @return self
*/
public function remove(string $name): self
{
diff --git a/framework/core/src/Extend/SearchDriver.php b/framework/core/src/Extend/SearchDriver.php
index 4e1e545ac9..f0ee325277 100644
--- a/framework/core/src/Extend/SearchDriver.php
+++ b/framework/core/src/Extend/SearchDriver.php
@@ -44,7 +44,6 @@ public function __construct(
* @param class-string $searcherClass : The class of the Searcher for this model
* This searcher must implement \Flarum\Search\SearcherInterface.
* Or extend \Flarum\Search\Database\AbstractSearcher if using the default driver.
- * @return self
*/
public function addSearcher(string $modelClass, string $searcherClass): self
{
@@ -61,7 +60,6 @@ public function addSearcher(string $modelClass, string $searcherClass): self
* Or extend \Flarum\Search\Database\AbstractSearcher if using the default driver.
* @param class-string $filterClass: The ::class attribute of the filter you are adding.
* This filter must implement \Flarum\Search\FilterInterface
- * @return self
*/
public function addFilter(string $searcherClass, string $filterClass): self
{
@@ -79,7 +77,6 @@ public function addFilter(string $searcherClass, string $filterClass): self
* @param class-string $replaceFilterClass : The ::class attribute of the filter you are replacing.
* @param class-string $filterClass : The ::class attribute of the filter you are adding.
* This filter must implement \Flarum\Search\FilterInterface
- * @return self
*/
public function replaceFilter(string $searcherClass, string $replaceFilterClass, string $filterClass): self
{
@@ -99,7 +96,6 @@ public function replaceFilter(string $searcherClass, string $replaceFilterClass,
* Or extend \Flarum\Search\Database\AbstractSearcher if using the default driver.
* @param class-string $fulltextClass: The ::class attribute of the full test filter you are adding.
* This filter must implement \Flarum\Search\FilterInterface
- * @return self
*/
public function setFulltext(string $searcherClass, string $fulltextClass): self
{
@@ -121,8 +117,6 @@ public function setFulltext(string $searcherClass, string $fulltextClass): self
* - \Flarum\Query\QueryCriteria $criteria
*
* The callback should return void.
- *
- * @return self
*/
public function addMutator(string $searcherClass, callable|string $callback): self
{
diff --git a/framework/core/src/Extend/ServiceProvider.php b/framework/core/src/Extend/ServiceProvider.php
index 58f98781c4..3f24505197 100644
--- a/framework/core/src/Extend/ServiceProvider.php
+++ b/framework/core/src/Extend/ServiceProvider.php
@@ -25,7 +25,6 @@ class ServiceProvider implements ExtenderInterface
* @see https://docs.flarum.org/extend/service-provider/
*
* @param class-string $serviceProviderClass The ::class attribute of the service provider class.
- * @return self
*/
public function register(string $serviceProviderClass): self
{
diff --git a/framework/core/src/Extend/Session.php b/framework/core/src/Extend/Session.php
index a44971571e..7bb738e08f 100644
--- a/framework/core/src/Extend/Session.php
+++ b/framework/core/src/Extend/Session.php
@@ -25,7 +25,6 @@ class Session implements ExtenderInterface
* @param string $name: The name of the driver.
* @param class-string $driverClass: The ::class attribute of the driver.
* Driver must implement `\Flarum\User\SessionDriverInterface`.
- * @return self
*/
public function driver(string $name, string $driverClass): self
{
diff --git a/framework/core/src/Extend/Settings.php b/framework/core/src/Extend/Settings.php
index 68a9555d28..0f49f046c5 100644
--- a/framework/core/src/Extend/Settings.php
+++ b/framework/core/src/Extend/Settings.php
@@ -40,8 +40,6 @@ class Settings implements ExtenderInterface
*
* The callable should return:
* - mixed $value: The modified value.
- *
- * @return self
*/
public function serializeToForum(string $attributeName, string $key, callable|string|null $callback = null): self
{
@@ -56,7 +54,6 @@ public function serializeToForum(string $attributeName, string $key, callable|st
*
* @param string $key: The setting key, must be unique. Namespace it with the extension ID (example: 'my-extension-id.setting_key').
* @param mixed $value: The setting value.
- * @return self
*/
public function default(string $key, mixed $value): self
{
@@ -91,8 +88,6 @@ public function resetWhen(string $key, callable|string $callback): self
*
* The callable should return:
* - mixed $value: The modified value.
- *
- * @return self
*/
public function registerLessConfigVar(string $configName, string $key, callable|string|null $callback = null): self
{
@@ -105,7 +100,6 @@ public function registerLessConfigVar(string $configName, string $key, callable|
* Register a setting that should trigger JS cache clear when saved.
*
* @param string $setting: The key of the setting.
- * @return self
*/
public function resetJsCacheFor(string $setting): self
{
diff --git a/framework/core/src/Extend/Theme.php b/framework/core/src/Extend/Theme.php
index f878e42b1d..de0a40d5eb 100644
--- a/framework/core/src/Extend/Theme.php
+++ b/framework/core/src/Extend/Theme.php
@@ -29,7 +29,6 @@ class Theme implements ExtenderInterface
* @param string $file : Relative path of the file to override, for example: `forum/Hero.less`
* @param string $newFilePath : Absolute path of the new file.
* @param string|null $extensionId : If overriding an extension file, specify its ID, for example: `flarum-tags`.
- * @return self
*/
public function overrideLessImport(string $file, string $newFilePath, ?string $extensionId = null): self
{
@@ -46,7 +45,6 @@ public function overrideLessImport(string $file, string $newFilePath, ?string $e
* @param string $file : Name of the file to override, for example: `admin.less`
* @param string $newFilePath : Absolute path of the new file.
* @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
{
@@ -72,7 +70,6 @@ public function overrideFileSource(string $file, string $newFilePath, ?string $e
*
* @param string $functionName Name of the function identifier.
* @param callable $callable The PHP function to run when the Less function is called.
- * @return self
*/
public function addCustomLessFunction(string $functionName, callable $callable): self
{
@@ -126,8 +123,6 @@ public function addCustomLessFunction(string $functionName, callable $callable):
*
* @param string $variableName Name of the variable identifier.
* @param callable $value The PHP function to run, which returns the value for the variable.
- *
- * @return self
*/
public function addCustomLessVariable(string $variableName, callable $value): self
{
diff --git a/framework/core/src/Extend/ThrottleApi.php b/framework/core/src/Extend/ThrottleApi.php
index 006b3db8d8..3a1ee7ee7f 100644
--- a/framework/core/src/Extend/ThrottleApi.php
+++ b/framework/core/src/Extend/ThrottleApi.php
@@ -36,8 +36,6 @@ class ThrottleApi implements ExtenderInterface
* - `false`: This marks the request as NOT to be throttled. It overrides all other throttlers
* - `true`: This marks the request as to be throttled.
* All other outputs will be ignored.
- *
- * @return self
*/
public function set(string $name, callable|string $callback): self
{
@@ -50,7 +48,6 @@ public function set(string $name, callable|string $callback): self
* Remove a throttler registered with this name.
*
* @param string $name: The name of the throttler to remove.
- * @return self
*/
public function remove(string $name): self
{
diff --git a/framework/core/src/Extend/User.php b/framework/core/src/Extend/User.php
index 1b76322f59..e88785a7ec 100644
--- a/framework/core/src/Extend/User.php
+++ b/framework/core/src/Extend/User.php
@@ -25,7 +25,6 @@ class User implements ExtenderInterface
*
* @param string $identifier: Identifier for display name driver. E.g. 'username' for UserNameDriver
* @param class-string $driver: ::class attribute of driver class, which must implement Flarum\User\DisplayName\DriverInterface
- * @return self
*/
public function displayNameDriver(string $identifier, string $driver): self
{
@@ -47,8 +46,6 @@ public function displayNameDriver(string $identifier, string $driver): self
*
* The callable should return:
* - array $groupIds: an array of ids for the groups the user belongs to.
- *
- * @return self
*/
public function permissionGroups(callable|string $callback): self
{
@@ -60,10 +57,7 @@ public function permissionGroups(callable|string $callback): self
/**
* Register a new user preference.
*
- * @param string $key
- * @param callable|null $transformer
* @param mixed|null $default
- * @return self
*/
public function registerPreference(string $key, ?callable $transformer = null, mixed $default = null): self
{
diff --git a/framework/core/src/Extend/Validator.php b/framework/core/src/Extend/Validator.php
index a845404986..86bb9d8e60 100644
--- a/framework/core/src/Extend/Validator.php
+++ b/framework/core/src/Extend/Validator.php
@@ -38,8 +38,6 @@ public function __construct(
* - \Illuminate\Validation\Validator $validator: The Laravel validator instance
*
* The callback should return void.
- *
- * @return self
*/
public function configure(callable|string $callback): self
{
diff --git a/framework/core/src/Extend/View.php b/framework/core/src/Extend/View.php
index 71c9f5e971..1130d52fef 100644
--- a/framework/core/src/Extend/View.php
+++ b/framework/core/src/Extend/View.php
@@ -37,7 +37,6 @@ class View implements ExtenderInterface, LifecycleInterface
* @param string $namespace: The name of the namespace.
* @param string|string[] $hints: This is a path (or an array of paths) to the folder(s)
* where view files are stored, relative to the extend.php file.
- * @return self
*/
public function namespace(string $namespace, array|string $hints): self
{
@@ -55,7 +54,6 @@ public function namespace(string $namespace, array|string $hints): self
* @param string $namespace: The name of the namespace.
* @param string|string[] $hints: This is a path (or an array of paths) to the folder(s)
* where view files are stored, relative to the `extend.php` file.
- * @return self
*/
public function extendNamespace(string $namespace, array|string $hints): self
{
@@ -77,8 +75,6 @@ public function extend(Container $container, ?Extension $extension = null): void
}
/**
- * @param Container $container
- * @param Extension $extension
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function onEnable(Container $container, Extension $extension): void
@@ -88,8 +84,6 @@ public function onEnable(Container $container, Extension $extension): void
}
/**
- * @param Container $container
- * @param Extension $extension
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/
public function onDisable(Container $container, Extension $extension): void
diff --git a/framework/core/src/Extension/Bisect.php b/framework/core/src/Extension/Bisect.php
index 77b8ce1c92..bbf8246e15 100644
--- a/framework/core/src/Extension/Bisect.php
+++ b/framework/core/src/Extension/Bisect.php
@@ -107,19 +107,19 @@ protected function bisect(BisectState $state): ?array
return $current;
}
- if (count($relevantEnabled) === 1 && $issue) {
+ if ($issue && count($relevantEnabled) === 1) {
return $this->foundIssue($relevantEnabled[0]);
}
- if (count($relevantDisabled) === 1 && ! $issue) {
+ if (! $issue && count($relevantDisabled) === 1) {
return $this->foundIssue($relevantDisabled[0]);
}
if ($issue) {
return $this->bisect($this->state->advance($low, $mid));
- } else {
- return $this->bisect($this->state->advance($mid + 1, $high));
}
+
+ return $this->bisect($this->state->advance($mid + 1, $high));
}
protected function foundIssue(string $id): array
diff --git a/framework/core/src/Extension/Console/ToggleExtensionCommand.php b/framework/core/src/Extension/Console/ToggleExtensionCommand.php
index e64c7e37dc..1e722c934c 100644
--- a/framework/core/src/Extension/Console/ToggleExtensionCommand.php
+++ b/framework/core/src/Extension/Console/ToggleExtensionCommand.php
@@ -46,19 +46,19 @@ protected function fire(): int
$this->info("The '$name' extension is already enabled.");
return Command::FAILURE;
- } else {
- $this->info("Enabling '$name' extension...");
- $this->extensionManager->enable($name);
}
+
+ $this->info("Enabling '$name' extension...");
+ $this->extensionManager->enable($name);
} else {
if (! $this->extensionManager->isEnabled($name)) {
$this->info("The '$name' extension is already disabled.");
return Command::FAILURE;
- } else {
- $this->info("Disabling '$name' extension...");
- $this->extensionManager->disable($name);
}
+
+ $this->info("Disabling '$name' extension...");
+ $this->extensionManager->disable($name);
}
return Command::SUCCESS;
diff --git a/framework/core/src/Extension/Extension.php b/framework/core/src/Extension/Extension.php
index c44f1e1532..70e8b34860 100644
--- a/framework/core/src/Extension/Extension.php
+++ b/framework/core/src/Extension/Extension.php
@@ -44,7 +44,7 @@
*/
class Extension implements Arrayable
{
- const LOGO_MIMETYPES = [
+ public const LOGO_MIMETYPES = [
'svg' => 'image/svg+xml',
'png' => 'image/png',
'jpeg' => 'image/jpeg',
@@ -144,9 +144,6 @@ public function setInstalled(bool $installed): static
return $this;
}
- /**
- * @return bool
- */
public function isInstalled(): bool
{
return $this->installed;
@@ -263,25 +260,17 @@ public function disable(Container $container): void
/**
* The raw path of the directory under extensions.
- *
- * @return string
*/
public function getId(): string
{
return $this->id;
}
- /**
- * @return string
- */
public function getTitle(): string
{
return $this->composerJsonAttribute('extra.flarum-extension.title');
}
- /**
- * @return string
- */
public function getPath(): string
{
return $this->path;
@@ -289,8 +278,6 @@ public function getPath(): string
/**
* The IDs of all Flarum extensions that this extension depends on.
- *
- * @return array
*/
public function getExtensionDependencyIds(): array
{
@@ -300,8 +287,6 @@ public function getExtensionDependencyIds(): array
/**
* The IDs of all Flarum extensions that this extension should be booted after
* if enabled.
- *
- * @return array
*/
public function getOptionalDependencyIds(): array
{
@@ -436,7 +421,7 @@ public function migrate(Migrator $migrator, string $direction = 'up'): ?int
return null;
}
- if ($direction == 'up') {
+ if ($direction === 'up') {
$migrator->run($this->getPath().'/migrations', $this);
} else {
return $migrator->reset($this->getPath().'/migrations', $this);
@@ -447,12 +432,10 @@ public function migrate(Migrator $migrator, string $direction = 'up'): ?int
/**
* Generates an array result for the object.
- *
- * @return array
*/
public function toArray(): array
{
- return (array) array_merge([
+ return array_merge([
'id' => $this->getId(),
'version' => $this->getVersion(),
'path' => $this->getPath(),
@@ -467,8 +450,6 @@ public function toArray(): array
/**
* Gets the rendered contents of the extension README file as a HTML string.
- *
- * @return string|null
*/
public function getReadme(): ?string
{
diff --git a/framework/core/src/Extension/ExtensionManager.php b/framework/core/src/Extension/ExtensionManager.php
index fb39bee581..f0701a9493 100644
--- a/framework/core/src/Extension/ExtensionManager.php
+++ b/framework/core/src/Extension/ExtensionManager.php
@@ -106,7 +106,7 @@ public function getExtensions(): Collection
$this->setEnabledExtensions($enabledExtensions);
}
- $this->extensions = $extensions->sortBy(function ($extension, $name) {
+ $this->extensions = $extensions->sortBy(function ($extension) {
return $extension->getTitle();
});
}
@@ -470,7 +470,7 @@ public static function resolveExtensionOrder(array $extensionList): array
}, $validOutput)); // Reversed as required by Kahn's algorithm.
foreach ($inDegreeCount as $id => $count) {
- if ($count != 0) {
+ if ($count !== 0) {
$circularDependencies[] = $id;
}
}
diff --git a/framework/core/src/Formatter/Formatter.php b/framework/core/src/Formatter/Formatter.php
index 9434019fd1..51019bfe47 100644
--- a/framework/core/src/Formatter/Formatter.php
+++ b/framework/core/src/Formatter/Formatter.php
@@ -207,9 +207,6 @@ protected function configureDefaultsOnLinks(string $xml): string
/**
* Converts a plain text string (with or without Markdown) to it's HTML equivalent.
- *
- * @param ?string $content
- * @return string
*/
public function convert(?string $content): string
{
diff --git a/framework/core/src/Forum/Content/Discussion.php b/framework/core/src/Forum/Content/Discussion.php
index abcd23a806..5ca0fc6352 100644
--- a/framework/core/src/Forum/Content/Discussion.php
+++ b/framework/core/src/Forum/Content/Discussion.php
@@ -43,8 +43,7 @@ public function __invoke(Document $document, Request $request): Document
$url = function ($newQueryParams) use ($queryParams, $apiDocument) {
$newQueryParams = array_merge($queryParams, $newQueryParams);
- unset($newQueryParams['id']);
- unset($newQueryParams['near']);
+ unset($newQueryParams['id'], $newQueryParams['near']);
if (Arr::get($newQueryParams, 'page') == 1) {
unset($newQueryParams['page']);
@@ -71,7 +70,7 @@ public function __invoke(Document $document, Request $request): Document
$posts = [];
foreach ($postsApiDocument->data as $resource) {
- if ($resource->type === 'posts' && isset($resource->relationships->discussion) && isset($resource->attributes->contentHtml)) {
+ if ($resource->type === 'posts' && isset($resource->relationships->discussion, $resource->attributes->contentHtml)) {
$posts[] = $resource;
}
}
@@ -109,12 +108,13 @@ protected function getApiDocument(Request $request, string $id, array $params =
$params['bySlug'] = true;
return json_decode(
- $this->api
+ json: $this->api
->withoutErrorHandling()
->withParentRequest($request)
->withQueryParams($params)
->get("/discussions/$id")
- ->getBody()
+ ->getBody(),
+ associative: false
);
}
@@ -126,12 +126,13 @@ protected function getApiDocument(Request $request, string $id, array $params =
protected function getPostsApiDocument(Request $request, array $params): object
{
return json_decode(
- $this->api
+ json: $this->api
->withoutErrorHandling()
->withParentRequest($request)
->withQueryParams($params)
->get('/posts')
- ->getBody()
+ ->getBody(),
+ associative: false
);
}
}
diff --git a/framework/core/src/Forum/Content/Index.php b/framework/core/src/Forum/Content/Index.php
index 6120494efe..eb3c2b5ab6 100644
--- a/framework/core/src/Forum/Content/Index.php
+++ b/framework/core/src/Forum/Content/Index.php
@@ -73,12 +73,13 @@ public function __invoke(Document $document, Request $request): Document
protected function getApiDocument(Request $request, array $params): object
{
return json_decode(
- $this->api
+ json: $this->api
->withoutErrorHandling()
->withParentRequest($request)
->withQueryParams($params)
->get('/discussions')
- ->getBody()
+ ->getBody(),
+ associative: false
);
}
}
diff --git a/framework/core/src/Forum/Content/Posts.php b/framework/core/src/Forum/Content/Posts.php
index a7ea5eaa10..3b5f9701df 100644
--- a/framework/core/src/Forum/Content/Posts.php
+++ b/framework/core/src/Forum/Content/Posts.php
@@ -56,7 +56,7 @@ public function __invoke(Document $document, Request $request): Document
$params['filter']['q'] = $q;
}
- $apiDocument = $this->getApiDocument($request, $params, $q);
+ $apiDocument = $this->getApiDocument($request, $params);
$document->title = $this->translator->trans('core.forum.index.meta_title_text');
// $document->content = $this->view->make('flarum.forum::frontend.content.index', compact('apiDocument', 'page'));
@@ -69,15 +69,16 @@ public function __invoke(Document $document, Request $request): Document
return $document;
}
- protected function getApiDocument(Request $request, array $params, ?string $q): ?object
+ protected function getApiDocument(Request $request, array $params): ?object
{
return json_decode(
- $this->api
+ json: $this->api
->withoutErrorHandling()
->withParentRequest($request)
->withQueryParams($params)
->get('/posts')
- ->getBody()
+ ->getBody(),
+ associative: false
);
}
}
diff --git a/framework/core/src/Forum/Content/User.php b/framework/core/src/Forum/Content/User.php
index 8ecee2b0c1..490fdc93e8 100644
--- a/framework/core/src/Forum/Content/User.php
+++ b/framework/core/src/Forum/Content/User.php
@@ -47,11 +47,12 @@ public function __invoke(Document $document, Request $request): Document
protected function getApiDocument(Request $request, string $username): object
{
return json_decode(
- $this->api
+ json: $this->api
->withoutErrorHandling()
->withParentRequest($request)
->withQueryParams(['bySlug' => true])
- ->get("/users/$username")->getBody()
+ ->get("/users/$username")->getBody(),
+ associative: false
);
}
}
diff --git a/framework/core/src/Forum/Controller/LogInController.php b/framework/core/src/Forum/Controller/LogInController.php
index a213cbdb89..b5b1f9fefa 100644
--- a/framework/core/src/Forum/Controller/LogInController.php
+++ b/framework/core/src/Forum/Controller/LogInController.php
@@ -48,8 +48,6 @@ public function handle(Request $request): ResponseInterface
$params = Arr::only($body, ['identification', 'password', 'remember']);
$isHtmlRequest = RequestUtil::isHtmlRequest($request);
- $errors = null;
-
if ($isHtmlRequest) {
$validator = $this->validator->basic()->prepare($body)->validator();
@@ -66,7 +64,7 @@ public function handle(Request $request): ResponseInterface
$response = $this->apiClient->withParentRequest($request)->withBody($params)->post('/token');
if ($response->getStatusCode() === 200) {
- $data = json_decode($response->getBody());
+ $data = json_decode($response->getBody(), false);
$token = AccessToken::findValid($data->token);
diff --git a/framework/core/src/Forum/Controller/LogOutController.php b/framework/core/src/Forum/Controller/LogOutController.php
index 43002eafeb..596ff8f54f 100644
--- a/framework/core/src/Forum/Controller/LogOutController.php
+++ b/framework/core/src/Forum/Controller/LogOutController.php
@@ -82,7 +82,7 @@ protected function sanitizeReturnUrl(string $url, string $base): Uri
try {
$parsedUrl = new Uri($url);
- } catch (\InvalidArgumentException $e) {
+ } catch (\InvalidArgumentException) {
return new Uri($base);
}
diff --git a/framework/core/src/Forum/Controller/RegisterController.php b/framework/core/src/Forum/Controller/RegisterController.php
index a261b33413..aee7c8a9e8 100644
--- a/framework/core/src/Forum/Controller/RegisterController.php
+++ b/framework/core/src/Forum/Controller/RegisterController.php
@@ -32,7 +32,7 @@ public function handle(Request $request): ResponseInterface
$response = $this->api->withParentRequest($request)->withBody($params)->post('/users');
- $body = json_decode($response->getBody());
+ $body = json_decode($response->getBody(), false);
if (isset($body->data)) {
$userId = $body->data->id;
diff --git a/framework/core/src/Forum/ForumServiceProvider.php b/framework/core/src/Forum/ForumServiceProvider.php
index e8c05217a6..963b28012e 100644
--- a/framework/core/src/Forum/ForumServiceProvider.php
+++ b/framework/core/src/Forum/ForumServiceProvider.php
@@ -230,11 +230,7 @@ protected function setDefaultRoute(RouteCollection $routes, Container $container
$factory = $container->make(RouteHandlerFactory::class);
$defaultRoute = $container->make('flarum.settings')->get('default_route');
- if (isset($routes->getRouteData()[0]['GET'][$defaultRoute]['handler'])) {
- $toDefaultController = $routes->getRouteData()[0]['GET'][$defaultRoute]['handler'];
- } else {
- $toDefaultController = $factory->toForum(Content\Index::class);
- }
+ $toDefaultController = $routes->getRouteData()[0]['GET'][$defaultRoute]['handler'] ?? $factory->toForum(Content\Index::class);
$routes->get(
'/',
diff --git a/framework/core/src/Foundation/Application.php b/framework/core/src/Foundation/Application.php
index 2c46ddb555..c82a62118d 100644
--- a/framework/core/src/Foundation/Application.php
+++ b/framework/core/src/Foundation/Application.php
@@ -25,7 +25,7 @@ class Application extends IlluminateContainer implements LaravelApplication
*
* @var string
*/
- const VERSION = '2.0.0-beta.2';
+ public const VERSION = '2.0.0-beta.2';
protected bool $booted = false;
@@ -93,7 +93,7 @@ protected function registerBaseServiceProviders(): void
public function register($provider, $force = false): ServiceProvider
{
- if (($registered = $this->getProvider($provider)) && ! $force) {
+ if (! $force && ($registered = $this->getProvider($provider))) {
return $registered;
}
@@ -197,7 +197,7 @@ public function booted(mixed $callback): void
protected function fireAppCallbacks(array $callbacks): void
{
foreach ($callbacks as $callback) {
- call_user_func($callback, $this);
+ $callback($this);
}
}
diff --git a/framework/core/src/Foundation/Concerns/InteractsWithLaravel.php b/framework/core/src/Foundation/Concerns/InteractsWithLaravel.php
index fac19739c8..350b49e264 100644
--- a/framework/core/src/Foundation/Concerns/InteractsWithLaravel.php
+++ b/framework/core/src/Foundation/Concerns/InteractsWithLaravel.php
@@ -216,6 +216,6 @@ public function shouldSkipMiddleware(): bool
public function joinPaths(string $basePath, string $path = ''): string
{
- return $basePath.($path != '' ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : '');
+ return $basePath.($path !== '' ? DIRECTORY_SEPARATOR.ltrim($path, DIRECTORY_SEPARATOR) : '');
}
}
diff --git a/framework/core/src/Foundation/Config.php b/framework/core/src/Foundation/Config.php
index 3e53ad7a61..633d4731b8 100644
--- a/framework/core/src/Foundation/Config.php
+++ b/framework/core/src/Foundation/Config.php
@@ -16,10 +16,10 @@
use Psr\Http\Message\UriInterface;
use RuntimeException;
-class Config implements ArrayAccess
+readonly class Config implements ArrayAccess
{
public function __construct(
- private readonly array $data
+ private array $data
) {
$this->requireKeys('url');
}
diff --git a/framework/core/src/Foundation/Console/InfoCommand.php b/framework/core/src/Foundation/Console/InfoCommand.php
index 06b9c6e791..b2aa4beabf 100644
--- a/framework/core/src/Foundation/Console/InfoCommand.php
+++ b/framework/core/src/Foundation/Console/InfoCommand.php
@@ -113,7 +113,7 @@ private function findPackageVersion(string $path, ?string $fallback = null): ?st
chdir($cwd);
- if ($status == 0) {
+ if ($status === 0) {
return isset($fallback) ? "$fallback ($output[0])" : $output[0];
}
}
diff --git a/framework/core/src/Foundation/ContainerUtil.php b/framework/core/src/Foundation/ContainerUtil.php
index b0ce825dce..9e1aa04ed9 100644
--- a/framework/core/src/Foundation/ContainerUtil.php
+++ b/framework/core/src/Foundation/ContainerUtil.php
@@ -17,9 +17,7 @@ class ContainerUtil
* Wraps a callback so that string-based invokable classes get resolved only when actually used.
*
* @param callable|class-string $callback : A callable, global function, or a ::class attribute of an invokable class
- * @param Container $container
*
- * @return callable
* @internal Backwards compatibility not guaranteed.
*/
public static function wrapCallback(callable|string $callback, Container $container): callable
diff --git a/framework/core/src/Foundation/ErrorHandling/HandledError.php b/framework/core/src/Foundation/ErrorHandling/HandledError.php
index 5b7fa73492..b1316355a1 100644
--- a/framework/core/src/Foundation/ErrorHandling/HandledError.php
+++ b/framework/core/src/Foundation/ErrorHandling/HandledError.php
@@ -31,7 +31,7 @@ public function __construct(
private readonly Throwable $error,
private readonly string $type,
private readonly int $statusCode,
- private bool $report = false
+ private readonly bool $report = false
) {
}
diff --git a/framework/core/src/Foundation/ErrorHandling/HttpFormatter.php b/framework/core/src/Foundation/ErrorHandling/HttpFormatter.php
index 812c446552..0d4a2641d8 100644
--- a/framework/core/src/Foundation/ErrorHandling/HttpFormatter.php
+++ b/framework/core/src/Foundation/ErrorHandling/HttpFormatter.php
@@ -20,10 +20,6 @@ interface HttpFormatter
* This method receives the error that was caught by Flarum's error handling
* stack, along with the current HTTP request instance. It should return an
* HTTP response that explains or represents what went wrong.
- *
- * @param HandledError $error
- * @param Request $request
- * @return Response
*/
public function format(HandledError $error, Request $request): Response;
}
diff --git a/framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php b/framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php
index 456cd8e58c..d7580e8120 100644
--- a/framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php
+++ b/framework/core/src/Foundation/ErrorHandling/JsonApiFormatter.php
@@ -18,10 +18,10 @@
*
* See https://jsonapi.org/format/1.0/#errors.
*/
-class JsonApiFormatter implements HttpFormatter
+readonly class JsonApiFormatter implements HttpFormatter
{
public function __construct(
- private readonly bool $includeTrace = false
+ private bool $includeTrace = false
) {
}
diff --git a/framework/core/src/Foundation/ErrorHandling/Registry.php b/framework/core/src/Foundation/ErrorHandling/Registry.php
index 0c8a551206..b8a8290df1 100644
--- a/framework/core/src/Foundation/ErrorHandling/Registry.php
+++ b/framework/core/src/Foundation/ErrorHandling/Registry.php
@@ -19,12 +19,12 @@
* of it, map them to error "types" and how to determine appropriate HTTP status
* codes for them.
*/
-class Registry
+readonly class Registry
{
public function __construct(
- private readonly array $statusMap,
- private readonly array $classMap,
- private readonly array $handlerMap
+ private array $statusMap,
+ private array $classMap,
+ private array $handlerMap
) {
}
@@ -36,9 +36,6 @@ public function __construct(
* of {@see HandledError}.
*
* Even for unknown exceptions, a generic fallback will always be returned.
- *
- * @param Throwable $error
- * @return HandledError
*/
public function handle(Throwable $error): HandledError
{
diff --git a/framework/core/src/Foundation/ErrorHandling/Reporter.php b/framework/core/src/Foundation/ErrorHandling/Reporter.php
index 591c6df702..d0e132072a 100644
--- a/framework/core/src/Foundation/ErrorHandling/Reporter.php
+++ b/framework/core/src/Foundation/ErrorHandling/Reporter.php
@@ -15,9 +15,6 @@ interface Reporter
{
/**
* Report an error that Flarum was not able to handle to a backend.
- *
- * @param Throwable $error
- * @return void
*/
public function report(Throwable $error): void;
}
diff --git a/framework/core/src/Foundation/ErrorHandling/ViewFormatter.php b/framework/core/src/Foundation/ErrorHandling/ViewFormatter.php
index 49dd52a5d5..512ffd3533 100644
--- a/framework/core/src/Foundation/ErrorHandling/ViewFormatter.php
+++ b/framework/core/src/Foundation/ErrorHandling/ViewFormatter.php
@@ -29,7 +29,7 @@
*/
class ViewFormatter implements HttpFormatter
{
- const ERRORS_WITH_VIEWS = ['csrf_token_mismatch', 'not_found', 'maintenance'];
+ public const ERRORS_WITH_VIEWS = ['csrf_token_mismatch', 'not_found', 'maintenance'];
public function __construct(
protected ViewFactory $view,
@@ -54,9 +54,9 @@ private function determineView(HandledError $error): string
if (in_array($type, self::ERRORS_WITH_VIEWS)) {
return "flarum.forum::error.$type";
- } else {
- return 'flarum.forum::error.default';
}
+
+ return 'flarum.forum::error.default';
}
private function getMessage(HandledError $error): string
diff --git a/framework/core/src/Foundation/HighMaintenanceModeHandler.php b/framework/core/src/Foundation/HighMaintenanceModeHandler.php
index b45048e14d..1e065275ef 100644
--- a/framework/core/src/Foundation/HighMaintenanceModeHandler.php
+++ b/framework/core/src/Foundation/HighMaintenanceModeHandler.php
@@ -18,7 +18,7 @@
class HighMaintenanceModeHandler implements RequestHandlerInterface
{
- const MESSAGE = 'Currently down for maintenance. Please come back later.';
+ public const MESSAGE = 'Currently down for maintenance. Please come back later.';
/**
* Handle the request and return a response.
diff --git a/framework/core/src/Foundation/InstalledApp.php b/framework/core/src/Foundation/InstalledApp.php
index 94561a2f59..44e8a5d309 100644
--- a/framework/core/src/Foundation/InstalledApp.php
+++ b/framework/core/src/Foundation/InstalledApp.php
@@ -37,7 +37,9 @@ public function getRequestHandler(): RequestHandlerInterface
{
if ($this->config->inHighMaintenanceMode()) {
return $this->container->make('flarum.maintenance.handler');
- } elseif ($this->needsUpdate()) {
+ }
+
+ if ($this->needsUpdate()) {
return $this->getUpdaterHandler();
}
diff --git a/framework/core/src/Foundation/InstalledSite.php b/framework/core/src/Foundation/InstalledSite.php
index 871a2bca0a..e6a020e6d3 100644
--- a/framework/core/src/Foundation/InstalledSite.php
+++ b/framework/core/src/Foundation/InstalledSite.php
@@ -78,7 +78,6 @@ public function bootApp(): AppInterface
/**
* @param ExtenderInterface[] $extenders
- * @return InstalledSite
*/
public function extendWith(array $extenders): self
{
diff --git a/framework/core/src/Foundation/KnownError.php b/framework/core/src/Foundation/KnownError.php
index 12c89b8183..4d36376e74 100644
--- a/framework/core/src/Foundation/KnownError.php
+++ b/framework/core/src/Foundation/KnownError.php
@@ -32,8 +32,6 @@ interface KnownError
* Different exception classes are allowed to return the same status code,
* e.g. when they have similar semantic meaning to the end user, but are
* thrown by different subsystems.
- *
- * @return string
*/
public function getType(): string;
}
diff --git a/framework/core/src/Foundation/Site.php b/framework/core/src/Foundation/Site.php
index 0cc0043b05..36b31f5a0d 100644
--- a/framework/core/src/Foundation/Site.php
+++ b/framework/core/src/Foundation/Site.php
@@ -35,7 +35,7 @@ public static function fromPaths(array $paths): SiteInterface
ini_set('display_errors', 0);
- if (! $config->inDebugMode() && function_exists('error_reporting')) {
+ if (function_exists('error_reporting') && ! $config->inDebugMode()) {
error_reporting(E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED);
}
diff --git a/framework/core/src/Foundation/UninstalledSite.php b/framework/core/src/Foundation/UninstalledSite.php
index 3fea1ad7f9..1ecb43daf1 100644
--- a/framework/core/src/Foundation/UninstalledSite.php
+++ b/framework/core/src/Foundation/UninstalledSite.php
@@ -25,6 +25,7 @@
use Illuminate\View\FileViewFinder;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\StreamHandler;
+use Monolog\Level;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
@@ -54,7 +55,7 @@ protected function bootLaravel(): Container
$app->instance('flarum.config', new Config(['url' => $this->baseUrl]));
$app->alias('flarum.config', Config::class);
$app->instance('flarum.debug', true);
- $app->instance('config', $config = $this->getIlluminateConfig());
+ $app->instance('config', $this->getIlluminateConfig());
$this->registerLogger($app);
@@ -108,7 +109,7 @@ protected function getIlluminateConfig(): ConfigRepository
protected function registerLogger(Container $container): void
{
$logPath = $this->paths->storage.'/logs/flarum-installer.log';
- $handler = new StreamHandler($logPath, Logger::DEBUG);
+ $handler = new StreamHandler($logPath, Level::Debug);
$handler->setFormatter(new LineFormatter(null, null, true, true));
$container->instance('log', new Logger('Flarum Installer', [$handler]));
diff --git a/framework/core/src/Frontend/Assets.php b/framework/core/src/Frontend/Assets.php
index b479096dd5..5a8464cbbc 100644
--- a/framework/core/src/Frontend/Assets.php
+++ b/framework/core/src/Frontend/Assets.php
@@ -23,9 +23,6 @@
*/
class Assets
{
- /**
- * @var array
- */
public array $sources = [
'js' => [],
'css' => [],
diff --git a/framework/core/src/Frontend/Compiler/Concerns/HasSources.php b/framework/core/src/Frontend/Compiler/Concerns/HasSources.php
index 4f1c9f504e..6dd387307d 100644
--- a/framework/core/src/Frontend/Compiler/Concerns/HasSources.php
+++ b/framework/core/src/Frontend/Compiler/Concerns/HasSources.php
@@ -20,7 +20,7 @@ trait HasSources
/**
* @var callable[]
*/
- protected $sourcesCallbacks = [];
+ protected array $sourcesCallbacks = [];
public function addSources(callable $callback): void
{
diff --git a/framework/core/src/Frontend/Compiler/FileVersioner.php b/framework/core/src/Frontend/Compiler/FileVersioner.php
index c600c64261..f4efd5c53d 100644
--- a/framework/core/src/Frontend/Compiler/FileVersioner.php
+++ b/framework/core/src/Frontend/Compiler/FileVersioner.php
@@ -14,7 +14,7 @@
class FileVersioner implements VersionerInterface
{
- const REV_MANIFEST = 'rev-manifest.json';
+ public const REV_MANIFEST = 'rev-manifest.json';
public function __construct(
protected Filesystem $filesystem
diff --git a/framework/core/src/Frontend/Compiler/RevisionCompiler.php b/framework/core/src/Frontend/Compiler/RevisionCompiler.php
index 4cd5aad5fc..58b3269c68 100644
--- a/framework/core/src/Frontend/Compiler/RevisionCompiler.php
+++ b/framework/core/src/Frontend/Compiler/RevisionCompiler.php
@@ -23,7 +23,7 @@ class RevisionCompiler implements CompilerInterface
{
use HasSources;
- const EMPTY_REVISION = 'empty';
+ public const EMPTY_REVISION = 'empty';
protected VersionerInterface $versioner;
@@ -93,7 +93,6 @@ public function getUrl(): ?string
}
/**
- * @param string $file
* @param SourceInterface[] $sources
* @return bool true if the file was written, false if there was nothing to write
*/
diff --git a/framework/core/src/Frontend/Content/CorePayload.php b/framework/core/src/Frontend/Content/CorePayload.php
index ca72aee386..2e8c818c90 100644
--- a/framework/core/src/Frontend/Content/CorePayload.php
+++ b/framework/core/src/Frontend/Content/CorePayload.php
@@ -17,12 +17,12 @@
use Flarum\Settings\SettingsRepositoryInterface;
use Psr\Http\Message\ServerRequestInterface as Request;
-class CorePayload
+readonly class CorePayload
{
public function __construct(
- private readonly LocaleManager $locales,
- private readonly MaintenanceMode $maintenance,
- private readonly SettingsRepositoryInterface $settings
+ private LocaleManager $locales,
+ private MaintenanceMode $maintenance,
+ private SettingsRepositoryInterface $settings
) {
}
diff --git a/framework/core/src/Frontend/Content/Meta.php b/framework/core/src/Frontend/Content/Meta.php
index fd422d0e6f..dee9ad6d52 100644
--- a/framework/core/src/Frontend/Content/Meta.php
+++ b/framework/core/src/Frontend/Content/Meta.php
@@ -14,10 +14,10 @@
use Illuminate\Support\Arr;
use Psr\Http\Message\ServerRequestInterface as Request;
-class Meta
+readonly class Meta
{
public function __construct(
- private readonly LocaleManager $locales
+ private LocaleManager $locales
) {
}
diff --git a/framework/core/src/Frontend/Document.php b/framework/core/src/Frontend/Document.php
index ed242495af..eebdec5f49 100644
--- a/framework/core/src/Frontend/Document.php
+++ b/framework/core/src/Frontend/Document.php
@@ -347,8 +347,8 @@ protected static function setQueryParam(string $url, string $key, ?string $value
}
return $newUrl;
- } else {
- return $url;
}
+
+ return $url;
}
}
diff --git a/framework/core/src/Frontend/FrontendServiceProvider.php b/framework/core/src/Frontend/FrontendServiceProvider.php
index 8a447363be..d598417baf 100644
--- a/framework/core/src/Frontend/FrontendServiceProvider.php
+++ b/framework/core/src/Frontend/FrontendServiceProvider.php
@@ -141,7 +141,7 @@ function (Container $container) {
$this->container->singleton(
'flarum.frontend.custom_less_functions',
function (Container $container) {
- $extensionsEnabled = json_decode($container->make(SettingsRepositoryInterface::class)->get('extensions_enabled'));
+ $extensionsEnabled = json_decode($container->make(SettingsRepositoryInterface::class)->get('extensions_enabled'), true);
// Please note that these functions do not go through the same transformation which the Theme extender's
// `addCustomLessFunction` method does. You'll need to use the correct Less tree return type, and get
diff --git a/framework/core/src/Group/Group.php b/framework/core/src/Group/Group.php
index c2fd48ae1e..3061ff1259 100644
--- a/framework/core/src/Group/Group.php
+++ b/framework/core/src/Group/Group.php
@@ -36,10 +36,10 @@ class Group extends AbstractModel
use ScopeVisibilityTrait;
use HasFactory;
- const ADMINISTRATOR_ID = 1;
- const GUEST_ID = 2;
- const MEMBER_ID = 3;
- const MODERATOR_ID = 4;
+ public const ADMINISTRATOR_ID = 1;
+ public const GUEST_ID = 2;
+ public const MEMBER_ID = 3;
+ public const MODERATOR_ID = 4;
protected $casts = [
'id' => 'integer',
@@ -86,9 +86,6 @@ public function users(): BelongsToMany
return $this->belongsToMany(User::class);
}
- /**
- * @return HasMany
- */
public function permissions(): HasMany
{
return $this->hasMany(Permission::class);
diff --git a/framework/core/src/Group/GroupRepository.php b/framework/core/src/Group/GroupRepository.php
index 1a6bc4b515..bdc12a64ed 100644
--- a/framework/core/src/Group/GroupRepository.php
+++ b/framework/core/src/Group/GroupRepository.php
@@ -17,7 +17,7 @@ class GroupRepository
/**
* @return Builder
*/
- public function query()
+ public function query(): Builder
{
return Group::query();
}
@@ -44,7 +44,6 @@ public function queryVisibleTo(?User $actor = null): Builder
* Scope a query to only include records that are visible to a user.
*
* @param Builder $query
- * @param User|null $actor
* @return Builder
*/
protected function scopeVisibleTo(Builder $query, ?User $actor = null): Builder
diff --git a/framework/core/src/Http/Access/AccessTokenPolicy.php b/framework/core/src/Http/Access/AccessTokenPolicy.php
index fc74195362..614fb83fb9 100644
--- a/framework/core/src/Http/Access/AccessTokenPolicy.php
+++ b/framework/core/src/Http/Access/AccessTokenPolicy.php
@@ -15,7 +15,7 @@
class AccessTokenPolicy extends AbstractPolicy
{
- public function revoke(User $actor, AccessToken $token): ?string
+ public function revoke(User $actor, #[\SensitiveParameter] AccessToken $token): ?string
{
if ($token->user_id === $actor->id || $actor->hasPermission('moderateAccessTokens')) {
return $this->allow();
diff --git a/framework/core/src/Http/AccessToken.php b/framework/core/src/Http/AccessToken.php
index 8de6b3b61a..864e19b5ea 100644
--- a/framework/core/src/Http/AccessToken.php
+++ b/framework/core/src/Http/AccessToken.php
@@ -90,11 +90,10 @@ public static function make(int $userId): static
{
if (static::class === self::class) {
throw new \Exception('Use of AccessToken::generate() is not allowed: use the `generate` method on one of the subclasses.');
- } else {
- $token = new static;
- $token->type = static::$type;
}
+ $token = new static;
+ $token->type = static::$type;
$token->token = Str::random(40);
$token->user_id = $userId;
$token->created_at = Carbon::now();
@@ -165,7 +164,7 @@ protected static function scopeExpired(Builder $query, Carbon $date): void
* Shortcut to find a valid token.
* @param string $token Token as sent by the user. We allow non-string values like null so we can directly feed any value from a request.
*/
- public static function findValid(string $token): ?AccessToken
+ public static function findValid(#[\SensitiveParameter] string $token): ?AccessToken
{
return static::query()->whereValid()->where('token', $token)->first();
}
diff --git a/framework/core/src/Http/CookieFactory.php b/framework/core/src/Http/CookieFactory.php
index bf955ccb0a..a9e518c062 100644
--- a/framework/core/src/Http/CookieFactory.php
+++ b/framework/core/src/Http/CookieFactory.php
@@ -52,9 +52,7 @@ public function make(string $name, ?string $value = null, ?int $maxAge = null):
->withExpires(time() + $maxAge);
}
- if ($this->domain != null) {
- $cookie = $cookie->withDomain($this->domain);
- }
+ $cookie = $cookie->withDomain($this->domain);
// Explicitly set SameSite value, use sensible default if no value provided
$cookie = $cookie->withSameSite(SameSite::{$this->samesite ?? 'lax'}());
diff --git a/framework/core/src/Http/Event/DeveloperTokenCreated.php b/framework/core/src/Http/Event/DeveloperTokenCreated.php
index ec6839e9aa..be3e7c4a35 100644
--- a/framework/core/src/Http/Event/DeveloperTokenCreated.php
+++ b/framework/core/src/Http/Event/DeveloperTokenCreated.php
@@ -14,7 +14,7 @@
class DeveloperTokenCreated
{
public function __construct(
- public AccessToken $token
+ #[\SensitiveParameter] public AccessToken $token
) {
}
}
diff --git a/framework/core/src/Http/Middleware/AuthenticateWithHeader.php b/framework/core/src/Http/Middleware/AuthenticateWithHeader.php
index bce59949b6..5ab6313663 100644
--- a/framework/core/src/Http/Middleware/AuthenticateWithHeader.php
+++ b/framework/core/src/Http/Middleware/AuthenticateWithHeader.php
@@ -21,7 +21,7 @@
class AuthenticateWithHeader implements Middleware
{
- const TOKEN_PREFIX = 'Token ';
+ public const TOKEN_PREFIX = 'Token ';
public function process(Request $request, Handler $handler): Response
{
diff --git a/framework/core/src/Http/Middleware/CheckForMaintenanceMode.php b/framework/core/src/Http/Middleware/CheckForMaintenanceMode.php
index 808627735a..f8445ea7d9 100644
--- a/framework/core/src/Http/Middleware/CheckForMaintenanceMode.php
+++ b/framework/core/src/Http/Middleware/CheckForMaintenanceMode.php
@@ -17,11 +17,11 @@
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
-class CheckForMaintenanceMode implements MiddlewareInterface
+readonly class CheckForMaintenanceMode implements MiddlewareInterface
{
public function __construct(
- private readonly MaintenanceMode $maintenance,
- private readonly array $exemptRoutes,
+ private MaintenanceMode $maintenance,
+ private array $exemptRoutes,
) {
}
@@ -30,7 +30,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
$actor = RequestUtil::getActor($request);
$isRouteExcluded = in_array($request->getAttribute('routeName'), $this->exemptRoutes, true);
- if ($this->maintenance->inMaintenanceMode() && ! $actor->isAdmin() && ! $isRouteExcluded) {
+ if (! $isRouteExcluded && $this->maintenance->inMaintenanceMode() && ! $actor->isAdmin()) {
throw new MaintenanceModeException('The forum is currently in maintenance mode.');
}
diff --git a/framework/core/src/Http/Middleware/RememberFromCookie.php b/framework/core/src/Http/Middleware/RememberFromCookie.php
index c5d8315f62..6623a504e0 100644
--- a/framework/core/src/Http/Middleware/RememberFromCookie.php
+++ b/framework/core/src/Http/Middleware/RememberFromCookie.php
@@ -32,7 +32,7 @@ public function process(Request $request, Handler $handler): Response
if ($id) {
$token = AccessToken::findValid($id);
- if ($token && $token instanceof RememberAccessToken) {
+ if ($token instanceof RememberAccessToken) {
$token->touch(request: $request);
/** @var \Illuminate\Contracts\Session\Session $session */
diff --git a/framework/core/src/Http/Rememberer.php b/framework/core/src/Http/Rememberer.php
index 24dc23d904..a8f9a3f30d 100644
--- a/framework/core/src/Http/Rememberer.php
+++ b/framework/core/src/Http/Rememberer.php
@@ -14,7 +14,7 @@
class Rememberer
{
- const COOKIE_NAME = 'remember';
+ public const COOKIE_NAME = 'remember';
public function __construct(
protected CookieFactory $cookie
@@ -24,7 +24,7 @@ public function __construct(
/**
* Sets the remember cookie on a response.
*/
- public function remember(ResponseInterface $response, RememberAccessToken $token): ResponseInterface
+ public function remember(ResponseInterface $response, #[\SensitiveParameter] RememberAccessToken $token): ResponseInterface
{
return FigResponseCookies::set(
$response,
diff --git a/framework/core/src/Http/RouteCollection.php b/framework/core/src/Http/RouteCollection.php
index 9d20e22e05..27a760267f 100644
--- a/framework/core/src/Http/RouteCollection.php
+++ b/framework/core/src/Http/RouteCollection.php
@@ -131,7 +131,7 @@ public function getPath(string $name, array $parameters = []): string
// and the second element is a regex into which the parameter value is inserted, if the parameter matches.
foreach ($this->reverse[$name] as $parts) {
foreach ($parts as $i => $part) {
- if (is_array($part) && Arr::exists($parameters, $part[0]) && $i > $maxMatches) {
+ if ($i > $maxMatches && is_array($part) && Arr::exists($parameters, $part[0])) {
$maxMatches = $i;
$matchingParts = $parts;
}
diff --git a/framework/core/src/Http/Server.php b/framework/core/src/Http/Server.php
index d8c43208bb..dd297c839f 100644
--- a/framework/core/src/Http/Server.php
+++ b/framework/core/src/Http/Server.php
@@ -21,10 +21,10 @@
use Psr\Log\LoggerInterface;
use Throwable;
-class Server
+readonly class Server
{
public function __construct(
- private readonly SiteInterface $site
+ private SiteInterface $site
) {
}
@@ -76,7 +76,6 @@ private function safelyBootAndGetHandler() // @phpstan-ignore-line
* There is always a risk for this to fail,
* for example if the container bindings aren't present
* or if there is a filesystem error.
- * @param Throwable $error
* @throws Throwable
*/
private function cleanBootExceptionLog(Throwable $error): void
@@ -99,7 +98,9 @@ private function cleanBootExceptionLog(Throwable $error): void
$error
ERROR;
exit(1);
- } elseif ($container->has(LoggerInterface::class)) {
+ }
+
+ if ($container->has(LoggerInterface::class)) {
// If the application booted far enough for the logger to be available, we will log the error there
// Considering most boot errors are related to database or extensions, the logger should already be loaded
// We check for LoggerInterface binding because it's a constructor dependency of LogReporter,
diff --git a/framework/core/src/Http/SessionAuthenticator.php b/framework/core/src/Http/SessionAuthenticator.php
index 35ee76753f..66f83b706d 100644
--- a/framework/core/src/Http/SessionAuthenticator.php
+++ b/framework/core/src/Http/SessionAuthenticator.php
@@ -13,7 +13,7 @@
class SessionAuthenticator
{
- public function logIn(Session $session, AccessToken $token): void
+ public function logIn(Session $session, #[\SensitiveParameter] AccessToken $token): void
{
$session->regenerate(true);
$session->put('access_token', $token->token);
diff --git a/framework/core/src/Install/AdminUser.php b/framework/core/src/Install/AdminUser.php
index f032c51d80..1861d4e162 100644
--- a/framework/core/src/Install/AdminUser.php
+++ b/framework/core/src/Install/AdminUser.php
@@ -12,12 +12,12 @@
use Carbon\Carbon;
use Illuminate\Hashing\BcryptHasher;
-class AdminUser
+readonly class AdminUser
{
public function __construct(
- private readonly string $username,
- private readonly string $password,
- private readonly string $email
+ private string $username,
+ #[\SensitiveParameter] private string $password,
+ private string $email
) {
$this->validate();
}
diff --git a/framework/core/src/Install/Console/UserDataProvider.php b/framework/core/src/Install/Console/UserDataProvider.php
index 60a71947a0..d546d9d9a7 100644
--- a/framework/core/src/Install/Console/UserDataProvider.php
+++ b/framework/core/src/Install/Console/UserDataProvider.php
@@ -54,7 +54,7 @@ private function getDatabaseConfiguration(): DatabaseConfig
$host = $this->ask('Database host (required):', required: true);
if (Str::contains($host, ':')) {
- list($host, $port) = explode(':', $host, 2);
+ [$host, $port] = explode(':', $host, 2);
}
$user = $this->ask('Database user (required):', required: true);
diff --git a/framework/core/src/Install/Controller/InstallController.php b/framework/core/src/Install/Controller/InstallController.php
index 484c9e3d36..f3297d19f7 100644
--- a/framework/core/src/Install/Controller/InstallController.php
+++ b/framework/core/src/Install/Controller/InstallController.php
@@ -85,7 +85,7 @@ private function makeDatabaseConfig(array $input): DatabaseConfig
};
if (Str::contains($host, ':')) {
- list($host, $port) = explode(':', $host, 2);
+ [$host, $port] = explode(':', $host, 2);
}
return new DatabaseConfig(
diff --git a/framework/core/src/Install/DatabaseConfig.php b/framework/core/src/Install/DatabaseConfig.php
index 325bff6aad..bf7b39fe3d 100644
--- a/framework/core/src/Install/DatabaseConfig.php
+++ b/framework/core/src/Install/DatabaseConfig.php
@@ -20,7 +20,7 @@ public function __construct(
private readonly int $port,
private string $database,
private readonly ?string $username,
- private readonly ?string $password,
+ #[\SensitiveParameter] private readonly ?string $password,
private readonly ?string $prefix
) {
$this->validate();
@@ -46,11 +46,11 @@ private function validate(): void
throw new ValidationFailed('Currently, only MySQL, MariaDB, SQLite and PostgreSQL are supported.');
}
- if (in_array($this->driver, ['mysql', 'mariadb', 'pgsql']) && empty($this->host)) {
+ if (empty($this->host) && in_array($this->driver, ['mysql', 'mariadb', 'pgsql'])) {
throw new ValidationFailed('Please specify the hostname of your database server.');
}
- if (in_array($this->driver, ['mysql', 'mariadb', 'pgsql']) && ($this->port < 1 || $this->port > 65535)) {
+ if (($this->port < 1 || $this->port > 65535) && in_array($this->driver, ['mysql', 'mariadb', 'pgsql'])) {
throw new ValidationFailed('Please provide a valid port number between 1 and 65535.');
}
@@ -58,7 +58,7 @@ private function validate(): void
throw new ValidationFailed('Please specify the database name.');
}
- if (in_array($this->driver, ['mysql', 'mariadb', 'pgsql']) && empty($this->username)) {
+ if (empty($this->username) && in_array($this->driver, ['mysql', 'mariadb', 'pgsql'])) {
throw new ValidationFailed('Please specify the username for accessing the database.');
}
diff --git a/framework/core/src/Install/Installation.php b/framework/core/src/Install/Installation.php
index 68926ee04e..6a821c2b93 100644
--- a/framework/core/src/Install/Installation.php
+++ b/framework/core/src/Install/Installation.php
@@ -82,7 +82,7 @@ public function adminUser(AdminUser $admin): self
return $this;
}
- public function accessToken(string $token): self
+ public function accessToken(#[\SensitiveParameter] string $token): self
{
$this->accessToken = $token;
diff --git a/framework/core/src/Install/Prerequisite/WritablePaths.php b/framework/core/src/Install/Prerequisite/WritablePaths.php
index 91ca121904..03af1281f6 100644
--- a/framework/core/src/Install/Prerequisite/WritablePaths.php
+++ b/framework/core/src/Install/Prerequisite/WritablePaths.php
@@ -61,17 +61,17 @@ private function getAbsolutePath(string $path): string
$absolutes = [];
foreach ($parts as $part) {
- if ('.' == $part) {
+ if ($part === '.') {
continue;
}
- if ('..' == $part) {
+ if ($part === '..') {
array_pop($absolutes);
} else {
$absolutes[] = $part;
}
}
- return (substr($path, 0, 1) == '/' ? '/' : '').implode(DIRECTORY_SEPARATOR, $absolutes);
+ return (str_starts_with($path, '/') ? '/' : '').implode(DIRECTORY_SEPARATOR, $absolutes);
}
private function normalize(array $paths): Collection
diff --git a/framework/core/src/Install/Steps/ConnectToDatabase.php b/framework/core/src/Install/Steps/ConnectToDatabase.php
index 8e66328a3e..779458111e 100644
--- a/framework/core/src/Install/Steps/ConnectToDatabase.php
+++ b/framework/core/src/Install/Steps/ConnectToDatabase.php
@@ -24,12 +24,12 @@
use InvalidArgumentException;
use RangeException;
-class ConnectToDatabase implements Step
+readonly class ConnectToDatabase implements Step
{
public function __construct(
- private readonly DatabaseConfig $dbConfig,
- private readonly Closure $store,
- private readonly string $basePath
+ private DatabaseConfig $dbConfig,
+ private Closure $store,
+ private string $basePath
) {
}
diff --git a/framework/core/src/Install/Steps/CreateAdminUser.php b/framework/core/src/Install/Steps/CreateAdminUser.php
index 1f94217ca3..32c8446af5 100644
--- a/framework/core/src/Install/Steps/CreateAdminUser.php
+++ b/framework/core/src/Install/Steps/CreateAdminUser.php
@@ -15,12 +15,12 @@
use Flarum\Install\Step;
use Illuminate\Database\ConnectionInterface;
-class CreateAdminUser implements Step
+readonly class CreateAdminUser implements Step
{
public function __construct(
- private readonly ConnectionInterface $database,
- private readonly AdminUser $admin,
- private readonly ?string $accessToken = null
+ private ConnectionInterface $database,
+ private AdminUser $admin,
+ #[\SensitiveParameter] private ?string $accessToken = null
) {
}
diff --git a/framework/core/src/Install/Steps/EnableBundledExtensions.php b/framework/core/src/Install/Steps/EnableBundledExtensions.php
index 1730b2964b..8c13d03226 100644
--- a/framework/core/src/Install/Steps/EnableBundledExtensions.php
+++ b/framework/core/src/Install/Steps/EnableBundledExtensions.php
@@ -94,7 +94,7 @@ private function loadExtensions(): Collection
$installedExtensions = (new Collection($installed))
->filter(function ($package) {
- return Arr::get($package, 'type') == 'flarum-extension';
+ return Arr::get($package, 'type') === 'flarum-extension';
})->filter(function ($package) {
return ! empty(Arr::get($package, 'name'));
})->map(function ($package) {
diff --git a/framework/core/src/Install/Steps/PublishAssets.php b/framework/core/src/Install/Steps/PublishAssets.php
index 19755816fb..2618f4792c 100644
--- a/framework/core/src/Install/Steps/PublishAssets.php
+++ b/framework/core/src/Install/Steps/PublishAssets.php
@@ -12,11 +12,11 @@
use Flarum\Install\ReversibleStep;
use Illuminate\Filesystem\Filesystem;
-class PublishAssets implements ReversibleStep
+readonly class PublishAssets implements ReversibleStep
{
public function __construct(
- private readonly string $vendorPath,
- private readonly string $assetPath
+ private string $vendorPath,
+ private string $assetPath
) {
}
diff --git a/framework/core/src/Install/Steps/RunMigrations.php b/framework/core/src/Install/Steps/RunMigrations.php
index 09dc387073..da78d065c1 100644
--- a/framework/core/src/Install/Steps/RunMigrations.php
+++ b/framework/core/src/Install/Steps/RunMigrations.php
@@ -15,12 +15,12 @@
use Illuminate\Database\ConnectionInterface;
use Illuminate\Filesystem\Filesystem;
-class RunMigrations implements Step
+readonly class RunMigrations implements Step
{
public function __construct(
- private readonly ConnectionInterface $database,
- private readonly string $driver,
- private readonly string $path
+ private ConnectionInterface $database,
+ private string $driver,
+ private string $path
) {
}
diff --git a/framework/core/src/Install/Steps/StoreConfig.php b/framework/core/src/Install/Steps/StoreConfig.php
index 596482b04f..d3709994de 100644
--- a/framework/core/src/Install/Steps/StoreConfig.php
+++ b/framework/core/src/Install/Steps/StoreConfig.php
@@ -13,13 +13,13 @@
use Flarum\Install\DatabaseConfig;
use Flarum\Install\ReversibleStep;
-class StoreConfig implements ReversibleStep
+readonly class StoreConfig implements ReversibleStep
{
public function __construct(
- private readonly bool $debugMode,
- private readonly DatabaseConfig $dbConfig,
- private readonly BaseUrl $baseUrl,
- private readonly string $configFile
+ private bool $debugMode,
+ private DatabaseConfig $dbConfig,
+ private BaseUrl $baseUrl,
+ private string $configFile
) {
}
diff --git a/framework/core/src/Install/Steps/WriteSettings.php b/framework/core/src/Install/Steps/WriteSettings.php
index e4bb582e0a..e85b2fd0d6 100644
--- a/framework/core/src/Install/Steps/WriteSettings.php
+++ b/framework/core/src/Install/Steps/WriteSettings.php
@@ -14,11 +14,11 @@
use Flarum\Settings\DatabaseSettingsRepository;
use Illuminate\Database\ConnectionInterface;
-class WriteSettings implements Step
+readonly class WriteSettings implements Step
{
public function __construct(
- private readonly ConnectionInterface $database,
- private readonly array $custom
+ private ConnectionInterface $database,
+ private array $custom
) {
}
diff --git a/framework/core/src/Locale/Translator.php b/framework/core/src/Locale/Translator.php
index 11948c49f6..dba663484c 100644
--- a/framework/core/src/Locale/Translator.php
+++ b/framework/core/src/Locale/Translator.php
@@ -14,7 +14,7 @@
class Translator extends BaseTranslator implements TranslatorInterface
{
- const REFERENCE_REGEX = '/^=>\s*([a-z0-9_\-\.]+)$/i';
+ public const REFERENCE_REGEX = '/^=>\s*([a-z0-9_\-\.]+)$/i';
public function get($key, array $replace = [], $locale = null): string
{
@@ -29,7 +29,7 @@ public function choice($key, $number, array $replace = [], $locale = null): stri
public function getCatalogue(?string $locale = null): MessageCatalogueInterface
{
- if (null === $locale) {
+ if ($locale === null) {
$locale = $this->getLocale();
} else {
$this->assertValidLocale($locale);
@@ -55,7 +55,7 @@ private function parseCatalogue(MessageCatalogueInterface $catalogue): void
{
foreach ($catalogue->all() as $domain => $messages) {
foreach ($messages as $id => $translation) {
- if (! empty($translation) && preg_match(self::REFERENCE_REGEX, $translation, $matches)) {
+ if (! empty($translation) && preg_match(self::REFERENCE_REGEX, $translation)) {
$catalogue->set($id, $this->getTranslation($catalogue, $id, $domain), $domain);
}
}
diff --git a/framework/core/src/Mail/LogDriver.php b/framework/core/src/Mail/LogDriver.php
index 8547738906..6e2a6299be 100644
--- a/framework/core/src/Mail/LogDriver.php
+++ b/framework/core/src/Mail/LogDriver.php
@@ -15,10 +15,10 @@
use Psr\Log\LoggerInterface;
use Symfony\Component\Mailer\Transport\TransportInterface;
-class LogDriver implements DriverInterface
+readonly class LogDriver implements DriverInterface
{
public function __construct(
- private readonly LoggerInterface $logger
+ private LoggerInterface $logger
) {
}
diff --git a/framework/core/src/Notification/Driver/AlertNotificationDriver.php b/framework/core/src/Notification/Driver/AlertNotificationDriver.php
index 8019135ee8..f769fc1c7e 100644
--- a/framework/core/src/Notification/Driver/AlertNotificationDriver.php
+++ b/framework/core/src/Notification/Driver/AlertNotificationDriver.php
@@ -16,10 +16,10 @@
use Illuminate\Contracts\Queue\Queue;
use ReflectionClass;
-class AlertNotificationDriver implements NotificationDriverInterface
+readonly class AlertNotificationDriver implements NotificationDriverInterface
{
public function __construct(
- private readonly Queue $queue
+ private Queue $queue
) {
}
diff --git a/framework/core/src/Notification/Driver/EmailNotificationDriver.php b/framework/core/src/Notification/Driver/EmailNotificationDriver.php
index f0ea53344e..59dd0b9a6f 100644
--- a/framework/core/src/Notification/Driver/EmailNotificationDriver.php
+++ b/framework/core/src/Notification/Driver/EmailNotificationDriver.php
@@ -16,10 +16,10 @@
use Illuminate\Contracts\Queue\Queue;
use ReflectionClass;
-class EmailNotificationDriver implements NotificationDriverInterface
+readonly class EmailNotificationDriver implements NotificationDriverInterface
{
public function __construct(
- private readonly Queue $queue
+ private Queue $queue
) {
}
diff --git a/framework/core/src/Notification/Notification.php b/framework/core/src/Notification/Notification.php
index 3819efe71d..3cb66047c1 100644
--- a/framework/core/src/Notification/Notification.php
+++ b/framework/core/src/Notification/Notification.php
@@ -93,9 +93,6 @@ public function fromUser(): BelongsTo
return $this->belongsTo(User::class, 'from_user_id');
}
- /**
- * @return MorphTo
- */
public function subject(): MorphTo
{
return $this->morphTo('subject', 'subjectModel');
diff --git a/framework/core/src/Notification/NotificationServiceProvider.php b/framework/core/src/Notification/NotificationServiceProvider.php
index 98c4d1d570..c409604e61 100644
--- a/framework/core/src/Notification/NotificationServiceProvider.php
+++ b/framework/core/src/Notification/NotificationServiceProvider.php
@@ -64,7 +64,7 @@ protected function addType(string $blueprintClass, array $driversEnabledByDefaul
$blueprintClass::getSubjectModel()
);
- foreach (NotificationSyncer::getNotificationDrivers() as $driverName => $driver) {
+ foreach (NotificationSyncer::getNotificationDrivers() as $driver) {
$driver->registerType(
$blueprintClass,
$driversEnabledByDefault
diff --git a/framework/core/src/Notification/NotificationSyncer.php b/framework/core/src/Notification/NotificationSyncer.php
index c1d56ef0e1..37d6793128 100644
--- a/framework/core/src/Notification/NotificationSyncer.php
+++ b/framework/core/src/Notification/NotificationSyncer.php
@@ -103,7 +103,7 @@ public function sync(BlueprintInterface $blueprint, array $users): void
// receiving this notification for the first time (we know because they
// didn't have a record in the database). As both operations can be
// intensive on resources (database and mail server), we queue them.
- foreach (static::getNotificationDrivers() as $driverName => $driver) {
+ foreach (static::getNotificationDrivers() as $driver) {
$driver->send($blueprint, $newRecipients);
}
}
diff --git a/framework/core/src/Notification/UnsubscribeToken.php b/framework/core/src/Notification/UnsubscribeToken.php
index 035025e10f..01dad8053c 100644
--- a/framework/core/src/Notification/UnsubscribeToken.php
+++ b/framework/core/src/Notification/UnsubscribeToken.php
@@ -36,7 +36,7 @@ class UnsubscribeToken extends AbstractModel
protected $fillable = ['user_id', 'email_type', 'token'];
- const TOKEN_LENGTH = 60;
+ public const TOKEN_LENGTH = 60;
public static function generate(int $userId, string $emailType): static
{
diff --git a/framework/core/src/Post/PostRepository.php b/framework/core/src/Post/PostRepository.php
index 6ac36c71d0..af2c824301 100644
--- a/framework/core/src/Post/PostRepository.php
+++ b/framework/core/src/Post/PostRepository.php
@@ -60,7 +60,7 @@ public function findWhere(array $where = [], ?User $actor = null, array $sort =
->skip($start)
->take($count);
- foreach ((array) $sort as $field => $order) {
+ foreach ($sort as $field => $order) {
$query->orderBy($field, $order);
}
@@ -100,7 +100,7 @@ public function getIndexForNumber(int $discussionId, int $number, ?User $actor =
// We don't add $number as a binding because for some
// reason doing so makes the bindings go out of order.
- ->orderByRaw('ABS(CAST(number AS SIGNED) - '.(int) $number.')');
+ ->orderByRaw('ABS(CAST(number AS SIGNED) - '.$number.')');
});
return $query->count();
diff --git a/framework/core/src/Queue/ExceptionHandler.php b/framework/core/src/Queue/ExceptionHandler.php
index 9733578345..946b560d49 100644
--- a/framework/core/src/Queue/ExceptionHandler.php
+++ b/framework/core/src/Queue/ExceptionHandler.php
@@ -13,17 +13,16 @@
use Psr\Log\LoggerInterface;
use Throwable;
-class ExceptionHandler implements ExceptionHandling
+readonly class ExceptionHandler implements ExceptionHandling
{
public function __construct(
- private readonly LoggerInterface $logger
+ private LoggerInterface $logger
) {
}
/**
* Report or log an exception.
*
- * @param Throwable $e
* @return void
*/
public function report(Throwable $e)
@@ -35,7 +34,6 @@ public function report(Throwable $e)
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
- * @param Throwable $e
* @return void
*/
public function render($request, Throwable $e) /** @phpstan-ignore-line */
@@ -47,7 +45,6 @@ public function render($request, Throwable $e) /** @phpstan-ignore-line */
* Render an exception to the console.
*
* @param \Symfony\Component\Console\Output\OutputInterface $output
- * @param Throwable $e
* @return void
*/
public function renderForConsole($output, Throwable $e)
@@ -58,7 +55,6 @@ public function renderForConsole($output, Throwable $e)
/**
* Determine if the exception should be reported.
*
- * @param Throwable $e
* @return bool
*/
public function shouldReport(Throwable $e)
diff --git a/framework/core/src/Search/Database/AbstractSearcher.php b/framework/core/src/Search/Database/AbstractSearcher.php
index dec58b3b6a..2ac2bfae39 100644
--- a/framework/core/src/Search/Database/AbstractSearcher.php
+++ b/framework/core/src/Search/Database/AbstractSearcher.php
@@ -52,7 +52,7 @@ public function search(SearchCriteria $criteria): SearchResults
// results. If there are, we will get rid of that extra result.
$results = $query->get();
- if ($areMoreResults = $criteria->limit > 0 && $results->count() > $criteria->limit) {
+ if ($areMoreResults = ($criteria->limit > 0 && $results->count() > $criteria->limit)) {
$results->pop();
}
diff --git a/framework/core/src/Search/SearchCriteria.php b/framework/core/src/Search/SearchCriteria.php
index c13f408d1c..dc9ed44335 100644
--- a/framework/core/src/Search/SearchCriteria.php
+++ b/framework/core/src/Search/SearchCriteria.php
@@ -41,6 +41,6 @@ public function __construct(
public function isFulltext(): bool
{
- return in_array('q', array_keys($this->filters), true);
+ return array_key_exists('q', $this->filters);
}
}
diff --git a/framework/core/src/Settings/MemoryCacheSettingsRepository.php b/framework/core/src/Settings/MemoryCacheSettingsRepository.php
index 5f75849f36..7642c01c8a 100644
--- a/framework/core/src/Settings/MemoryCacheSettingsRepository.php
+++ b/framework/core/src/Settings/MemoryCacheSettingsRepository.php
@@ -35,7 +35,9 @@ public function get(string $key, mixed $default = null): mixed
{
if (array_key_exists($key, $this->cache)) {
return $this->cache[$key];
- } elseif (! $this->isCached) {
+ }
+
+ if (! $this->isCached) {
return Arr::get($this->all(), $key, $default);
}
diff --git a/framework/core/src/Settings/SettingsValidator.php b/framework/core/src/Settings/SettingsValidator.php
index 8819391e8a..e87094c3ee 100644
--- a/framework/core/src/Settings/SettingsValidator.php
+++ b/framework/core/src/Settings/SettingsValidator.php
@@ -33,7 +33,7 @@ protected function makeValidator(array $attributes): Validator
// Apply attribute specific rules.
foreach ($rules as $key => $value) {
- $rules[$key] = array_merge($rules[$key], $this->rules[$key] ?? []);
+ $rules[$key] = array_merge($value, $this->rules[$key] ?? []);
}
$validator = $this->validator->make($attributes, $rules, $this->getMessages());
diff --git a/framework/core/src/User/Access/AbstractPolicy.php b/framework/core/src/User/Access/AbstractPolicy.php
index 16bd326cb7..4e02ed19e1 100644
--- a/framework/core/src/User/Access/AbstractPolicy.php
+++ b/framework/core/src/User/Access/AbstractPolicy.php
@@ -45,7 +45,7 @@ public function checkAbility(User $actor, string $ability, string|AbstractModel|
// If a specific method for this ability is defined,
// call that and return any non-null results
if (method_exists($this, $ability)) {
- $result = $this->sanitizeResult(call_user_func_array([$this, $ability], [$actor, $instance]));
+ $result = $this->sanitizeResult($this->{$ability}($actor, $instance));
if (! is_null($result)) {
return $result;
@@ -54,7 +54,7 @@ public function checkAbility(User $actor, string $ability, string|AbstractModel|
// If a "total access" method is defined, try that.
if (method_exists($this, 'can')) {
- return $this->sanitizeResult(call_user_func_array([$this, 'can'], [$actor, $ability, $instance]));
+ return $this->sanitizeResult($this->can($actor, $ability, $instance));
}
return null;
@@ -74,7 +74,9 @@ public function sanitizeResult(string|bool|null $result): ?string
{
if ($result === true) {
return $this->allow();
- } elseif ($result === false) {
+ }
+
+ if ($result === false) {
return $this->deny();
}
diff --git a/framework/core/src/User/Access/Gate.php b/framework/core/src/User/Access/Gate.php
index 8d6fa10459..c7743d087c 100644
--- a/framework/core/src/User/Access/Gate.php
+++ b/framework/core/src/User/Access/Gate.php
@@ -72,11 +72,7 @@ public function allows(User $actor, string $ability, string|AbstractModel|null $
// If no policy covered this permission query, we will only grant
// the permission if the actor's groups have it. Otherwise, we will
// not allow the user to perform this action.
- if ($actor->isAdmin() || $actor->hasPermission($ability)) {
- return true;
- }
-
- return false;
+ return $actor->isAdmin() || $actor->hasPermission($ability);
}
/**
diff --git a/framework/core/src/User/AccountActivationMailerTrait.php b/framework/core/src/User/AccountActivationMailerTrait.php
index 2038b04580..7ff13ced54 100644
--- a/framework/core/src/User/AccountActivationMailerTrait.php
+++ b/framework/core/src/User/AccountActivationMailerTrait.php
@@ -25,7 +25,7 @@ protected function generateToken(User $user, string $email): EmailToken
/**
* Get the data that should be made available to email templates.
*/
- protected function getEmailData(User $user, EmailToken $token): array
+ protected function getEmailData(User $user, #[\SensitiveParameter] EmailToken $token): array
{
return [
'username' => $user->display_name,
@@ -41,10 +41,10 @@ protected function sendConfirmationEmail(User $user, array $data): void
$this->queue->push(new SendInformationalEmailJob(
email: $user->email,
+ displayName: Arr::get($data, 'username'),
subject: $subject,
body: $body,
- forumTitle: Arr::get($data, 'forum'),
- displayName: Arr::get($data, 'username')
+ forumTitle: Arr::get($data, 'forum')
));
}
}
diff --git a/framework/core/src/User/AvatarValidator.php b/framework/core/src/User/AvatarValidator.php
index ade155ba20..91198afcab 100644
--- a/framework/core/src/User/AvatarValidator.php
+++ b/framework/core/src/User/AvatarValidator.php
@@ -13,7 +13,6 @@
use Flarum\Foundation\ValidationException;
use Flarum\Locale\TranslatorInterface;
use Illuminate\Validation\Factory;
-use Illuminate\Validation\Validator;
use Intervention\Gif\Exceptions\DecoderException as GifDecoderException;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\ImageManager;
@@ -64,7 +63,7 @@ protected function assertFileMimes(UploadedFileInterface $file): void
$phpExtensions = ['php', 'php3', 'php4', 'php5', 'phtml'];
$fileExtension = pathinfo($file->getClientFilename(), PATHINFO_EXTENSION);
- if (in_array(trim(strtolower($fileExtension)), $phpExtensions)) {
+ if (in_array(strtolower(trim($fileExtension)), $phpExtensions)) {
$this->raise('mimes', [':values' => implode(', ', $allowedTypes)]);
}
diff --git a/framework/core/src/User/Command/ConfirmEmail.php b/framework/core/src/User/Command/ConfirmEmail.php
index 626653a463..71df2d12e4 100644
--- a/framework/core/src/User/Command/ConfirmEmail.php
+++ b/framework/core/src/User/Command/ConfirmEmail.php
@@ -9,13 +9,15 @@
namespace Flarum\User\Command;
+use SensitiveParameter;
+
class ConfirmEmail
{
public function __construct(
/**
* The email confirmation token.
*/
- public string $token
+ #[SensitiveParameter] public string $token
) {
}
}
diff --git a/framework/core/src/User/EmailConfirmationMailer.php b/framework/core/src/User/EmailConfirmationMailer.php
index 221d9e4c57..207a557047 100644
--- a/framework/core/src/User/EmailConfirmationMailer.php
+++ b/framework/core/src/User/EmailConfirmationMailer.php
@@ -37,10 +37,10 @@ public function handle(EmailChangeRequested $event): void
$this->queue->push(new SendInformationalEmailJob(
email: $email,
- subject:$subject,
+ displayName: Arr::get($data, 'username'),
+ subject: $subject,
body: $body,
- forumTitle: Arr::get($data, 'forum'),
- displayName: Arr::get($data, 'username')
+ forumTitle: Arr::get($data, 'forum')
));
}
diff --git a/framework/core/src/User/Event/LoggedIn.php b/framework/core/src/User/Event/LoggedIn.php
index be4404cfd0..ebc9efbd0e 100644
--- a/framework/core/src/User/Event/LoggedIn.php
+++ b/framework/core/src/User/Event/LoggedIn.php
@@ -16,7 +16,7 @@ class LoggedIn
{
public function __construct(
public User $user,
- public AccessToken $token
+ #[\SensitiveParameter] public AccessToken $token
) {
}
}
diff --git a/framework/core/src/User/LoginProvider.php b/framework/core/src/User/LoginProvider.php
index d463b9de5e..4ee4015a6b 100644
--- a/framework/core/src/User/LoginProvider.php
+++ b/framework/core/src/User/LoginProvider.php
@@ -30,7 +30,7 @@ class LoginProvider extends AbstractModel
public $timestamps = true;
- const UPDATED_AT = 'last_login_at';
+ public const UPDATED_AT = 'last_login_at';
protected $fillable = ['provider', 'identifier'];
diff --git a/framework/core/src/User/RegistrationToken.php b/framework/core/src/User/RegistrationToken.php
index 069ad0a061..db774f8be7 100644
--- a/framework/core/src/User/RegistrationToken.php
+++ b/framework/core/src/User/RegistrationToken.php
@@ -64,7 +64,7 @@ public static function generate(string $provider, string $identifier, array $att
*
* @throws InvalidConfirmationTokenException
*/
- public function scopeValidOrFail(Builder $query, string $token): ?RegistrationToken
+ public function scopeValidOrFail(Builder $query, #[\SensitiveParameter] string $token): RegistrationToken
{
/** @var RegistrationToken|null $token */
$token = $query->find($token);
diff --git a/framework/core/src/User/SessionManager.php b/framework/core/src/User/SessionManager.php
index 101ecc37d1..bbfb9f8383 100644
--- a/framework/core/src/User/SessionManager.php
+++ b/framework/core/src/User/SessionManager.php
@@ -30,10 +30,10 @@ public function handler(): SessionHandlerInterface
$driverName = Arr::get($config, 'session.driver');
try {
- $driverInstance = parent::driver($driverName);
+ $driverInstance = $this->driver($driverName);
} catch (InvalidArgumentException) {
$defaultDriverName = $this->getDefaultDriver();
- $driverInstance = parent::driver($defaultDriverName);
+ $driverInstance = $this->driver($defaultDriverName);
// But we will log a critical error to the webmaster.
$this->container->make(LoggerInterface::class)->critical(
diff --git a/framework/core/src/User/User.php b/framework/core/src/User/User.php
index a22bff8c48..8e25119558 100644
--- a/framework/core/src/User/User.php
+++ b/framework/core/src/User/User.php
@@ -87,7 +87,7 @@ class User extends AbstractModel
*
* @var string[]|null
*/
- protected $permissions = null;
+ protected ?array $permissions = null;
/**
* An array of callables, through each of which the user's list of groups is passed
@@ -207,7 +207,7 @@ public function requestEmailChange(string $email): static
return $this;
}
- public function changePassword(string $password): static
+ public function changePassword(#[\SensitiveParameter] string $password): static
{
$this->password = $password;
@@ -267,7 +267,7 @@ public function getDisplayNameAttribute(): string
return static::$displayNameDriver->displayName($this);
}
- public function checkPassword(string $password): bool
+ public function checkPassword(#[\SensitiveParameter] string $password): bool
{
$valid = false;
@@ -276,7 +276,9 @@ public function checkPassword(string $password): bool
if ($result === false) {
return false;
- } elseif ($result === true) {
+ }
+
+ if ($result === true) {
$valid = true;
}
}
@@ -315,7 +317,7 @@ public function hasPermissionLike(string $match): bool
}
foreach ($this->getPermissions() as $permission) {
- if (substr($permission, -strlen($match)) === $match) {
+ if (str_ends_with($permission, $match)) {
return true;
}
}
@@ -351,9 +353,6 @@ protected function unreadNotifications(): HasMany
->whereSubjectVisibleTo($this);
}
- /**
- * @return Collection
- */
protected function getUnreadNotifications(): Collection
{
return $this->unreadNotifications()->get();
@@ -423,7 +422,7 @@ public function setPreference(string $key, mixed $value): static
$preferences = $this->preferences;
if (! is_null($transformer = static::$preferences[$key]['transformer'])) {
- $preferences[$key] = call_user_func($transformer, $value);
+ $preferences[$key] = $transformer($value);
} else {
$preferences[$key] = $value;
}
@@ -573,8 +572,6 @@ public function passwordTokens(): HasMany
/**
* Define the relationship with the permissions of all the groups that
* the user is in.
- *
- * @return Builder
*/
public function permissions(): Builder
{
diff --git a/framework/core/src/User/UserMetadataUpdater.php b/framework/core/src/User/UserMetadataUpdater.php
index 3f9290b739..49f026a9a5 100644
--- a/framework/core/src/User/UserMetadataUpdater.php
+++ b/framework/core/src/User/UserMetadataUpdater.php
@@ -49,7 +49,7 @@ public function whenDiscussionWasDeleted(DiscussionDeleted $event): void
private function updateCommentsCount(?User $user): void
{
- if ($user && $user->exists) {
+ if ($user?->exists) {
$user->refreshCommentCount()->save();
}
}
@@ -58,7 +58,7 @@ private function updateDiscussionsCount(Discussion $discussion): void
{
$user = $discussion->user;
- if ($user && $user->exists) {
+ if ($user?->exists) {
$user->refreshDiscussionCount()->save();
}
}
diff --git a/framework/core/src/User/UserServiceProvider.php b/framework/core/src/User/UserServiceProvider.php
index 524871feaa..1c3477e633 100644
--- a/framework/core/src/User/UserServiceProvider.php
+++ b/framework/core/src/User/UserServiceProvider.php
@@ -91,7 +91,7 @@ protected function registerPasswordCheckers(): void
{
$this->container->singleton('flarum.user.password_checkers', function (Container $container) {
return [
- 'standard' => function (User $user, $password) use ($container) {
+ 'standard' => function (User $user, #[\SensitiveParameter] $password) use ($container) {
if ($container->make('hash')->check($password, $user->password)) {
return true;
}
diff --git a/framework/core/src/helpers.php b/framework/core/src/helpers.php
index 4fcef6e84a..94bda5f0f5 100644
--- a/framework/core/src/helpers.php
+++ b/framework/core/src/helpers.php
@@ -17,7 +17,6 @@
*
* @template T
* @param string|class-string $name
- * @param array $parameters
* @return T|mixed
*/
function resolve(string $name, array $parameters = [])