Commit bf068443 authored by Ahmed Abdou's avatar Ahmed Abdou

disable two rules for phpcs

parent 26d35871
......@@ -36,28 +36,34 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
return new Exception\LockWaitTimeoutException($message, $exception);
case '1050':
return new Exception\TableExistsException($message, $exception);
case '1051':
case '1146':
return new Exception\TableNotFoundException($message, $exception);
case '1216':
case '1217':
case '1451':
case '1452':
case '1701':
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case '1062':
case '1557':
case '1569':
case '1586':
return new Exception\UniqueConstraintViolationException($message, $exception);
case '1054':
case '1166':
case '1611':
return new Exception\InvalidFieldNameException($message, $exception);
case '1052':
case '1060':
case '1110':
return new Exception\NonUniqueFieldNameException($message, $exception);
case '1064':
case '1149':
case '1287':
......@@ -71,6 +77,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case '1554':
case '1626':
return new Exception\SyntaxErrorException($message, $exception);
case '1044':
case '1045':
case '1046':
......@@ -84,6 +91,7 @@ abstract class AbstractMySQLDriver implements Driver, ExceptionConverterDriver,
case '2002':
case '2005':
return new Exception\ConnectionException($message, $exception);
case '1048':
case '1121':
case '1138':
......
......@@ -24,22 +24,30 @@ abstract class AbstractOracleDriver implements Driver, ExceptionConverterDriver
case '2299':
case '38911':
return new Exception\UniqueConstraintViolationException($message, $exception);
case '904':
return new Exception\InvalidFieldNameException($message, $exception);
case '918':
case '960':
return new Exception\NonUniqueFieldNameException($message, $exception);
case '923':
return new Exception\SyntaxErrorException($message, $exception);
case '942':
return new Exception\TableNotFoundException($message, $exception);
case '955':
return new Exception\TableExistsException($message, $exception);
case '1017':
case '12545':
return new Exception\ConnectionException($message, $exception);
case '1400':
return new Exception\NotNullConstraintViolationException($message, $exception);
case '2266':
case '2291':
case '2292':
......
......@@ -43,20 +43,28 @@ abstract class AbstractPostgreSQLDriver implements Driver, ExceptionConverterDri
break;
case '23502':
return new Exception\NotNullConstraintViolationException($message, $exception);
case '23503':
return new Exception\ForeignKeyConstraintViolationException($message, $exception);
case '23505':
return new Exception\UniqueConstraintViolationException($message, $exception);
case '42601':
return new Exception\SyntaxErrorException($message, $exception);
case '42702':
return new Exception\NonUniqueFieldNameException($message, $exception);
case '42703':
return new Exception\InvalidFieldNameException($message, $exception);
case '42P01':
return new Exception\TableNotFoundException($message, $exception);
case '42P07':
return new Exception\TableExistsException($message, $exception);
case '7':
// In some case (mainly connection errors) the PDO exception does not provide a SQLSTATE via its code.
// The exception code is always set to 7 here.
......
......@@ -261,10 +261,13 @@ class DB2Statement implements IteratorAggregate, Statement
switch ($fetchMode) {
case FetchMode::COLUMN:
return $this->fetchColumn();
case FetchMode::MIXED:
return db2_fetch_both($this->stmt);
case FetchMode::ASSOCIATIVE:
return db2_fetch_assoc($this->stmt);
case FetchMode::CUSTOM_OBJECT:
$className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs;
......@@ -282,10 +285,13 @@ class DB2Statement implements IteratorAggregate, Statement
}
return $result;
case FetchMode::NUMERIC:
return db2_fetch_array($this->stmt);
case FetchMode::STANDARD_OBJECT:
return db2_fetch_object($this->stmt);
default:
throw new DB2Exception('Given Fetch-Style ' . $fetchMode . ' is not supported.');
}
......
......@@ -57,7 +57,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$socket = $params['unix_socket'] ?? ini_get('mysqli.default_socket');
$dbname = $params['dbname'] ?? null;
$flags = $driverOptions[self::OPTION_FLAGS] ?? null;
$flags = $driverOptions[static::OPTION_FLAGS] ?? null;
$this->conn = mysqli_init();
......@@ -239,7 +239,7 @@ class MysqliConnection implements Connection, PingableConnection, ServerInfoAwar
$exceptionMsg = "%s option '%s' with value '%s'";
foreach ($driverOptions as $option => $value) {
if ($option === self::OPTION_FLAGS) {
if ($option === static::OPTION_FLAGS) {
continue;
}
......
......@@ -338,10 +338,13 @@ class MysqliStatement implements IteratorAggregate, Statement
switch ($fetchMode) {
case FetchMode::ASSOCIATIVE:
return $assoc;
case FetchMode::MIXED:
return $assoc + $values;
case FetchMode::STANDARD_OBJECT:
return (object) $assoc;
default:
throw new MysqliException(sprintf("Unknown fetch type '%s'", $fetchMode));
}
......
......@@ -306,8 +306,10 @@ class OCI8Statement implements IteratorAggregate, Statement
switch ($type) {
case ParameterType::BINARY:
return OCI_B_BIN;
case ParameterType::LARGE_OBJECT:
return OCI_B_BLOB;
default:
return SQLT_CHR;
}
......
......@@ -210,10 +210,13 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
switch ($fetchMode) {
case FetchMode::COLUMN:
return $this->fetchColumn();
case FetchMode::ASSOCIATIVE:
return sasql_fetch_assoc($this->result);
case FetchMode::MIXED:
return sasql_fetch_array($this->result, SASQL_BOTH);
case FetchMode::CUSTOM_OBJECT:
$className = $this->defaultFetchClass;
$ctorArgs = $this->defaultFetchClassCtorArgs;
......@@ -231,10 +234,13 @@ class SQLAnywhereStatement implements IteratorAggregate, Statement
}
return $result;
case FetchMode::NUMERIC:
return sasql_fetch_row($this->result);
case FetchMode::STANDARD_OBJECT:
return sasql_fetch_object($this->result);
default:
throw new SQLAnywhereException('Fetch mode is not supported: ' . $fetchMode);
}
......
......@@ -247,15 +247,15 @@ class MySqlPlatform extends AbstractPlatform
if (! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length'];
if ($length <= self::LENGTH_LIMIT_TINYTEXT) {
if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
return 'TINYTEXT';
}
if ($length <= self::LENGTH_LIMIT_TEXT) {
if ($length <= static::LENGTH_LIMIT_TEXT) {
return 'TEXT';
}
if ($length <= self::LENGTH_LIMIT_MEDIUMTEXT) {
if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) {
return 'MEDIUMTEXT';
}
}
......@@ -1137,15 +1137,15 @@ SQL
if (! empty($field['length']) && is_numeric($field['length'])) {
$length = $field['length'];
if ($length <= self::LENGTH_LIMIT_TINYBLOB) {
if ($length <= static::LENGTH_LIMIT_TINYBLOB) {
return 'TINYBLOB';
}
if ($length <= self::LENGTH_LIMIT_BLOB) {
if ($length <= static::LENGTH_LIMIT_BLOB) {
return 'BLOB';
}
if ($length <= self::LENGTH_LIMIT_MEDIUMBLOB) {
if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) {
return 'MEDIUMBLOB';
}
}
......
......@@ -114,6 +114,7 @@ class OraclePlatform extends AbstractPlatform
}
return 'ADD_MONTHS(' . $date . ', ' . $operator . $interval . ')';
default:
$calculationClause = '';
......@@ -742,9 +743,11 @@ SQL
// NO ACTION cannot be declared explicitly,
// therefore returning empty string to indicate to OMIT the referential clause.
return '';
case 'CASCADE':
case 'SET NULL':
return $action;
default:
// SET DEFAULT is not supported, throw exception instead.
throw new InvalidArgumentException('Invalid foreign key action: ' . $action);
......
......@@ -49,10 +49,13 @@ class SQLAnywherePlatform extends AbstractPlatform
switch (true) {
case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (UPDLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (XLOCK)';
default:
return $fromClause;
}
......
......@@ -1548,10 +1548,13 @@ SQL
switch (true) {
case $lockMode === LockMode::NONE:
return $fromClause . ' WITH (NOLOCK)';
case $lockMode === LockMode::PESSIMISTIC_READ:
return $fromClause . ' WITH (HOLDLOCK, ROWLOCK)';
case $lockMode === LockMode::PESSIMISTIC_WRITE:
return $fromClause . ' WITH (UPDLOCK, ROWLOCK)';
default:
return $fromClause;
}
......
......@@ -128,6 +128,7 @@ class SqlitePlatform extends AbstractPlatform
case DateIntervalUnit::MINUTE:
case DateIntervalUnit::HOUR:
return 'DATETIME(' . $date . ",'" . $operator . $interval . ' ' . $unit . "')";
default:
switch ($unit) {
case DateIntervalUnit::WEEK:
......
......@@ -19,6 +19,8 @@
<exclude name="SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingReturnTypeHint"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousAbstractClassNaming"/>
<exclude name="SlevomatCodingStandard.Classes.SuperfluousExceptionNaming"/>
<exclude name="SlevomatCodingStandard.ControlStructures.ControlStructureSpacing.IncorrectLinesCountAfterLastControlStructure"/>
<exclude name="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants.DisallowedLateStaticBindingForConstant"/>
</rule>
<rule ref="PSR1.Classes.ClassDeclaration.MultipleClasses">
......
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