Skip to content

Commit

Permalink
Merge pull request #3964 from greg0ire/moar-immutable-exceptions
Browse files Browse the repository at this point in the history
Mark every exception as immutable
  • Loading branch information
morozov authored Apr 18, 2020
2 parents 0686b53 + fedac50 commit 50e2321
Show file tree
Hide file tree
Showing 27 changed files with 60 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Cache/CacheException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Doctrine\DBAL\DBALException;

/**
* @psalm-immutable
*/
class CacheException extends DBALException
{
/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/ConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

namespace Doctrine\DBAL;

/**
* @psalm-immutable
*/
class ConnectionException extends DBALException
{
/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/DBALException.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
use function spl_object_hash;
use function sprintf;

/**
* @psalm-immutable
*/
class DBALException extends Exception
{
/**
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Driver/IBMDB2/DB2Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

use Exception;

/**
* @psalm-immutable
*/
class DB2Exception extends Exception
{
}
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/ConnectionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Base class for all connection related errors detected in the driver.
*
* @psalm-immutable
*/
class ConnectionException extends DriverException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/ConstraintViolationException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Base class for all constraint violation related errors detected in the driver.
*
* @psalm-immutable
*/
class ConstraintViolationException extends ServerException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/DatabaseObjectExistsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* A database object is considered any asset that can be created in a database
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
* functions, stored procedures etc.
*
* @psalm-immutable
*/
class DatabaseObjectExistsException extends ServerException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
* A database object is considered any asset that can be created in a database
* such as schemas, tables, views, sequences, triggers, constraints, indexes,
* functions, stored procedures etc.
*
* @psalm-immutable
*/
class DatabaseObjectNotFoundException extends ServerException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/DeadlockException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a deadlock error of a transaction detected in the driver.
*
* @psalm-immutable
*/
class DeadlockException extends ServerException implements RetryableException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/DriverException.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

/**
* Base class for all errors detected in the driver.
*
* @psalm-immutable
*/
class DriverException extends DBALException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a foreign key constraint violation detected in the driver.
*
* @psalm-immutable
*/
class ForeignKeyConstraintViolationException extends ConstraintViolationException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/InvalidArgumentException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* Exception to be thrown when invalid arguments are passed to any DBAL API
*
* @psalm-immutable
*/
class InvalidArgumentException extends DBALException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/InvalidFieldNameException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for an invalid specified field name in a statement detected in the driver.
*
* @psalm-immutable
*/
class InvalidFieldNameException extends ServerException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/LockWaitTimeoutException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a lock wait timeout error of a transaction detected in the driver.
*
* @psalm-immutable
*/
class LockWaitTimeoutException extends ServerException implements RetryableException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/NonUniqueFieldNameException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a non-unique/ambiguous specified field name in a statement detected in the driver.
*
* @psalm-immutable
*/
class NonUniqueFieldNameException extends ServerException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a NOT NULL constraint violation detected in the driver.
*
* @psalm-immutable
*/
class NotNullConstraintViolationException extends ConstraintViolationException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/ReadOnlyException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a write operation attempt on a read-only database element detected in the driver.
*
* @psalm-immutable
*/
class ReadOnlyException extends ServerException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/ServerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Base class for all server related errors detected in the driver.
*
* @psalm-immutable
*/
class ServerException extends DriverException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/SyntaxErrorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a syntax error in a statement detected in the driver.
*
* @psalm-immutable
*/
class SyntaxErrorException extends ServerException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/TableExistsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for an already existing table referenced in a statement detected in the driver.
*
* @psalm-immutable
*/
class TableExistsException extends DatabaseObjectExistsException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Exception/TableNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for an unknown table referenced in a statement detected in the driver.
*
* @psalm-immutable
*/
class TableNotFoundException extends DatabaseObjectNotFoundException
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

/**
* Exception for a unique constraint violation detected in the driver.
*
* @psalm-immutable
*/
class UniqueConstraintViolationException extends ConstraintViolationException
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Query/QueryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
use Doctrine\DBAL\DBALException;
use function implode;

/**
* @psalm-immutable
*/
class QueryException extends DBALException
{
/**
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/SQLParserUtilsException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* Doctrine\DBAL\ConnectionException
*
* @psalm-immutable
*/
class SQLParserUtilsException extends DBALException
{
Expand Down
3 changes: 3 additions & 0 deletions lib/Doctrine/DBAL/Schema/SchemaException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
use function implode;
use function sprintf;

/**
* @psalm-immutable
*/
class SchemaException extends DBALException
{
public const TABLE_DOESNT_EXIST = 10;
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Sharding/ShardingException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/**
* Sharding related Exceptions
*
* @psalm-immutable
*/
class ShardingException extends DBALException
{
Expand Down
2 changes: 2 additions & 0 deletions lib/Doctrine/DBAL/Types/ConversionException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

/**
* Conversion Exception is thrown when the database to PHP conversion fails.
*
* @psalm-immutable
*/
class ConversionException extends DBALException
{
Expand Down

0 comments on commit 50e2321

Please sign in to comment.