@@ -58,9 +58,7 @@ private static function getConnection($connection = null)
5858 */
5959 public static function begin ($ connection = null ) : bool
6060 {
61- return self ::getConnection ($ connection )
62- ? self ::getConnection ($ connection )->beginTransaction ()
63- : false ;
61+ return self ::getConnection ($ connection ) && self ::getConnection ($ connection )->beginTransaction ();
6462 }
6563
6664 /**
@@ -72,36 +70,34 @@ public static function begin($connection = null) : bool
7270 */
7371 public static function commit ($ connection = null ) : bool
7472 {
75- return self ::getConnection ($ connection )
76- ? self ::getConnection ($ connection )->commit ()
77- : false ;
73+ return self ::getConnection ($ connection ) && self ::getConnection ($ connection )->commit ();
7874 }
7975
8076 /**
8177 * Rollback transaction on connection
8278 *
8379 * @param string|TransactionPDO $connection
8480 *
81+ * @throws \PDOException
8582 * @return bool
8683 */
8784 public static function rollback ($ connection = null ) : bool
8885 {
89- return self ::getConnection ($ connection )
90- ? self ::getConnection ($ connection )->rollBack ()
91- : false ;
86+ return self ::getConnection ($ connection ) && self ::getConnection ($ connection )->rollBack ();
9287 }
9388
9489 /**
9590 * Perform some callback while transaction execution
9691 *
97- * @param Closure $callback
98- * @param null $connection
92+ * @param Closure $callback
93+ * @param string|TransactionPDO $connection
9994 *
10095 * @throws LogicException
10196 * @throws TransactionException
10297 */
10398 public static function perform (Closure $ callback , $ connection = null )
10499 {
100+ /** @var TransactionPDO|bool $connection */
105101 $ connection = self ::getConnection ($ connection );
106102
107103 if ($ connection === false ) {
0 commit comments