src/Connection.php
public function insertGetId(string $query, array $values = [], string $sequence = null)
    {
        try {
            $this->executeStatement($query, $values);
            $id = $this->pdo->lastInsertId($sequence);
            return is_numeric($id) ? (int)$id : $id;
        } catch (\Throwable $exception) {
            throw static::wrapException($exception, $query, $values);
        }
    }
public function insertGetId(string $query, array $values = [], string $sequence = null)
    {
        try {
            $this->executeStatement($query, $values);
            $id = $this->pdo->lastInsertId($sequence);
            return is_numeric($id) ? (int)$id : $id;
        } catch (\Throwable $exception) {
            throw static::wrapException($exception, $query, $values);
        }
    }
public function insertGetId ( string $ query , array $ values = [ ] , string $ sequence = null ) { try { $ this -> executeStatement ( $ query , $ values ) ; $ id = $ this -> pdo -> lastInsertId ( $ sequence ) ; return is_numeric ( $ id ) ? ( int ) $ id : $ id ; } catch ( \ Throwable $ exception ) { throw static :: wrapException ( $ exception , $ query , $ values ) ; } }
Performs an insert query and returns the identifier of the last inserted row.

@param string $query Full SQL query
@param array $values Values to bind. The indexes are the names or numbers of the values.
@param string|null $sequence Name of the sequence object from which the ID should be returned
@return int|string
@throws InvalidArgumentException
@throws PDOException
Performs an insert query and returns the identifier of the last inserted row .