Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up redundant annotations and dead code in tests #3364

Merged
merged 5 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/Doctrine/DBAL/Platforms/AbstractPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -1550,8 +1550,6 @@ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDE
$columns = [];

foreach ($table->getColumns() as $column) {
/** @var Column $column */

if ($this->_eventManager !== null && $this->_eventManager->hasListeners(Events::onSchemaCreateTableColumn)) {
$eventArgs = new SchemaCreateTableColumnEventArgs($column, $table, $this);
$this->_eventManager->dispatchEvent(Events::onSchemaCreateTableColumn, $eventArgs);
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/DBAL/Platforms/DrizzlePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
use Doctrine\DBAL\Schema\Table;
Expand Down Expand Up @@ -508,7 +507,6 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}

/** @var ColumnDiff $columnDiff */
$column = $columnDiff->column;
$columnArray = $column->toArray();

Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Doctrine\DBAL\Platforms;

use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
Expand Down Expand Up @@ -580,7 +579,6 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}

/** @var ColumnDiff $columnDiff */
$column = $columnDiff->column;
$columnArray = $column->toArray();

Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/DBAL/Platforms/OraclePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Doctrine\DBAL\Platforms;

use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Schema\ColumnDiff;
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
use Doctrine\DBAL\Schema\Identifier;
use Doctrine\DBAL\Schema\Index;
Expand Down Expand Up @@ -799,7 +798,6 @@ public function getAlterTableSQL(TableDiff $diff)
continue;
}

/** @var ColumnDiff $columnDiff */
$column = $columnDiff->column;

// Do not generate column alteration clause if type is binary and only fixed property has changed.
Expand Down
3 changes: 0 additions & 3 deletions lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public function getAlterTableSQL(TableDiff $diff)
$tableSql = [];
$alterClauses = [];

/** @var Column $column */
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
Expand All @@ -137,7 +136,6 @@ public function getAlterTableSQL(TableDiff $diff)
);
}

/** @var Column $column */
foreach ($diff->removedColumns as $column) {
if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
continue;
Expand All @@ -146,7 +144,6 @@ public function getAlterTableSQL(TableDiff $diff)
$alterClauses[] = $this->getAlterTableRemoveColumnClause($column);
}

/** @var ColumnDiff $columnDiff */
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ public function getAlterTableSQL(TableDiff $diff)
$columnSql = [];
$commentsSql = [];

/** @var Column $column */
foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue;
Expand Down Expand Up @@ -494,7 +493,6 @@ public function getAlterTableSQL(TableDiff $diff)
$queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
}

