Skip to content

Commit 8f3f4f2

Browse files
authored
Merge pull request #3849 from BenMorel/undefined-var
Clean up unused variables
2 parents 16d449c + 6d9e5a5 commit 8f3f4f2

File tree

11 files changed

+22
-26
lines changed

11 files changed

+22
-26
lines changed

lib/Doctrine/DBAL/Connection.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1093,8 +1093,6 @@ public function commit() : void
10931093
throw CommitFailedRollbackOnly::new();
10941094
}
10951095

1096-
$result = true;
1097-
10981096
$connection = $this->getWrappedConnection();
10991097

11001098
$logger = $this->_config->getSQLLogger();

tests/Doctrine/Tests/DBAL/Cache/QueryCacheProfileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public function testConnectionParamsShouldBeHashed() : void
9999
{
100100
$this->queryCacheProfile = $this->queryCacheProfile->setCacheKey(null);
101101

102-
[$cacheKey, $queryString] = $this->queryCacheProfile->generateCacheKeys(
102+
[, $queryString] = $this->queryCacheProfile->generateCacheKeys(
103103
$this->query,
104104
$this->params,
105105
$this->types,

tests/Doctrine/Tests/DBAL/Driver/Mysqli/MysqliConnectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ protected function setUp() : void
3131

3232
public function testRestoresErrorHandlerOnException() : void
3333
{
34-
$handler = static function () : bool {
34+
$handler = static function () : bool {
3535
self::fail('Never expected this to be called');
3636
};
37-
$default_handler = set_error_handler($handler);
37+
set_error_handler($handler);
3838

3939
try {
4040
new MysqliConnection(['host' => '255.255.255.255'], 'user', 'pass');

tests/Doctrine/Tests/DBAL/Functional/ResultCacheTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,22 +213,22 @@ private function assertCacheNonCacheSelectSameFetchModeAreEqual(array $expectedR
213213
public function testEmptyResultCache() : void
214214
{
215215
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
216-
$data = $this->hydrateStmt($stmt);
216+
$this->hydrateStmt($stmt);
217217

218218
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
219-
$data = $this->hydrateStmt($stmt);
219+
$this->hydrateStmt($stmt);
220220

221221
self::assertCount(1, $this->sqlLogger->queries, 'just one dbal hit');
222222
}
223223

224224
public function testChangeCacheImpl() : void
225225
{
226226
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey'));
227-
$data = $this->hydrateStmt($stmt);
227+
$this->hydrateStmt($stmt);
228228

229229
$secondCache = new ArrayCache();
230230
$stmt = $this->connection->executeQuery('SELECT * FROM caching WHERE test_int > 500', [], [], new QueryCacheProfile(10, 'emptycachekey', $secondCache));
231-
$data = $this->hydrateStmt($stmt);
231+
$this->hydrateStmt($stmt);
232232

233233
self::assertCount(2, $this->sqlLogger->queries, 'two hits');
234234
self::assertCount(1, $secondCache->fetch('emptycachekey'));

tests/Doctrine/Tests/DBAL/Functional/Schema/PostgreSqlSchemaManagerTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testDetectsAutoIncrement() : void
9898
public function testAlterTableAutoIncrementAdd() : void
9999
{
100100
$tableFrom = new Table('autoinc_table_add');
101-
$column = $tableFrom->addColumn('id', 'integer');
101+
$tableFrom->addColumn('id', 'integer');
102102
$this->schemaManager->createTable($tableFrom);
103103
$tableFrom = $this->schemaManager->listTableDetails('autoinc_table_add');
104104
self::assertFalse($tableFrom->getColumn('id')->getAutoincrement());
@@ -137,7 +137,7 @@ public function testAlterTableAutoIncrementDrop() : void
137137
self::assertTrue($tableFrom->getColumn('id')->getAutoincrement());
138138

139139
$tableTo = new Table('autoinc_table_drop');
140-
$column = $tableTo->addColumn('id', 'integer');
140+
$tableTo->addColumn('id', 'integer');
141141

142142
$c = new Comparator();
143143
$diff = $c->diffTable($tableFrom, $tableTo);
@@ -219,10 +219,10 @@ public function testReturnQuotedAssets() : void
219219
public function testFilterSchemaExpression() : void
220220
{
221221
$testTable = new Table('dbal204_test_prefix');
222-
$column = $testTable->addColumn('id', 'integer');
222+
$testTable->addColumn('id', 'integer');
223223
$this->schemaManager->createTable($testTable);
224224
$testTable = new Table('dbal204_without_prefix');
225-
$column = $testTable->addColumn('id', 'integer');
225+
$testTable->addColumn('id', 'integer');
226226
$this->schemaManager->createTable($testTable);
227227

228228
$this->connection->getConfiguration()->setSchemaAssetsFilter(static function (string $name) : bool {

tests/Doctrine/Tests/DBAL/Platforms/AbstractPlatformTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public function testCreateWithNoColumns() : void
165165
$table = new Table('test');
166166

167167
$this->expectException(DBALException::class);
168-
$sql = $this->platform->getCreateTableSQL($table);
168+
$this->platform->getCreateTableSQL($table);
169169
}
170170

171171
public function testGeneratesTableCreationSql() : void

tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,8 +863,8 @@ public function testDiff() : void
863863
*/
864864
public function testChangedSequence() : void
865865
{
866-
$schema = new Schema();
867-
$sequence = $schema->createSequence('baz');
866+
$schema = new Schema();
867+
$schema->createSequence('baz');
868868

869869
$schemaNew = clone $schema;
870870
$schemaNew->getSequence('baz')->setAllocationSize(20);

tests/Doctrine/Tests/DBAL/Schema/MySqlInheritCharsetTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,7 @@ public function testInheritTableOptionsFromDatabase() : void
3737

3838
public function testTableOptions() : void
3939
{
40-
$eventManager = new EventManager();
41-
$driverMock = $this->createMock(Driver::class);
42-
$platform = new MySqlPlatform();
40+
$platform = new MySqlPlatform();
4341

4442
// default, no overrides
4543
$table = new Table('foobar', [new Column('aa', Type::getType('integer'))]);

tests/Doctrine/Tests/DBAL/Schema/SchemaTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function testCreateTableTwiceThrowsException() : void
6363
$table = new Table($tableName);
6464
$tables = [$table, $table];
6565

66-
$schema = new Schema($tables);
66+
new Schema($tables);
6767
}
6868

6969
public function testRenameTable() : void
@@ -172,7 +172,7 @@ public function testAddSequenceTwiceThrowsException() : void
172172

173173
$sequence = new Sequence('a_seq', 1, 1);
174174

175-
$schema = new Schema([], [$sequence, $sequence]);
175+
new Schema([], [$sequence, $sequence]);
176176
}
177177

178178
public function testConfigMaxIdentifierLength() : void

tests/Doctrine/Tests/DBAL/Schema/TableTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function testAddColumnTwiceThrowsException() : void
111111
$columns = [];
112112
$columns[] = new Column('foo', $type);
113113
$columns[] = new Column('foo', $type);
114-
$table = new Table('foo', $columns, [], []);
114+
new Table('foo', $columns, [], []);
115115
}
116116

117117
public function testCreateIndex() : void
@@ -184,7 +184,7 @@ public function testAddTwoPrimaryThrowsException() : void
184184
new Index('the_primary', ['foo'], true, true),
185185
new Index('other_primary', ['bar'], true, true),
186186
];
187-
$table = new Table('foo', $columns, $indexes, []);
187+
new Table('foo', $columns, $indexes, []);
188188
}
189189

190190
public function testAddTwoIndexesWithSameNameThrowsException() : void
@@ -197,7 +197,7 @@ public function testAddTwoIndexesWithSameNameThrowsException() : void
197197
new Index('an_idx', ['foo'], false, false),
198198
new Index('an_idx', ['bar'], false, false),
199199
];
200-
$table = new Table('foo', $columns, $indexes, []);
200+
new Table('foo', $columns, $indexes, []);
201201
}
202202

203203
public function testConstraints() : void

tests/Doctrine/Tests/DBAL/Types/Exception/SerializationFailedTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class SerializationFailedTest extends TestCase
1414
{
1515
public function testNew() : void
1616
{
17-
$value = NAN;
18-
$encoded = json_encode($value);
17+
$value = NAN;
18+
json_encode($value);
1919

2020
$exception = SerializationFailed::new($value, 'json', json_last_error_msg());
2121

0 commit comments

Comments
 (0)