Skip to content

Commit

Permalink
* fix all violations of PHPStorm inspection `Class constant type is m…
Browse files Browse the repository at this point in the history
…issing`

* add typing for variable `$subReplies` @ `App\Http\PostsQuery\BaseQuery->fillWithParentPost()`
@ be
  • Loading branch information
n0099 committed Sep 22, 2024
1 parent 7b1131c commit 5b75057
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions be/app/Eloquent/Model/Post/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ abstract class Post extends ModelWithTableNameSplitByFid
{
use ModelHasPublicField;

protected const TIMESTAMP_FIELDS = [
protected const array TIMESTAMP_FIELDS = [
'createdAt',
'updatedAt',
'lastSeenAt',
];

private const MODEL_CLASS_TO_TABLE_NAME_SUFFIX = [
private const array MODEL_CLASS_TO_TABLE_NAME_SUFFIX = [
Thread::class => 'thread',
Reply::class => 'reply',
ReplyContent::class => 'reply_content',
Expand Down
14 changes: 7 additions & 7 deletions be/app/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,35 @@ class Helper
{
public const POST_ID = ['tid', 'pid', 'spid'];

public const POST_TYPES = ['thread', 'reply', 'subReply'];
public const array POST_TYPES = ['thread', 'reply', 'subReply'];

public const POST_TYPES_PLURAL = ['threads', 'replies', 'subReplies'];
public const array POST_TYPES_PLURAL = ['threads', 'replies', 'subReplies'];

public const POST_TYPE_TO_PLURAL = [
public const array POST_TYPE_TO_PLURAL = [
'thread' => 'threads',
'reply' => 'replies',
'subReply' => 'subReplies',
];

public const POST_TYPE_PLURAL_TO_TYPE = [
public const array POST_TYPE_PLURAL_TO_TYPE = [
'threads' => 'thread',
'replies' => 'reply',
'subReplies' => 'subReply',
];

public const POST_ID_TO_TYPE_PLURAL = [
public const array POST_ID_TO_TYPE_PLURAL = [
'tid' => 'threads',
'pid' => 'replies',
'spid' => 'subReplies',
];

public const POST_ID_TO_TYPE = [
public const array POST_ID_TO_TYPE = [
'tid' => 'thread',
'pid' => 'reply',
'spid' => 'subReply',
];

public const POST_TYPE_TO_ID = [
public const array POST_TYPE_TO_ID = [
'thread' => 'tid',
'reply' => 'pid',
'subReply' => 'spid',
Expand Down
1 change: 1 addition & 0 deletions be/app/Http/PostsQuery/BaseQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ public function fillWithParentPost(): array
/** @var Collection<int, int> $pids */
/** @var Collection<int, int> $spids */
/** @var Collection<int, Reply> $replies */
/** @var Collection<int, SubReply> $subReplies */
[[, $tids], [$replies, $pids], [$subReplies, $spids]] = array_map(
/**
* @param string $postIDName
Expand Down
2 changes: 1 addition & 1 deletion be/app/Http/PostsQuery/ParamsValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class ParamsValidator
{
public const UNIQUE_PARAMS_NAME = ['fid', 'postTypes', 'orderBy'];
public const array UNIQUE_PARAMS_NAME = ['fid', 'postTypes', 'orderBy'];

public QueryParams $params;

Expand Down

0 comments on commit 5b75057

Please sign in to comment.