forked from GNUsocial/gnu-social
[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);
|
DB::persist($activity);
|
||||||
|
|
||||||
if (!\is_null($target)) {
|
if (!\is_null($target)) {
|
||||||
switch ($target[0]) {
|
$target = \is_int($target) ? Actor::getById($target) : $target;
|
||||||
case '!':
|
$mentions[] = [
|
||||||
$mentions[] = [
|
'mentioned' => [$target],
|
||||||
'mentioned' => [LocalGroup::getActorByNickname(mb_substr($target, 1))],
|
'type' => match ($target->getType()) {
|
||||||
'type' => 'group',
|
Actor::PERSON => 'mention',
|
||||||
'text' => mb_substr($target, 1),
|
Actor::GROUP => 'group',
|
||||||
];
|
default => throw new ClientException(_m('Unknown target type give in \'In\' field: {target}', ['{target}' => $target?->getNickname() ?? '<null>'])),
|
||||||
break;
|
},
|
||||||
default:
|
'text' => $target->getNickname(),
|
||||||
throw new ClientException(_m('Unknown target type give in \'In\' field: ' . $target));
|
];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$mention_ids = F\unique(F\flat_map($mentions, fn (array $m) => F\map($m['mentioned'] ?? [], fn (Actor $a) => $a->getId())));
|
$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 App\Core\DB\DB;
|
||||||
use function App\Core\I18n\_m;
|
use function App\Core\I18n\_m;
|
||||||
use App\Entity\Actor;
|
use App\Entity\Actor;
|
||||||
|
use App\Util\Common;
|
||||||
use App\Util\Exception\BugFoundException;
|
use App\Util\Exception\BugFoundException;
|
||||||
use App\Util\Exception\ClientException;
|
use App\Util\Exception\ClientException;
|
||||||
use Component\Collection\Util\Controller\CircleController;
|
use Component\Collection\Util\Controller\CircleController;
|
||||||
|
Loading…
Reference in New Issue
Block a user