Unverified Commit 8f3f4f23 authored by Sergei Morozov's avatar Sergei Morozov Committed by GitHub

Merge pull request #3849 from BenMorel/undefined-var

Clean up unused variables
parents 16d449c1 6d9e5a5a
...@@ -1093,8 +1093,6 @@ class Connection implements DriverConnection ...@@ -1093,8 +1093,6 @@ class Connection implements DriverConnection
throw CommitFailedRollbackOnly::new(); throw CommitFailedRollbackOnly::new();
} }
$result = true;
$connection = $this->getWrappedConnection(); $connection = $this->getWrappedConnection();
$logger = $this->_config->getSQLLogger(); $logger = $this->_config->getSQLLogger();
......
...@@ -99,7 +99,7 @@ class QueryCacheProfileTest extends DbalTestCase ...@@ -99,7 +99,7 @@ class QueryCacheProfileTest extends DbalTestCase
{ {
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null); $this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);
[$cacheKey, $queryString] = $this->queryCacheProfile->generateCacheKeys( [, $queryString] = $this->queryCacheProfile->generateCacheKeys(
$this->query, $this->query,
$this->params, $this->params,
$this->types, $this->types,
......
...@@ -31,10 +31,10 @@ class MysqliConnectionTest extends DbalFunctionalTestCase ...@@ -31,10 +31,10 @@ class MysqliConnectionTest extends DbalFunctionalTestCase
public function testRestoresErrorHandlerOnException() : void public function testRestoresErrorHandlerOnException() : void
{ {
$handler = static function () : bool { $handler = static function () : bool {
self::fail('Never expected this to be called'); self::fail('Never expected this to be called');
}; };
$default_handler = set_error_handler($handler); set_error_handler($handler);
try { try {
new MysqliConnection(['host' => '255.255.255.255'], 'user', 'pass'); new MysqliConnection(['host' => '255.255.255.255'], 'user', 'pass');
......
...@@ -213,10 +213,10 @@ class ResultCacheTest extends DbalFunctionalTestCase ...@@ -213,10 +213,10 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function testEmptyResultCache() : void public function testEmptyResultCache() : void
{ {
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey')); $stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt); $this->hydrateStmt($stmt);
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey')); $stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt); $this->hydrateStmt($stmt);
self::assertCount(1, $this->sqlLogger->queries, 'just one dbal hit'); self::assertCount(1, $this->sqlLogger->queries, 'just one dbal hit');
} }
...@@ -224,11 +224,11 @@ class ResultCacheTest extends DbalFunctionalTestCase ...@@ -224,11 +224,11 @@ class ResultCacheTest extends DbalFunctionalTestCase
public function testChangeCacheImpl() : void public function testChangeCacheImpl() : void
{ {
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey')); $stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
$data = $this->hydrateStmt($stmt); $this->hydrateStmt($stmt);
$secondCache = new ArrayCache(); $secondCache = new ArrayCache();
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey', $secondCache)); $stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey', $secondCache));
$data = $this->hydrateStmt($stmt); $this->hydrateStmt($stmt);
self::assertCount(2, $this->sqlLogger->queries, 'two hits'); self::assertCount(2, $this->sqlLogger->queries, 'two hits');
self::assertCount(1, $secondCache->fetch('emptycachekey')); self::assertCount(1, $secondCache->fetch('emptycachekey'));
......
...@@ -98,7 +98,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -98,7 +98,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testAlterTableAutoIncrementAdd() : void public function testAlterTableAutoIncrementAdd() : void
{ {
$tableFrom = new Table('autoinc_table_add'); $tableFrom = new Table('autoinc_table_add');
$column = $tableFrom->addColumn('id', 'integer'); $tableFrom->addColumn('id', 'integer');
$this->schemaManager->createTable($tableFrom); $this->schemaManager->createTable($tableFrom);
$tableFrom = $this->schemaManager->listTableDetails('autoinc_table_add'); $tableFrom = $this->schemaManager->listTableDetails('autoinc_table_add');
self::assertFalse($tableFrom->getColumn('id')->getAutoincrement()); self::assertFalse($tableFrom->getColumn('id')->getAutoincrement());
...@@ -137,7 +137,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -137,7 +137,7 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
self::assertTrue($tableFrom->getColumn('id')->getAutoincrement()); self::assertTrue($tableFrom->getColumn('id')->getAutoincrement());
$tableTo = new Table('autoinc_table_drop'); $tableTo = new Table('autoinc_table_drop');
$column = $tableTo->addColumn('id', 'integer'); $tableTo->addColumn('id', 'integer');
$c = new Comparator(); $c = new Comparator();
$diff = $c->diffTable($tableFrom, $tableTo); $diff = $c->diffTable($tableFrom, $tableTo);
...@@ -219,10 +219,10 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -219,10 +219,10 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function testFilterSchemaExpression() : void public function testFilterSchemaExpression() : void
{ {
$testTable = new Table('dbal204_test_prefix'); $testTable = new Table('dbal204_test_prefix');
$column = $testTable->addColumn('id', 'integer'); $testTable->addColumn('id', 'integer');
$this->schemaManager->createTable($testTable); $this->schemaManager->createTable($testTable);
$testTable = new Table('dbal204_without_prefix'); $testTable = new Table('dbal204_without_prefix');
$column = $testTable->addColumn('id', 'integer'); $testTable->addColumn('id', 'integer');
$this->schemaManager->createTable($testTable); $this->schemaManager->createTable($testTable);
$this->connection->getConfiguration()->setSchemaAssetsFilter(static function (string $name) : bool { $this->connection->getConfiguration()->setSchemaAssetsFilter(static function (string $name) : bool {
......
...@@ -165,7 +165,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase ...@@ -165,7 +165,7 @@ abstract class AbstractPlatformTestCase extends DbalTestCase
$table = new Table('test'); $table = new Table('test');
$this->expectException(DBALException::class); $this->expectException(DBALException::class);
$sql = $this->platform->getCreateTableSQL($table); $this->platform->getCreateTableSQL($table);
} }
public function testGeneratesTableCreationSql() : void public function testGeneratesTableCreationSql() : void
......
...@@ -863,8 +863,8 @@ class ComparatorTest extends TestCase ...@@ -863,8 +863,8 @@ class ComparatorTest extends TestCase
*/ */
public function testChangedSequence() : void public function testChangedSequence() : void
{ {
$schema = new Schema(); $schema = new Schema();
$sequence = $schema->createSequence('baz'); $schema->createSequence('baz');
$schemaNew = clone $schema; $schemaNew = clone $schema;
$schemaNew->getSequence('baz')->setAllocationSize(20); $schemaNew->getSequence('baz')->setAllocationSize(20);
......
...@@ -37,9 +37,7 @@ class MySqlInheritCharsetTest extends TestCase ...@@ -37,9 +37,7 @@ class MySqlInheritCharsetTest extends TestCase
public function testTableOptions() : void public function testTableOptions() : void
{ {
$eventManager = new EventManager(); $platform = new MySqlPlatform();
$driverMock = $this->createMock(Driver::class);
$platform = new MySqlPlatform();
// default, no overrides // default, no overrides
$table = new Table('foobar', [new Column('aa', Type::getType('integer'))]); $table = new Table('foobar', [new Column('aa', Type::getType('integer'))]);
......
...@@ -63,7 +63,7 @@ class SchemaTest extends TestCase ...@@ -63,7 +63,7 @@ class SchemaTest extends TestCase
$table = new Table($tableName); $table = new Table($tableName);
$tables = [$table, $table]; $tables = [$table, $table];
$schema = new Schema($tables); new Schema($tables);
} }
public function testRenameTable() : void public function testRenameTable() : void
...@@ -172,7 +172,7 @@ class SchemaTest extends TestCase ...@@ -172,7 +172,7 @@ class SchemaTest extends TestCase
$sequence = new Sequence('a_seq', 1, 1); $sequence = new Sequence('a_seq', 1, 1);
$schema = new Schema([], [$sequence, $sequence]); new Schema([], [$sequence, $sequence]);
} }
public function testConfigMaxIdentifierLength() : void public function testConfigMaxIdentifierLength() : void
......
...@@ -111,7 +111,7 @@ class TableTest extends DbalTestCase ...@@ -111,7 +111,7 @@ class TableTest extends DbalTestCase
$columns = []; $columns = [];
$columns[] = new Column('foo', $type); $columns[] = new Column('foo', $type);
$columns[] = new Column('foo', $type); $columns[] = new Column('foo', $type);
$table = new Table('foo', $columns, [], []); new Table('foo', $columns, [], []);
} }
public function testCreateIndex() : void public function testCreateIndex() : void
...@@ -184,7 +184,7 @@ class TableTest extends DbalTestCase ...@@ -184,7 +184,7 @@ class TableTest extends DbalTestCase
new Index('the_primary', ['foo'], true, true), new Index('the_primary', ['foo'], true, true),
new Index('other_primary', ['bar'], true, true), new Index('other_primary', ['bar'], true, true),
]; ];
$table = new Table('foo', $columns, $indexes, []); new Table('foo', $columns, $indexes, []);
} }
public function testAddTwoIndexesWithSameNameThrowsException() : void public function testAddTwoIndexesWithSameNameThrowsException() : void
...@@ -197,7 +197,7 @@ class TableTest extends DbalTestCase ...@@ -197,7 +197,7 @@ class TableTest extends DbalTestCase
new Index('an_idx', ['foo'], false, false), new Index('an_idx', ['foo'], false, false),
new Index('an_idx', ['bar'], false, false), new Index('an_idx', ['bar'], false, false),
]; ];
$table = new Table('foo', $columns, $indexes, []); new Table('foo', $columns, $indexes, []);
} }
public function testConstraints() : void public function testConstraints() : void
......
...@@ -14,8 +14,8 @@ class SerializationFailedTest extends TestCase ...@@ -14,8 +14,8 @@ class SerializationFailedTest extends TestCase
{ {
public function testNew() : void public function testNew() : void
{ {
$value = NAN; $value = NAN;
$encoded = json_encode($value); json_encode($value);
$exception = SerializationFailed::new($value, 'json', json_last_error_msg()); $exception = SerializationFailed::new($value, 'json', json_last_error_msg());
......
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