Failed Conditions
Pull Request — 3.0.x (#3980)
by Guilherme
07:55
created

ConnectionException   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Test Coverage

Coverage 75%

Importance

Changes 0
Metric Value
wmc 4
eloc 5
dl 0
loc 32
ccs 6
cts 8
cp 0.75
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A mayNotAlterNestedTransactionWithSavepointsInTransaction() 0 3 1
A noActiveTransaction() 0 3 1
A commitFailedRollbackOnly() 0 3 1
A savepointsNotSupported() 0 3 1
1
<?php
2
3
namespace Doctrine\DBAL;
4
5
/**
6
 * @psalm-immutable
7
 */
8
class ConnectionException extends DBALException
9
{
10
    /**
11
     * @return ConnectionException
12
     */
13 44
    public static function commitFailedRollbackOnly()
14
    {
15 44
        return new self('Transaction commit failed because the transaction has been marked for rollback only.');
16
    }
17
18
    /**
19
     * @return ConnectionException
20
     */
21 88
    public static function noActiveTransaction()
22
    {
23 88
        return new self('There is no active transaction.');
24
    }
25
26
    /**
27
     * @return ConnectionException
28
     */
29
    public static function savepointsNotSupported()
30
    {
31
        return new self('Savepoints are not supported by this driver.');
32
    }
33
34
    /**
35
     * @return ConnectionException
36
     */
37 44
    public static function mayNotAlterNestedTransactionWithSavepointsInTransaction()
38
    {
39 44
        return new self('May not alter the nested transaction with savepoints behavior while a transaction is open.');
40
    }
41
}
42