Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Nov 7, 2024
1 parent cd3af7f commit 54992b7
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion framework/core/src/Frontend/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private function addSources(string $type, callable $callback): void
$this->sources[$type][] = $callback;
}

private function populate(CompilerInterface $compiler, string $type, string $locale = null): void
private function populate(CompilerInterface $compiler, string $type, ?string $locale = null): void
{
$compiler->addSources(function (SourceCollector $sources) use ($type, $locale) {
foreach ($this->sources[$type] as $callback) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function addString(Closure $callback): static
return $this;
}

public function addDirectory(string $directory, string $extensionId = null): static
public function addDirectory(string $directory, ?string $extensionId = null): static
{
$this->sources[] = $this->validateSourceType(
new DirectorySource($directory, $extensionId)
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Http/AccessToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public static function make(int $userId): static
* Update the time of last usage of a token.
* If a request object is provided, the IP address and User Agent will also be logged.
*/
public function touch($attribute = null, ServerRequestInterface $request = null): bool
public function touch($attribute = null, ?ServerRequestInterface $request = null): bool
{
$now = Carbon::now();

Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Http/RouteHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public function toForum(string $content = null): Closure
return $this->toFrontend('forum', $content);
}

public function toAdmin(string $content = null): Closure
public function toAdmin(?string $content = null): Closure
{
return $this->toFrontend('admin', $content);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Locale/LocaleManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function hasLocale(string $locale): bool
return isset($this->locales[$locale]);
}

public function addTranslations(string $locale, string $file, string $module = null): void
public function addTranslations(string $locale, string $file, ?string $module = null): void
{
$prefix = $module ? $module.'::' : '';

Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/Mail/FlarumLogTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class FlarumLogTransport extends LogTransport
/**
* {@inheritdoc}
*/
public function send(RawMessage $message, Envelope $envelope = null): ?SentMessage
public function send(RawMessage $message, ?Envelope $envelope = null): ?SentMessage
{
$string = $message->toString();

Expand Down
4 changes: 2 additions & 2 deletions framework/core/src/Post/PostRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function findOrFail(int $id, ?User $actor = null): Post
* Find posts that match certain conditions, optionally making sure they
* are visible to a certain user, and/or using other criteria.
*/
public function findWhere(array $where = [], User $actor = null, array $sort = [], int $count = null, int $start = 0): Collection
public function findWhere(array $where = [], ?User $actor = null, array $sort = [], ?int $count = null, int $start = 0): Collection
{
$query = $this->queryVisibleTo($actor)
->where($where)
Expand Down Expand Up @@ -110,7 +110,7 @@ public function getIndexForNumber(int $discussionId, int $number, ?User $actor =
* @param int[] $ids
* @return Builder<Post>
*/
protected function queryIds(array $ids, User $actor = null): Builder
protected function queryIds(array $ids, ?User $actor = null): Builder
{
return $this->queryVisibleTo($actor)->whereIn('posts.id', $ids);
}
Expand Down
2 changes: 1 addition & 1 deletion framework/core/src/User/AvatarValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected function assertFileSize(UploadedFileInterface $file): void
}
}

protected function raise(string $error, array $parameters = [], string $rule = null): void
protected function raise(string $error, array $parameters = [], ?string $rule = null): void
{
// When we switched to intl ICU message format, the translation parameters
// have become required to be in the format `{param}`.
Expand Down
8 changes: 4 additions & 4 deletions framework/core/src/User/UserRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function findOrFail(int|string $id, User $actor = null): Model
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function findOrFailByUsername(string $username, User $actor = null): Model
public function findOrFailByUsername(string $username, ?User $actor = null): Model
{
$query = $this->query()->where('username', $username);

Expand All @@ -75,7 +75,7 @@ public function findByEmail(string $email): ?Model
return $this->query()->where('email', $email)->first();
}

public function getIdForUsername(string $username, User $actor = null): ?int
public function getIdForUsername(string $username, ?User $actor = null): ?int
{
$query = $this->query()->where('username', $username);

Expand All @@ -93,7 +93,7 @@ public function getIdsForUsernames(array $usernames, User $actor = null): array
* Find users by matching a string of words against their username,
* optionally making sure they are visible to a certain user.
*/
public function getIdsForUsername(string $string, User $actor = null): array
public function getIdsForUsername(string $string, ?User $actor = null): array
{
$string = $this->escapeLikeString($string);

Expand All @@ -107,7 +107,7 @@ public function getIdsForUsername(string $string, User $actor = null): array
/**
* @return Builder<User>
*/
protected function scopeVisibleTo(Builder $query, User $actor = null): Builder
protected function scopeVisibleTo(Builder $query, ?User $actor = null): Builder
{
if ($actor !== null) {
$query->whereVisibleTo($actor);
Expand Down

0 comments on commit 54992b7

Please sign in to comment.