Skip to content

Commit

Permalink
Merge pull request #1250 from greg0ire/drop-dbal2
Browse files Browse the repository at this point in the history
Drop support for DBAL 2, PHP 7.2, Symfony 3, Persistence 1
  • Loading branch information
greg0ire committed Apr 4, 2022
2 parents f9b4c80 + f5887f0 commit 5713b45
Show file tree
Hide file tree
Showing 130 changed files with 448 additions and 1,029 deletions.
3 changes: 1 addition & 2 deletions .appveyor.yml
Expand Up @@ -13,8 +13,7 @@ cache:

environment:
matrix:
- php: 7.2.25
- php: 7.3.12
- php: 7.4.28

init:
- SET PATH=C:\Program Files\OpenSSL;c:\tools\php;C:\tools\composer;%PATH%
Expand Down
14 changes: 1 addition & 13 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -25,22 +25,14 @@ jobs:

strategy:
matrix:
dbal-version:
- "^2.11"
- "^3.0"
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
dependencies:
- "highest"
include:
- deps: "lowest"
php-version: "7.2"
exclude:
- dbal-version: "^3.0"
php-version: "7.2"
php-version: "7.4"

steps:
- name: "Checkout"
Expand All @@ -59,10 +51,6 @@ jobs:
- name: "Download box"
run: "./download-box.sh"

- name: "Require the right DBAL version"
run: "composer require doctrine/dbal:${{ matrix.dbal-version }} --no-update"
if: "${{ matrix.dbal-version }}"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
Expand Down
18 changes: 2 additions & 16 deletions .github/workflows/static-analysis.yml
Expand Up @@ -16,16 +16,9 @@ jobs:

strategy:
matrix:
dbal-version:
- "^2.11"
- "^3.0"
php-version:
- "7.2"
- "7.4"
- "8.0"
exclude:
- dbal-version: "^3.0"
php-version: "7.2"

steps:
- name: "Checkout code"
Expand All @@ -38,17 +31,10 @@ jobs:
php-version: "${{ matrix.php-version }}"
extensions: "pdo_sqlite"

- name: "Require the right DBAL version"
run: "composer require doctrine/dbal:${{ matrix.dbal-version }} --no-update"

