In addition to what jlh says,
even with SQLite3 which automatically starts transaction,
inTransaction() only works after beginTransaction().
<?php
try{
$pdo = new PDO('sqlite:test.sql3', null, null, [PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION]);
var_dump($pdo->inTransaction());echo "<br>"; $pdo->beginTransaction();
var_dump($pdo->inTransaction());echo "<br>"; $pdo->rollBack();
var_dump($pdo->inTransaction());echo "<br>"; }catch (PDOException $e){
echo 'PDOException: ' . $e->getMessage();
}catch (Exception | ErrorException $e){
var_dump($e);
}