/** @var ColumnDiff $columnDiff */
foreach ($diff->changedColumns as $columnDiff) {
if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public function getDropAllSchema()
$sm = $this->conn->getSchemaManager();
$visitor = new DropSchemaSqlCollector($this->platform);

/** @var Schema $schema */
$schema = $sm->createSchema();
$schema->visit($visitor);

Expand Down
1 change: 0 additions & 1 deletion lib/Doctrine/DBAL/Schema/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ private function getForeignKeyColumns()
{
$foreignKeyColumns = [];
foreach ($this->getForeignKeys() as $foreignKey) {
/** @var ForeignKeyConstraint $foreignKey */
$foreignKeyColumns = array_merge($foreignKeyColumns, $foreignKey->getColumns());
}
return $this->filterColumns($foreignKeyColumns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
use Doctrine\DBAL\Platforms\Keywords\SQLServer2008Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServer2012Keywords;
use Doctrine\DBAL\Platforms\Keywords\SQLServerKeywords;
use Doctrine\DBAL\Schema\Schema;
use InvalidArgumentException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -161,7 +160,6 @@ protected function execute(InputInterface $input, OutputInterface $output)

$output->write('Checking keyword violations for <comment>' . implode(', ', $keywordLists) . '</comment>...', true);

/** @var Schema $schema */
$schema = $conn->getSchemaManager()->createSchema();
$visitor = new ReservedKeywordsValidator($keywords);
$schema->visit($visitor);
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/DBAL/Functional/BlobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Doctrine\DBAL\Driver\OCI8\Driver as OCI8Driver;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DbalFunctionalTestCase;
Expand All @@ -22,7 +21,6 @@ protected function setUp()
{
parent::setUp();

/** @var AbstractSchemaManager $sm */
$table = new Table('blob_table');
$table->addColumn('id', 'integer');
$table->addColumn('clobfield', 'text');
Expand Down
3 changes: 0 additions & 3 deletions tests/Doctrine/Tests/DBAL/Functional/DataAccessTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Platforms\SqlitePlatform;
use Doctrine\DBAL\Platforms\TrimMode;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Statement;
use Doctrine\DBAL\Types\Type;
Expand Down Expand Up @@ -42,7 +41,6 @@ protected function setUp()
return;
}

/** @var AbstractSchemaManager $sm */
$table = new Table('fetch_table');
$table->addColumn('test_int', 'integer');
$table->addColumn('test_string', 'string');
Expand Down Expand Up @@ -601,7 +599,6 @@ public function testSqliteDateArithmeticWithDynamicInterval()
$table->addColumn('test_days', 'integer');
$table->setPrimaryKey(['test_date']);

/** @var AbstractSchemaManager $sm */
$sm = $this->connection->getSchemaManager();
$sm->createTable($table);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Doctrine\DBAL\Connections\MasterSlaveConnection;
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\DbalFunctionalTestCase;
use Throwable;
Expand Down Expand Up @@ -32,7 +31,6 @@ protected function setUp()
}

try {
/** @var AbstractSchemaManager $sm */
$table = new Table('master_slave_table');
$table->addColumn('test_int', 'integer');
$table->setPrimaryKey(['test_int']);
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/DBAL/Functional/ModifyLimitQueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Doctrine\Tests\DBAL\Functional;

use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\DbalFunctionalTestCase;
use const CASE_LOWER;
Expand All @@ -19,7 +18,6 @@ protected function setUp()
parent::setUp();

if (! self::$tableCreated) {
/** @var AbstractSchemaManager $sm */
$table = new Table('modify_limit_table');
$table->addColumn('test_int', 'integer');
$table->setPrimaryKey(['test_int']);
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/DBAL/Functional/PortabilityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Doctrine\DBAL\DriverManager;
use Doctrine\DBAL\FetchMode;
use Doctrine\DBAL\Portability\Connection as ConnectionPortability;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\Tests\DbalFunctionalTestCase;
use Throwable;
Expand Down Expand Up @@ -51,7 +50,6 @@ private function getPortableConnection(
$this->portableConnection = DriverManager::getConnection($params, $this->connection->getConfiguration(), $this->connection->getEventManager());

try {
/** @var AbstractSchemaManager $sm */
$table = new Table('portability_table');
$table->addColumn('Test_Int', 'integer');
$table->addColumn('Test_String', 'string', ['fixed' => true, 'length' => 32]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,6 @@ public function testJsonbColumn(string $type) : void
$table->addColumn('foo', $type)->setPlatformOption('jsonb', true);
$this->schemaManager->dropAndCreateTable($table);

/** @var Schema\Column[] $columns */
$columns = $this->schemaManager->listTableColumns('test_jsonb');

self::assertSame($type, $columns['foo']->getType()->getName());
Expand Down
4 changes: 0 additions & 4 deletions tests/Doctrine/Tests/DBAL/Functional/TypeConversionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Doctrine\Tests\DBAL\Functional;

use DateTime;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
use Doctrine\Tests\DbalFunctionalTestCase;
Expand All @@ -20,9 +19,6 @@ protected function setUp()
{
parent::setUp();

/** @var AbstractSchemaManager $sm */
$sm = $this->connection->getSchemaManager();

$table = new Table('type_conversion');
$table->addColumn('id', 'integer', ['notnull' => false]);
$table->addColumn('test_string', 'string', ['notnull' => false]);
Expand Down
2 changes: 0 additions & 2 deletions tests/Doctrine/Tests/DBAL/Functional/WriteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use DateTime;
use Doctrine\DBAL\ParameterType;
use Doctrine\DBAL\Schema\AbstractSchemaManager;
use Doctrine\DBAL\Schema\Sequence;
use Doctrine\DBAL\Schema\Table;
use Doctrine\DBAL\Types\Type;
Expand All @@ -20,7 +19,6 @@ protected function setUp()
parent::setUp();

try {
/** @var AbstractSchemaManager $sm */
$table = new Table('write_table');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('test_int', 'integer');
Expand Down
1 change: 0 additions & 1 deletion tests/Doctrine/Tests/DBAL/Schema/ComparatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,6 @@ public function testChangedSequence()
$sequence = $schema->createSequence('baz');

$schemaNew = clone $schema;
/** @var Schema $schemaNew */
$schemaNew->getSequence('baz')->setAllocationSize(20);

$c = new Comparator();
Expand Down