- name: "Install dependencies with Composer"
uses: "ramsey/composer-install@v1"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run a static analysis with phpstan/phpstan (dbal v2)"
run: "vendor/bin/phpstan analyse -c phpstan-dbal-2.neon.dist"
if: "contains(matrix.dbal-version, '^2.')"
- name: "Run a static analysis with phpstan/phpstan (dbal v3)"
run: "vendor/bin/phpstan analyse -c phpstan-dbal-3.neon.dist"
if: "contains(matrix.dbal-version, '^3.')"
- name: "Run a static analysis with phpstan/phpstan"
run: "vendor/bin/phpstan analyse -c phpstan.neon.dist"
18 changes: 9 additions & 9 deletions composer.json
Expand Up @@ -24,32 +24,32 @@
}
],
"require": {
"php": "^7.2 || ^8.0",
"php": "^7.4 || ^8.0",
"composer-runtime-api": "^2",
"doctrine/dbal": "^2.11 || ^3.0",
"doctrine/dbal": "^3.3",
"doctrine/deprecations": "^0.5.3",
"doctrine/event-manager": "^1.0",
"friendsofphp/proxy-manager-lts": "^1.0",
"psr/log": "^1.1.3 || ^2 || ^3",
"symfony/console": "^3.4 || ^4.4.16 || ^5.0 || ^6.0",
"symfony/stopwatch": "^3.4 || ^4.0 || ^5.0 || ^6.0"
"symfony/console": "^4.4.16 || ^5.4 || ^6.0",
"symfony/stopwatch": "^4.4 || ^5.4 || ^6.0"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"doctrine/coding-standard": "^9",
"doctrine/orm": "^2.6",
"doctrine/persistence": "^1.3 || ^2.0",
"doctrine/persistence": "^2.0",
"doctrine/sql-formatter": "^1.0",
"ergebnis/composer-normalize": "^2.9",
"phpstan/phpstan": "^1.5",
"phpstan/phpstan-deprecation-rules": "^1",
"phpstan/phpstan-phpunit": "^1.1",
"phpstan/phpstan-strict-rules": "^1.1",
"phpstan/phpstan-symfony": "^1.1",
"phpunit/phpunit": "^8.5 || ^9.4",
"symfony/cache": "^3.4.26 || ^4.2.12 || ^5.0 || ^6.0",
"symfony/process": "^3.4 || ^4.0 || ^5.0 || ^6.0",
"symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0"
"phpunit/phpunit": "^9.4",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/process": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^4.4 || ^5.4 || ^6.0"
},
"suggest": {
"doctrine/sql-formatter": "Allows to generate formatted SQL with the diff command.",
Expand Down
2 changes: 1 addition & 1 deletion download-box.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

if [ ! -f box.phar ]; then
wget https://github.com/box-project/box/releases/download/$(php -r 'echo PHP_VERSION_ID >= 70300 ? "3.11.0" : "3.9.1";')/box.phar -O box.phar
wget https://github.com/box-project/box/releases/download/3.11.0/box.phar -O box.phar
fi
10 changes: 3 additions & 7 deletions lib/Doctrine/Migrations/AbstractMigration.php
Expand Up @@ -16,7 +16,6 @@
use Doctrine\Migrations\Query\Query;
use Psr\Log\LoggerInterface;

use function method_exists;
use function sprintf;

/**
Expand All @@ -34,18 +33,15 @@ abstract class AbstractMigration
/** @var AbstractPlatform */
protected $platform;

/** @var LoggerInterface */
private $logger;
private LoggerInterface $logger;

/** @var Query[] */
private $plannedSql = [];
private array $plannedSql = [];

public function __construct(Connection $connection, LoggerInterface $logger)
{
$this->connection = $connection;
$this->sm = method_exists($this->connection, 'createSchemaManager')
? $this->connection->createSchemaManager()
: $this->connection->getSchemaManager();
$this->sm = $this->connection->createSchemaManager();
$this->platform = $this->connection->getDatabasePlatform();
$this->logger = $logger;
}
Expand Down
37 changes: 13 additions & 24 deletions lib/Doctrine/Migrations/Configuration/Configuration.php
Expand Up @@ -21,43 +21,32 @@ final class Configuration
public const VERSIONS_ORGANIZATION_BY_YEAR_AND_MONTH = 'year_and_month';

/** @var array<string, string> */
private $migrationsDirectories = [];
private array $migrationsDirectories = [];

/** @var string[] */
private $migrationClasses = [];
private array $migrationClasses = [];

/** @var bool */
private $migrationsAreOrganizedByYear = false;
private bool $migrationsAreOrganizedByYear = false;

/** @var bool */
private $migrationsAreOrganizedByYearAndMonth = false;
private bool $migrationsAreOrganizedByYearAndMonth = false;

/** @var string|null */
private $customTemplate;
private ?string $customTemplate = null;

/** @var bool */
private $isDryRun = false;
private bool $isDryRun = false;

/** @var bool */
private $allOrNothing = false;
private bool $allOrNothing = false;

/** @var bool */
private $transactional = true;
private bool $transactional = true;

/** @var string|null */
private $connectionName;
private ?string $connectionName = null;

/** @var string|null */
private $entityManagerName;
private ?string $entityManagerName = null;

/** @var bool */
private $checkDbPlatform = true;
private bool $checkDbPlatform = true;

/** @var MetadataStorageConfiguration */
private $metadataStorageConfiguration;
private ?MetadataStorageConfiguration $metadataStorageConfiguration = null;

/** @var bool */
private $frozen = false;
private bool $frozen = false;

public function freeze(): void
{
Expand Down
Expand Up @@ -18,8 +18,7 @@
*/
final class ConfigurationFile implements ConnectionLoader
{
/** @var string */
private $filename;
private string $filename;

public function __construct(string $filename)
{
Expand Down
Expand Up @@ -10,11 +10,9 @@

final class ConnectionRegistryConnection implements ConnectionLoader
{
/** @var ConnectionRegistry */
private $registry;
private ConnectionRegistry $registry;

/** @var string|null */
private $defaultConnectionName;
private ?string $defaultConnectionName = null;

public static function withSimpleDefault(ConnectionRegistry $registry, ?string $connectionName = null): self
{
Expand Down
Expand Up @@ -9,8 +9,7 @@

final class ExistingConnection implements ConnectionLoader
{
/** @var Connection */
private $connection;
private Connection $connection;

public function __construct(Connection $connection)
{
Expand Down
Expand Up @@ -16,8 +16,7 @@
*/
final class ConfigurationFile implements EntityManagerLoader
{
/** @var string */
private $filename;
private string $filename;

public function __construct(string $filename)
{
Expand Down
Expand Up @@ -9,8 +9,7 @@

final class ExistingEntityManager implements EntityManagerLoader
{
/** @var EntityManagerInterface */
private $entityManager;
private EntityManagerInterface $entityManager;

public function __construct(EntityManagerInterface $entityManager)
{
Expand Down
Expand Up @@ -10,11 +10,9 @@

final class ManagerRegistryEntityManager implements EntityManagerLoader
{
/** @var ManagerRegistry */
private $registry;
private ManagerRegistry $registry;

/** @var string|null */
private $defaultManagerName;
private ?string $defaultManagerName = null;

public static function withSimpleDefault(ManagerRegistry $registry, ?string $managerName = null): self
{
Expand Down
Expand Up @@ -19,7 +19,7 @@
final class ConfigurationArray implements ConfigurationLoader
{
/** @var array<string,mixed> */
private $configurations;
private array $configurations;

/**
* @param array<string,mixed> $configurations
Expand Down
Expand Up @@ -18,8 +18,7 @@
*/
final class ConfigurationFileWithFallback implements ConfigurationLoader
{
/** @var string|null */
private $file;
private ?string $file = null;

public function __construct(?string $file = null)
{
Expand Down
Expand Up @@ -8,8 +8,7 @@

final class ExistingConfiguration implements ConfigurationLoader
{
/** @var Configuration */
private $configurations;
private Configuration $configurations;

public function __construct(Configuration $configurations)
{
Expand Down
Expand Up @@ -18,7 +18,7 @@
final class FormattedFile extends ConfigurationFile
{
/** @var callable[] */
private $loaders = [];
private array $loaders = [];

private function setDefaultLoaders(): void
{
Expand Down
15 changes: 5 additions & 10 deletions lib/Doctrine/Migrations/DbalMigrator.php
Expand Up @@ -27,20 +27,15 @@
*/
class DbalMigrator implements Migrator
{
/** @var Stopwatch */
private $stopwatch;
private Stopwatch $stopwatch;

/** @var LoggerInterface */
private $logger;
private LoggerInterface $logger;

/** @var Executor */
private $executor;
private Executor $executor;

/** @var Connection */
private $connection;
private Connection $connection;

/** @var EventDispatcher */
private $dispatcher;
private EventDispatcher $dispatcher;

public function __construct(
Connection $connection,
Expand Down

0 comments on commit 5713b45

Please sign in to comment.