Skip to content

Commit

Permalink
Merge pull request #10 from ezsystems/symfony5
Browse files Browse the repository at this point in the history
EZP-31220: Migrated codebase to Symfony 5
  • Loading branch information
webhdx authored Mar 18, 2020
2 parents 3573a95 + 53ed96e commit cc4c58a
Show file tree
Hide file tree
Showing 19 changed files with 8 additions and 86 deletions.
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"license": "GPL-2.0-only",
"require": {
"php": "^7.3",
"doctrine/dbal": "^2.9",
"symfony/config": "^4.3",
"symfony/dependency-injection": "^4.3",
"symfony/http-kernel": "^4.3",
"symfony/yaml": "^4.3"
"doctrine/dbal": "^2.10",
"symfony/config": "^5.0",
"symfony/dependency-injection": "^5.0",
"symfony/http-kernel": "^5.0",
"symfony/yaml": "^5.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"phpunit/phpunit": "^7.5"
"friendsofphp/php-cs-fixer": "^2.16",
"phpunit/phpunit": "^8.5"
},
"autoload": {
"psr-4": {
Expand Down
5 changes: 0 additions & 5 deletions src/bundle/DependencyInjection/DoctrineSchemaExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ class DoctrineSchemaExtension extends Extension
{
/**
* Override default extension alias name to include eZ vendor in name.
*
* @return string
*/
public function getAlias(): string
{
Expand All @@ -29,9 +27,6 @@ public function getAlias(): string
/**
* Load Doctrine Schema Extension config.
*
* @param array $configs
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
*
* @throws \Exception
*/
public function load(array $configs, ContainerBuilder $container)
Expand Down
6 changes: 0 additions & 6 deletions src/lib/API/Builder/SchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,11 @@ interface SchemaBuilder
*
* @see \EzSystems\DoctrineSchema\API\Event\SchemaBuilderEvent
* @see \EzSystems\DoctrineSchema\API\Event\SchemaBuilderEvents::BUILD_SCHEMA
*
* @return \Doctrine\DBAL\Schema\Schema
*/
public function buildSchema(): Schema;

/**
* Import Schema from Yaml schema definition file into Schema object.
*
* @param string $schemaFilePath
*
* @return \Doctrine\DBAL\Schema\Schema
*/
public function importSchemaFromFile(string $schemaFilePath): Schema;
}
4 changes: 0 additions & 4 deletions src/lib/API/Event/SchemaBuilderEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ class SchemaBuilderEvent extends Event
*/
private $schema;

/**
* @param \EzSystems\DoctrineSchema\API\Builder\SchemaBuilder $schemaBuilder
* @param \Doctrine\DBAL\Schema\Schema $schema
*/
public function __construct(SchemaBuilder $schemaBuilder, Schema $schema)
{
$this->schemaBuilder = $schemaBuilder;
Expand Down
4 changes: 0 additions & 4 deletions src/lib/API/SchemaExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ interface SchemaExporter
{
/**
* Export \Doctrine\DBAL\Schema object to the custom Yaml format.
*
* @param \Doctrine\DBAL\Schema\Schema $schemaDefinition
*
* @return string
*/
public function export(Schema $schemaDefinition): string;
}
2 changes: 0 additions & 2 deletions src/lib/API/SchemaImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ interface SchemaImporter
/**
* Import database schema into \Doctrine\DBAL\Schema from file containing custom Yaml format.
*
* @param string $schemaFilePath
* @param \Doctrine\DBAL\Schema\Schema|null $targetSchema existing schema to import into, if not given, an empty one will be created
*
* @return \Doctrine\DBAL\Schema\Schema imported schema
Expand All @@ -33,7 +32,6 @@ public function importFromFile(string $schemaFilePath, ?Schema $targetSchema = n
/**
* Import database schema into \Doctrine\DBAL\Schema from string containing custom Yaml format.
*
* @param string $schemaDefinition
* @param \Doctrine\DBAL\Schema\Schema|null $targetSchema existing schema to import into, if not given, an empty one will be created
*
* @return \Doctrine\DBAL\Schema\Schema imported schema
Expand Down
5 changes: 0 additions & 5 deletions src/lib/Builder/SchemaBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@ class SchemaBuilder implements APISchemaBuilder
*/
private $defaultTableOptions;

/**
* @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher
* @param \EzSystems\DoctrineSchema\API\SchemaImporter $schemaImporter
* @param array $defaultTableOptions
*/
public function __construct(
EventDispatcherInterface $eventDispatcher,
SchemaImporter $schemaImporter,
Expand Down
4 changes: 0 additions & 4 deletions src/lib/Database/DbPlatform/DbPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,11 @@ interface DbPlatform
* (or its implementation).
*
* @see \Doctrine\DBAL\Platforms\AbstractPlatform
*
* @return string
*/
public function getDriverName(): string;

/**
* Add event subscribers predefined and required by an implementation.
*
* @param \Doctrine\Common\EventManager $eventManager
*/
public function addEventSubscribers(EventManager $eventManager): void;
}
2 changes: 0 additions & 2 deletions src/lib/Database/DbPlatform/PostgreSqlDbPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ public function getCreateSchemaSQL($schemaName)
*
* @param \Doctrine\DBAL\Schema\Table|string $table
*
* @return string
*
* @throws \InvalidArgumentException
*/
public function getDropTableSQL($table): string
Expand Down
2 changes: 0 additions & 2 deletions src/lib/Database/DbPlatform/SqliteDbPlatform.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ public function getDriverName(): string

/**
* Override default behavior of Sqlite db platform to force generating foreign keys.
*
* @return bool
*/
public function supportsForeignKeyConstraints(): bool
{
Expand Down
2 changes: 0 additions & 2 deletions src/lib/Exporter/SchemaExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public function __construct(SchemaTableExporter $tableYamlExporter)
/**
* Export \Doctrine\DBAL\Schema object to the custom Yaml format.
*
* @param \Doctrine\DBAL\Schema\Schema $schema
*
* @return string representation of database schema in Yaml format
*
* @throws \Doctrine\DBAL\DBALException
Expand Down
13 changes: 0 additions & 13 deletions src/lib/Exporter/Table/SchemaTableExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ class SchemaTableExporter
/**
* Export \Doctrine\DBAL\Schema\Table to array representation.
*
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return array
*
* @throws \Doctrine\DBAL\DBALException
*/
public function export(Table $table): array
Expand Down Expand Up @@ -57,9 +53,6 @@ private function filterOutIndexDefaultOptions(array $options): array
/**
* Export Schema Table indices.
*
* @param array $tableMetadata
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return array modified $tableMetadata
*/
private function exportIndices(array $tableMetadata, Table $table): array
Expand Down Expand Up @@ -95,9 +88,6 @@ private function exportIndices(array $tableMetadata, Table $table): array
/**
* Export Schema Table columns.
*
* @param array $tableMetadata
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return array modified $tableMetadata
*
* @throws \Doctrine\DBAL\DBALException
Expand Down Expand Up @@ -135,9 +125,6 @@ private function exportColumns(array $tableMetadata, Table $table): array
/**
* Export Schema Table columns.
*
* @param array $tableMetadata
* @param \Doctrine\DBAL\Schema\Table $table
*
* @return array modified $tableMetadata
*/
private function exportForeignKeys(array $tableMetadata, Table $table): array
Expand Down
8 changes: 0 additions & 8 deletions src/lib/Importer/SchemaImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,6 @@ public function importFromSource(string $schemaDefinition, ?Schema $targetSchema

/**
* Import schema described by array loaded from Yaml custom format to the currently configured database.
*
* @param array $schemaDefinition
* @param \Doctrine\DBAL\Schema\Schema|null $targetSchema
*
* @return \Doctrine\DBAL\Schema\Schema
*/
private function importFromArray(array $schemaDefinition, ?Schema $targetSchema = null): Schema
{
Expand All @@ -67,8 +62,6 @@ private function importFromArray(array $schemaDefinition, ?Schema $targetSchema
* Import table from the given configuration to the given schema.
*
* @param \Doctrine\DBAL\Schema\Schema target schema
* @param string $tableName
* @param array $tableConfiguration
*/
private function importSchemaTable(
Schema $schema,
Expand Down Expand Up @@ -124,7 +117,6 @@ private function importSchemaTable(
/**
* Adds columns to the given $table.
*
* @param \Doctrine\DBAL\Schema\Table $table
* @param array $columnList list of columns with their configuration
*/
private function addSchemaTableColumns(Table $table, array $columnList): void
Expand Down
2 changes: 0 additions & 2 deletions tests/lib/Database/Builder/MySqlTestDatabaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
class MySqlTestDatabaseBuilder implements TestDatabaseBuilder
{
/**
* @return \Doctrine\DBAL\Connection
*
* @throws \Doctrine\DBAL\DBALException
* @throws \EzSystems\Tests\DoctrineSchema\Database\TestDatabaseConfigurationException
*/
Expand Down
2 changes: 0 additions & 2 deletions tests/lib/Database/Builder/SqliteTestDatabaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
class SqliteTestDatabaseBuilder implements TestDatabaseBuilder
{
/**
* @return \Doctrine\DBAL\Connection
*
* @throws \Doctrine\DBAL\DBALException
*/
public function buildDatabase(): Connection
Expand Down
2 changes: 0 additions & 2 deletions tests/lib/Database/Builder/TestDatabaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
interface TestDatabaseBuilder
{
/**
* @return \Doctrine\DBAL\Connection
*
* @throws \Doctrine\DBAL\DBALException
* @throws \EzSystems\Tests\DoctrineSchema\Database\TestDatabaseConfigurationException
*/
Expand Down
4 changes: 0 additions & 4 deletions tests/lib/Database/TestDatabaseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ public function __construct()
}

/**
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $databasePlatform
*
* @return \Doctrine\DBAL\Connection
*
* @throws \EzSystems\Tests\DoctrineSchema\Database\TestDatabaseConfigurationException
* @throws \Doctrine\DBAL\DBALException
*/
Expand Down
12 changes: 1 addition & 11 deletions tests/lib/Exporter/SchemaExporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SchemaExporterTest extends TestCase
*/
private $testDatabaseFactory;

public function setUp()
public function setUp(): void
{
$this->exporter = new SchemaExporter(
new SchemaTableExporter()
Expand All @@ -42,8 +42,6 @@ public function setUp()
* Load expected input/output fixtures for SchemaExporter.
*
* @see testExport
*
* @return array
*/
public function providerForTestExport(): array
{
Expand Down Expand Up @@ -88,11 +86,7 @@ public function providerForTestExport(): array
/**
* @dataProvider providerForTestExport
*
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $databasePlatform
* @param string $inputSchemaSQL
* @param string $expectedSchemaDefinition
* @param string $inputFilePath
* @param string $outputFilePath
*
* @throws \Doctrine\DBAL\DBALException
*/
Expand Down Expand Up @@ -137,10 +131,6 @@ public function testExport(
}

/**
* @param \Doctrine\DBAL\Platforms\AbstractPlatform $databasePlatform
*
* @return \Doctrine\DBAL\Connection
*
* @throws \EzSystems\Tests\DoctrineSchema\Database\TestDatabaseConfigurationException
* @throws \Doctrine\DBAL\DBALException
*/
Expand Down
1 change: 0 additions & 1 deletion tests/lib/Importer/SchemaImporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ public function providerForTestImportFromFile(): array
* @dataProvider providerForTestImportFromFile
*
* @param string $yamlSchemaDefinitionFile custom Yaml schema definition fixture file name
* @param \Doctrine\DBAL\Schema\Schema $expectedSchema
*
* @throws \EzSystems\DoctrineSchema\API\Exception\InvalidConfigurationException
* @throws \Doctrine\DBAL\DBALException
Expand Down

0 comments on commit cc4c58a

Please sign in to comment.