[COMPONENTS][Posting] Replaced is_int() with is_numeric(), casting target to int when using Actor getter

From php-stan: is int with string evaluates to false

Thus, the change was made in order to behave as intended
This commit is contained in:
Eliseu Amaro 2022-01-03 17:58:48 +00:00
parent 4ae160b0f8
commit 07b65584ff
Signed by: eliseuamaro
GPG Key ID: 96DA09D4B97BC2D5

View File

@ -46,7 +46,6 @@ use App\Util\Formatting;
use Component\Attachment\Entity\ActorToAttachment;
use Component\Attachment\Entity\AttachmentToNote;
use Component\Conversation\Conversation;
use Component\Group\Entity\LocalGroup;
use Component\Language\Entity\Language;
use Functional as F;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
@ -253,7 +252,7 @@ class Posting extends Component
DB::persist($activity);
if (!\is_null($target)) {
$target = \is_int($target) ? Actor::getById($target) : $target;
$target = is_numeric($target) ? Actor::getById((int) $target) : $target;
$mentions[] = [
'mentioned' => [$target],
'type' => match ($target->getType()) {