[TOOLS] Fix errors found by PHPStan
This commit is contained in:
parent
8fa04bb47d
commit
9e0a2dd4a0
|
@ -253,17 +253,16 @@ class Posting extends Component
|
|||
DB::persist($activity);
|
||||
|
||||
if (!\is_null($target)) {
|
||||
switch ($target[0]) {
|
||||
case '!':
|
||||
$mentions[] = [
|
||||
'mentioned' => [LocalGroup::getActorByNickname(mb_substr($target, 1))],
|
||||
'type' => 'group',
|
||||
'text' => mb_substr($target, 1),
|
||||
];
|
||||
break;
|
||||
default:
|
||||
throw new ClientException(_m('Unknown target type give in \'In\' field: ' . $target));
|
||||
}
|
||||
$target = \is_int($target) ? Actor::getById($target) : $target;
|
||||
$mentions[] = [
|
||||
'mentioned' => [$target],
|
||||
'type' => match ($target->getType()) {
|
||||
Actor::PERSON => 'mention',
|
||||
Actor::GROUP => 'group',
|
||||
default => throw new ClientException(_m('Unknown target type give in \'In\' field: {target}', ['{target}' => $target?->getNickname() ?? '<null>'])),
|
||||
},
|
||||
'text' => $target->getNickname(),
|
||||
];
|
||||
}
|
||||
|
||||
$mention_ids = F\unique(F\flat_map($mentions, fn (array $m) => F\map($m['mentioned'] ?? [], fn (Actor $a) => $a->getId())));
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace Plugin\Directory\Controller;
|
|||
use App\Core\DB\DB;
|
||||
use function App\Core\I18n\_m;
|
||||
use App\Entity\Actor;
|
||||
use App\Util\Common;
|
||||
use App\Util\Exception\BugFoundException;
|
||||
use App\Util\Exception\ClientException;
|
||||
use Component\Collection\Util\Controller\CircleController;
|
||||
|
|
Loading…
Reference in New Issue
Block a user