Unverified Commit d4c78642 authored by Grégoire Paris's avatar Grégoire Paris

Merge branch '3.0.x'

parents 18908c39 80306bce
name: "Continuous Integration"
on:
pull_request:
jobs:
static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: "Install PHP"
uses: "shivammathur/setup-php@1.8.1"
with:
coverage: "none"
php-version: "7.4"
- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1.0.3"
with:
path: "~/.composer/cache"
key: "composer-${{ hashFiles('composer.json') }}"
restore-keys: "composer-"
- name: "Install dependencies with composer"
run: "composer update --no-interaction --no-progress --no-suggest"
- name: Psalm
run: "vendor/bin/psalm"
......@@ -40,11 +40,13 @@
"require-dev": {
"doctrine/coding-standard": "^7.0",
"jetbrains/phpstorm-stubs": "^2019.1",
"nikic/php-parser": "^4.4",
"phpstan/phpstan": "^0.12.18",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12.2",
"phpunit/phpunit": "^9.1.1",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0"
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "^3.11"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
......
This diff is collapsed.
<?xml version="1.0"?>
<psalm
totallyTyped="false"
errorLevel="8"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<directory name="tests" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
<stubs>
<file name="vendor/jetbrains/phpstorm-stubs/PDO/PDO.php" />
<file name="vendor/jetbrains/phpstorm-stubs/ibm_db2/ibm_db2.php" />
<file name="vendor/jetbrains/phpstorm-stubs/mysqli/mysqli.php" />
<file name="vendor/jetbrains/phpstorm-stubs/oci8/oci8.php" />
<file name="vendor/jetbrains/phpstorm-stubs/pgsql/pgsql.php" />
<file name="vendor/jetbrains/phpstorm-stubs/sqlsrv/sqlsrv.php" />
</stubs>
<issueHandlers>
<ImpureMethodCall>
<errorLevel type="suppress">
<!--
Requires a release of
https://github.com/vimeo/psalm/pull/3171
-->
<file name="src/Exception/DriverException.php"/>
</errorLevel>
</ImpureMethodCall>
<TooFewArguments>
<errorLevel type="suppress">
<!--
Requires a release of
https://github.com/JetBrains/phpstorm-stubs/pull/727
-->
<file name="src/Driver/SQLSrv/SQLSrvStatement.php"/>
</errorLevel>
</TooFewArguments>
<UndefinedConstant>
<errorLevel type="suppress">
<directory name="src/Driver/SQLAnywhere"/>
<!--
Requires a release of
https://github.com/JetBrains/phpstorm-stubs/pull/732
-->
<file name="tests/Driver/PDOPgSql/DriverTest.php" />
</errorLevel>
</UndefinedConstant>
<UndefinedFunction>
<errorLevel type="suppress">
<directory name="src/Driver/SQLAnywhere"/>
</errorLevel>
</UndefinedFunction>
<UndefinedClass>
<errorLevel type="suppress">
<!-- Contains references to optional dependencies -->
<file name="src/Tools/Dumper.php"/>
</errorLevel>
</UndefinedClass>
</issueHandlers>
</psalm>
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Cache;
use Doctrine\DBAL\DBALException;
/**
* @psalm-immutable
*/
class CacheException extends DBALException
{
}
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Cache\Exception;
use Doctrine\DBAL\Cache\CacheException;
/**
* @psalm-immutable
*/
final class NoCacheKey extends CacheException
{
public static function new() : self
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Cache\Exception;
use Doctrine\DBAL\Cache\CacheException;
/**
* @psalm-immutable
*/
final class NoResultDriverConfigured extends CacheException
{
public static function new() : self
......
......@@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Doctrine\DBAL;
/**
* @psalm-immutable
*/
class ConnectionException extends DBALException
{
}
......@@ -18,6 +18,9 @@ use function json_encode;
use function preg_replace;
use function sprintf;
/**
* @psalm-immutable
*/
class DBALException extends Exception
{
/**
......
......@@ -9,6 +9,8 @@ use Throwable;
/**
* Abstract base implementation of the {@link DriverException} interface.
*
* @psalm-immutable
*/
abstract class AbstractDriverException extends Exception implements DriverException
{
......
......@@ -11,6 +11,8 @@ use Throwable;
*
* Driver exceptions provide the SQLSTATE of the driver
* and the driver specific error code at the time the error occurred.
*
* @psalm-immutable
*/
interface DriverException extends Throwable
{
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownFetchMode extends DBALException
{
public static function new(int $fetchMode) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownParamType extends DBALException
{
public static function new(int $type) : self
......
......@@ -10,6 +10,9 @@ use function db2_conn_errormsg;
use function db2_stmt_error;
use function db2_stmt_errormsg;
/**
* @psalm-immutable
*/
class DB2Exception extends AbstractDriverException
{
/**
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception;
use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use mysqli;
/**
* @psalm-immutable
*/
final class ConnectionError extends MysqliException
{
public static function new(mysqli $connection) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception;
use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use function sprintf;
/**
* @psalm-immutable
*/
final class FailedReadingStreamOffset extends MysqliException
{
public static function new(int $offset) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception;
use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use mysqli_stmt;
/**
* @psalm-immutable
*/
final class StatementError extends MysqliException
{
public static function new(mysqli_stmt $statement) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception;
use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownFetchMode extends MysqliException
{
public static function new(int $fetchMode) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Driver\Mysqli\Exception;
use Doctrine\DBAL\Driver\Mysqli\MysqliException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownType extends MysqliException
{
/**
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Driver\Mysqli;
/**
* @internal
*
* @psalm-immutable
*/
final class HostRequired extends MysqliException
{
......
......@@ -8,6 +8,8 @@ use Doctrine\DBAL\Driver\AbstractDriverException;
/**
* Exception thrown in case the mysqli driver errors.
*
* @psalm-immutable
*/
class MysqliException extends AbstractDriverException
{
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Driver\OCI8;
use function sprintf;
/**
* @psalm-immutable
*/
final class NonTerminatedStringLiteral extends OCI8Exception
{
public static function new(int $offset) : self
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Driver\OCI8;
use Doctrine\DBAL\Driver\AbstractDriverException;
/**
* @psalm-immutable
*/
class OCI8Exception extends AbstractDriverException
{
/**
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Driver;
/**
* Tiny wrapper for PDOException instances to implement the {@link DriverException} interface.
*
* @psalm-immutable
*/
class PDOException extends AbstractDriverException
{
......
......@@ -13,6 +13,8 @@ use function sasql_stmt_error;
/**
* SAP Sybase SQL Anywhere driver exception.
*
* @psalm-immutable
*/
class SQLAnywhereException extends AbstractDriverException
{
......
......@@ -9,6 +9,9 @@ use function rtrim;
use function sqlsrv_errors;
use const SQLSRV_ERR_ERRORS;
/**
* @psalm-immutable
*/
class SQLSrvException extends AbstractDriverException
{
/**
......
......@@ -8,6 +8,9 @@ use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Platforms\AbstractPlatform;
use function sprintf;
/**
* @psalm-immutable
*/
final class ColumnLengthRequired extends DBALException
{
/**
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\ConnectionException;
/**
* @psalm-immutable
*/
final class CommitFailedRollbackOnly extends ConnectionException
{
public static function new() : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Base class for all connection related errors detected in the driver.
*
* @psalm-immutable
*/
class ConnectionException extends DriverException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Base class for all constraint violation related errors detected in the driver.
*
* @psalm-immutable
*/
class ConstraintViolationException extends ServerException
{
......
......@@ -10,6 +10,8 @@ namespace Doctrine\DBAL\Exception;
* 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
{
......
......@@ -10,6 +10,8 @@ namespace Doctrine\DBAL\Exception;
* 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
{
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
class DatabaseRequired extends DBALException
{
public static function new(string $methodName) : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a deadlock error of a transaction detected in the driver.
*
* @psalm-immutable
*/
class DeadlockException extends ServerException implements RetryableException
{
......
......@@ -10,6 +10,8 @@ use function assert;
/**
* Base class for all errors detected in the driver.
*
* @psalm-immutable
*/
class DriverException extends DBALException implements DriverExceptionInterface
{
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class DriverRequired extends DBALException
{
/**
......
......@@ -4,6 +4,9 @@ declare(strict_types=1);
namespace Doctrine\DBAL\Exception;
/**
* @psalm-immutable
*/
final class EmptyCriteriaNotAllowed extends InvalidArgumentException
{
public static function new() : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a foreign key constraint violation detected in the driver.
*
* @psalm-immutable
*/
class ForeignKeyConstraintViolationException extends ConstraintViolationException
{
......
......@@ -8,6 +8,8 @@ use Doctrine\DBAL\DBALException;
/**
* Exception to be thrown when invalid arguments are passed to any DBAL API
*
* @psalm-immutable
*/
class InvalidArgumentException extends DBALException
{
......
......@@ -8,6 +8,9 @@ use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver;
use function sprintf;
/**
* @psalm-immutable
*/
final class InvalidDriverClass extends DBALException
{
public static function new(string $driverClass) : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for an invalid specified field name in a statement detected in the driver.
*
* @psalm-immutable
*/
class InvalidFieldNameException extends ServerException
{
......
......@@ -10,6 +10,9 @@ use function get_class;
use function is_object;
use function sprintf;
/**
* @psalm-immutable
*/
final class InvalidPlatformType extends DBALException
{
/**
......
......@@ -8,6 +8,9 @@ use Doctrine\DBAL\Connection;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class InvalidWrapperClass extends DBALException
{
public static function new(string $wrapperClass) : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a lock wait timeout error of a transaction detected in the driver.
*
* @psalm-immutable
*/
class LockWaitTimeoutException extends ServerException implements RetryableException
{
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\ConnectionException;
/**
* @psalm-immutable
*/
final class MayNotAlterNestedTransactionWithSavepointsInTransaction extends ConnectionException
{
public static function new() : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\SQLParserUtilsException;
use function sprintf;
/**
* @psalm-immutable
*/
final class MissingArrayParameter extends SQLParserUtilsException
{
public static function new(string $paramName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\SQLParserUtilsException;
use function sprintf;
/**
* @psalm-immutable
*/
final class MissingArrayParameterType extends SQLParserUtilsException
{
public static function new(string $paramName) : self
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\ConnectionException;
/**
* @psalm-immutable
*/
final class NoActiveTransaction extends ConnectionException
{
public static function new() : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a non-unique/ambiguous specified field name in a statement detected in the driver.
*
* @psalm-immutable
*/
class NonUniqueFieldNameException extends ServerException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a NOT NULL constraint violation detected in the driver.
*
* @psalm-immutable
*/
class NotNullConstraintViolationException extends ConstraintViolationException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a write operation attempt on a read-only database element detected in the driver.
*
* @psalm-immutable
*/
class ReadOnlyException extends ServerException
{
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Exception;
use Doctrine\DBAL\ConnectionException;
/**
* @psalm-immutable
*/
final class SavepointsNotSupported extends ConnectionException
{
public static function new() : self
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Base class for all server related errors detected in the driver.
*
* @psalm-immutable
*/
class ServerException extends DriverException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a syntax error in a statement detected in the driver.
*
* @psalm-immutable
*/
class SyntaxErrorException extends ServerException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for an already existing table referenced in a statement detected in the driver.
*
* @psalm-immutable
*/
class TableExistsException extends DatabaseObjectExistsException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for an unknown table referenced in a statement detected in the driver.
*
* @psalm-immutable
*/
class TableNotFoundException extends DatabaseObjectNotFoundException
{
......
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL\Exception;
/**
* Exception for a unique constraint violation detected in the driver.
*
* @psalm-immutable
*/
class UniqueConstraintViolationException extends ConstraintViolationException
{
......
......@@ -8,6 +8,9 @@ use Doctrine\DBAL\DBALException;
use function implode;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownDriver extends DBALException
{
/**
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Platforms\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class InvalidPlatformVersion extends DBALException implements PlatformException
{
/**
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Platforms\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class NoColumnsSpecifiedForTable extends DBALException implements PlatformException
{
public static function new(string $tableName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Platforms\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class NotSupported extends DBALException implements PlatformException
{
public static function new(string $method) : self
......
......@@ -697,6 +697,8 @@ class SqlitePlatform extends AbstractPlatform
/**
* {@inheritDoc}
*
* @param int|null $createFlags
*/
public function getCreateTableSQL(Table $table, int $createFlags = self::CREATE_INDEXES | self::CREATE_FOREIGNKEYS) : array
{
......
......@@ -8,6 +8,9 @@ use Doctrine\DBAL\Query\QueryException;
use function implode;
use function sprintf;
/**
* @psalm-immutable
*/
final class NonUniqueAlias extends QueryException
{
/**
......
......@@ -8,6 +8,9 @@ use Doctrine\DBAL\Query\QueryException;
use function implode;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownAlias extends QueryException
{
/**
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Query;
use Doctrine\DBAL\DBALException;
/**
* @psalm-immutable
*/
class QueryException extends DBALException
{
}
......@@ -6,6 +6,8 @@ namespace Doctrine\DBAL;
/**
* Doctrine\DBAL\ConnectionException
*
* @psalm-immutable
*/
class SQLParserUtilsException extends DBALException
{
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class ColumnAlreadyExists extends SchemaException
{
public static function new(string $tableName, string $columnName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class ColumnDoesNotExist extends SchemaException
{
public static function new(string $columnName, string $table) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class ForeignKeyDoesNotExist extends SchemaException
{
public static function new(string $foreignKeyName, string $table) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class IndexAlreadyExists extends SchemaException
{
public static function new(string $indexName, string $table) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class IndexDoesNotExist extends SchemaException
{
public static function new(string $indexName, string $table) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class IndexNameInvalid extends SchemaException
{
public static function new(string $indexName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class InvalidTableName extends SchemaException
{
public static function new(string $tableName) : self
......
......@@ -10,6 +10,9 @@ use Doctrine\DBAL\Schema\Table;
use function implode;
use function sprintf;
/**
* @psalm-immutable
*/
final class NamedForeignKeyRequired extends SchemaException
{
public static function new(Table $localTable, ForeignKeyConstraint $foreignKey) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class NamespaceAlreadyExists extends SchemaException
{
public static function new(string $namespaceName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class SequenceAlreadyExists extends SchemaException
{
public static function new(string $sequenceName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class SequenceDoesNotExist extends SchemaException
{
public static function new(string $sequenceName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class TableAlreadyExists extends SchemaException
{
public static function new(string $tableName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class TableDoesNotExist extends SchemaException
{
public static function new(string $tableName) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UniqueConstraintDoesNotExist extends SchemaException
{
public static function new(string $constraintName, string $table) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Schema\Exception;
use Doctrine\DBAL\Schema\SchemaException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownColumnOption extends SchemaException
{
public static function new(string $name) : self
......
......@@ -6,6 +6,9 @@ namespace Doctrine\DBAL\Schema;
use Doctrine\DBAL\DBALException;
/**
* @psalm-immutable
*/
class SchemaException extends DBALException
{
public const TABLE_DOESNT_EXIST = 10;
......
......@@ -8,6 +8,8 @@ use Doctrine\DBAL\DBALException;
/**
* Conversion Exception is thrown when the database to PHP conversion fails.
*
* @psalm-immutable
*/
class ConversionException extends DBALException
{
......
......@@ -13,6 +13,8 @@ use function substr;
/**
* Thrown when a Database to Doctrine Type Conversion fails and we can make a statement
* about the expected format.
*
* @psalm-immutable
*/
final class InvalidFormat extends ConversionException implements TypesException
{
......
......@@ -15,6 +15,8 @@ use function sprintf;
/**
* Thrown when the PHP value passed to the converter was not of the expected type.
*
* @psalm-immutable
*/
final class InvalidType extends ConversionException implements TypesException
{
......
......@@ -11,6 +11,9 @@ use function gettype;
use function is_object;
use function sprintf;
/**
* @psalm-immutable
*/
final class SerializationFailed extends ConversionException implements TypesException
{
/**
......
......@@ -10,6 +10,9 @@ use function get_class;
use function spl_object_hash;
use function sprintf;
/**
* @psalm-immutable
*/
final class TypeAlreadyRegistered extends DBALException implements TypesException
{
public static function new(Type $type) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Types\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class TypeNotFound extends DBALException implements TypesException
{
public static function new(string $name) : self
......
......@@ -10,6 +10,9 @@ use function get_class;
use function spl_object_hash;
use function sprintf;
/**
* @psalm-immutable
*/
final class TypeNotRegistered extends DBALException implements TypesException
{
public static function new(Type $type) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Types\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class TypesAlreadyExists extends DBALException implements TypesException
{
public static function new(string $name) : self
......
......@@ -7,6 +7,9 @@ namespace Doctrine\DBAL\Types\Exception;
use Doctrine\DBAL\DBALException;
use function sprintf;
/**
* @psalm-immutable
*/
final class UnknownColumnType extends DBALException implements TypesException
{
public static function new(string $name) : self
......
......@@ -13,6 +13,8 @@ use function substr;
/**
* Thrown when a Database to Doctrine Type Conversion fails.
*
* @psalm-immutable
*/
final class ValueNotConvertible extends ConversionException implements TypesException
{
......
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Tests\Functional;
use Doctrine\DBAL\Logging\SQLLogger;
use Doctrine\DBAL\Tests\FunctionalTestCase;
class LoggingTest extends FunctionalTestCase
{
public function testLogExecuteQuery() : void
{
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->createMock(SQLLogger::class);
$logMock->expects(self::at(0))
->method('startQuery')
->with(self::equalTo($sql), self::equalTo([]), self::equalTo([]));
$logMock->expects(self::at(1))
->method('stopQuery');
$this->connection->getConfiguration()->setSQLLogger($logMock);
$this->connection->executeQuery($sql, []);
}
public function testLogPrepareExecute() : void
{
$sql = $this->connection->getDatabasePlatform()->getDummySelectSQL();
$logMock = $this->createMock(SQLLogger::class);
$logMock->expects(self::once())
->method('startQuery')
->with(self::equalTo($sql), self::equalTo([]));
$logMock->expects(self::at(1))
->method('stopQuery');
$this->connection->getConfiguration()->setSQLLogger($logMock);
$stmt = $this->connection->prepare($sql);
$stmt->execute();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment