private static function checkAutocommit(\PDO $pdo): void
    {
        $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
        
        // MySQL turns autocommit off during a transaction.
        if ($vendor == "mysql") {
            return;
        }

        try {
            if ($pdo->getAttribute(\PDO::ATTR_AUTOCOMMIT)) {
                throw new \InvalidArgumentException("PDO::ATTR_AUTOCOMMIT should be disabled.");
            }
        } catch (\PDOException $e) {
            /*
             * Ignore this, as some drivers would throw an exception for an
             * unsupported attribute (e.g. Postgres).
             */
        }
    }
private static function checkAutocommit(\PDO $pdo): void
    {
        $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME);
        
        // MySQL turns autocommit off during a transaction.
        if ($vendor == "mysql") {
            return;
        }

        try {
            if ($pdo->getAttribute(\PDO::ATTR_AUTOCOMMIT)) {
                throw new \InvalidArgumentException("PDO::ATTR_AUTOCOMMIT should be disabled.");
            }
        } catch (\PDOException $e) {
            /*
             * Ignore this, as some drivers would throw an exception for an
             * unsupported attribute (e.g. Postgres).
             */
        }
    }
private static function checkAutocommit ( \ PDO $ pdo ) : void { $ vendor = $ pdo -> getAttribute ( \ PDO :: ATTR_DRIVER_NAME ) ; // MySQL turns autocommit off during a transaction. if ( $ vendor == "mysql" ) { return ; } try { if ( $ pdo -> getAttribute ( \ PDO :: ATTR_AUTOCOMMIT ) ) { throw new \ InvalidArgumentException ( "PDO::ATTR_AUTOCOMMIT should be disabled." ) ; } } catch ( \ PDOException $ e ) { /*
             * Ignore this, as some drivers would throw an exception for an
             * unsupported attribute (e.g. Postgres).
             */ } }
Checks that the AUTOCOMMIT mode is turned off.

@param \PDO $pdo PDO
Checks that the AUTOCOMMIT mode is turned off .