Issues (6)

src/MySQLReplication/Event/GtidEvent.php (1 issue)

Labels
Severity
1
<?php
2
declare(strict_types=1);
3
4
namespace MySQLReplication\Event;
5
6
use MySQLReplication\Event\DTO\GTIDLogDTO;
7
8
class GtidEvent extends EventCommon
9
{
10
    public function makeGTIDLogDTO(): GTIDLogDTO
11
    {
12
        $commit_flag = 1 === $this->binaryDataReader->readUInt8();
13
        $sid = unpack('H*', $this->binaryDataReader->read(16))[1];
14
        $gno = $this->binaryDataReader->readUInt64();
15
16
        $gtid = vsprintf('%s%s%s%s%s%s%s%s-%s%s%s%s-%s%s%s%s-%s%s%s%s-%s%s%s%s%s%s%s%s%s%s%s%s', str_split($sid)) . ':' . $gno;
0 ignored issues
show
It seems like str_split($sid) can also be of type true; however, parameter $values of vsprintf() does only seem to accept array, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

16
        $gtid = vsprintf('%s%s%s%s%s%s%s%s-%s%s%s%s-%s%s%s%s-%s%s%s%s-%s%s%s%s%s%s%s%s%s%s%s%s', /** @scrutinizer ignore-type */ str_split($sid)) . ':' . $gno;
Loading history...
17
18
        $this->eventInfo->getBinLogCurrent()->setGtid($gtid);
19
20
        return new GTIDLogDTO(
21
            $this->eventInfo,
22
            $commit_flag,
23
            $gtid
24
        );
25
    }
26
}