Skip to content

Commit

Permalink
Merge branch '3.7.x' into 4.0.x
Browse files Browse the repository at this point in the history
* 3.7.x: (21 commits)
  Allow doctrine/deprecations 1.0 (#1358)
  Drop support for Symfony 4 (#1352)
  Modernize codebase for PHP 8 (#1351)
  Remove docs from the archives (#1356)
  Ditch action in favor of running tool directly (#1354)
  Fix PHPStan errors after PHPUnit update (#1350)
  Add sh to .gitattributes
  Update .gitattributes
  Avoid complex mock building
  Migrate to PHPUnit 10
  Make data providers static
  Remove unneeded phpcs rule
  Suffix abstract test class with TestCase
  Add details to sync-metadata-storage's help
  Update coding standard to v12
  Remove ignore rule for @method-provided method
  build: Use the new compactors
  build: Fix cleanup of the backup composer lock file
  Add attributes to commands
  removed preceding whitespace in front of colons
  ...
  • Loading branch information
derrabus committed Sep 7, 2023
2 parents 44f599e + cc6ce22 commit d591226
Show file tree
Hide file tree
Showing 167 changed files with 1,006 additions and 1,598 deletions.
12 changes: 9 additions & 3 deletions .doctrine-project.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
"slug": "migrations",
"docsSlug": "doctrine-migrations",
"versions": [
{
"name": "3.7",
"branchName": "3.7.x",
"slug": "3.7",
"upcoming": true
},
{
"name": "3.6",
"branchName": "3.6.x",
"slug": "3.6",
"upcoming": true
"aliases": ["stable"],
"current": true
},
{
"name": "3.5",
"branchName": "3.5.x",
"slug": "3.5",
"aliases": ["stable"],
"current": true
"maintained": false
},
{
"name": "3.4",
Expand Down
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
build/* export-ignore
/docs export-ignore
/tests export-ignore
/.* export-ignore
box.json.dist export-ignore
build.properties.dev export-ignore
build.xml export-ignore
/phpunit.xml.dist export-ignore
/phpcs.xml.dist export-ignore
/phpstan.neon.dist export-ignore
composer.lock export-ignore
/download-box.sh export-ignore
/build-phar.sh export-ignore
12 changes: 9 additions & 3 deletions .github/workflows/bc-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ jobs:
with:
fetch-depth: 0

- name: "Roave BC Check"
uses: "docker://nyholm/roave-bc-check-ga"
- name: Install PHP with extensions.
uses: shivammathur/setup-php@v2
with:
args: "--from=${{ github.event.pull_request.base.sha }}"
php-version: "8.2"

- name: Install roave/backward-compatibility-check.
run: composer require --dev roave/backward-compatibility-check

- name: Run roave/backward-compatibility-check.
run: vendor/bin/roave-backward-compatibility-check
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ on:
jobs:
coding-standards:
name: "Coding Standards"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@2.1.0"
uses: "doctrine/.github/.github/workflows/coding-standards.yml@3.0.0"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ dist/
tests/phpunit.xml
vendor/
/composer.lock
/composer.lock.back
phpunit.xml
/.phpunit.result.cache
/phpcs.xml
Expand Down
4 changes: 2 additions & 2 deletions box.json.dist
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"alias": "doctrine-migrations.phar",
"compactors": [
"Herrera\\Box\\Compactor\\Php",
"Herrera\\Box\\Compactor\\Json"
"KevinGH\\Box\\Compactor\\Php",
"KevinGH\\Box\\Compactor\\Json"
],
"compression": "GZ",
"main": "bin/doctrine-migrations.php",
Expand Down
4 changes: 2 additions & 2 deletions build-phar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ function restorePlatform {
mv -f composer.lock.back composer.lock || true
}

trap restorePlatform exit

# lock PHP to minimum allowed version
composer config platform.php 7.2.0
cp composer.lock composer.lock.back || true
composer update

php box.phar compile -vv

trap restorePlatform exit
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,25 @@
"doctrine/deprecations": "^0.5.3 || ^1",
"doctrine/event-manager": "^1.2 || ^2.0",
"psr/log": "^1.1.3 || ^2 || ^3",
"symfony/console": "^4.4.16 || ^5.4 || ^6.0",
"symfony/stopwatch": "^4.4 || ^5.4 || ^6.0",
"symfony/console": "^5.4 || ^6.0",
"symfony/stopwatch": "^5.4 || ^6.0",
"symfony/var-exporter": "^6.2"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"doctrine/coding-standard": "^9",
"doctrine/coding-standard": "^12",
"doctrine/orm": "^2.13",
"doctrine/persistence": "^2 || ^3",
"doctrine/sql-formatter": "^1.0",
"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": "^9.5.24",
"symfony/cache": "^4.4 || ^5.4 || ^6.0",
"symfony/process": "^4.4 || ^5.4 || ^6.0",
"symfony/yaml": "^4.4 || ^5.4 || ^6.0"
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-deprecation-rules": "^1.1",
"phpstan/phpstan-phpunit": "^1.3",
"phpstan/phpstan-strict-rules": "^1.4",
"phpstan/phpstan-symfony": "^1.3",
"phpunit/phpunit": "^10.3",
"symfony/cache": "^5.4 || ^6.0",
"symfony/process": "^5.4 || ^6.0",
"symfony/yaml": "^5.4 || ^6.0"
},
"conflict": {
"doctrine/orm": "<2.12"
Expand Down
49 changes: 13 additions & 36 deletions lib/Doctrine/Migrations/AbstractMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,14 @@ abstract class AbstractMigration
/** @var AbstractPlatform */
protected $platform;

private LoggerInterface $logger;

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

public function __construct(Connection $connection, LoggerInterface $logger)
public function __construct(Connection $connection, private readonly LoggerInterface $logger)
{
$this->connection = $connection;
$this->sm = $this->connection->createSchemaManager();
$this->platform = $this->connection->getDatabasePlatform();
$this->logger = $logger;
}

/**
Expand Down Expand Up @@ -74,62 +71,46 @@ public function warnIf(bool $condition, string $message = 'Unknown Reason'): voi
$this->logger->warning($message, ['migration' => $this]);
}

/**
* @throws AbortMigration
*/
/** @throws AbortMigration */
public function abortIf(bool $condition, string $message = 'Unknown Reason'): void
{
if ($condition) {
throw new AbortMigration($message);
}
}

/**
* @throws SkipMigration
*/
/** @throws SkipMigration */
public function skipIf(bool $condition, string $message = 'Unknown Reason'): void
{
if ($condition) {
throw new SkipMigration($message);
}
}

/**
* @throws MigrationException|DBALException
*/
/** @throws MigrationException|DBALException */
public function preUp(Schema $schema): void
{
}

/**
* @throws MigrationException|DBALException
*/
/** @throws MigrationException|DBALException */
public function postUp(Schema $schema): void
{
}

/**
* @throws MigrationException|DBALException
*/
/** @throws MigrationException|DBALException */
public function preDown(Schema $schema): void
{
}

/**
* @throws MigrationException|DBALException
*/
/** @throws MigrationException|DBALException */
public function postDown(Schema $schema): void
{
}

/**
* @throws MigrationException|DBALException
*/
/** @throws MigrationException|DBALException */
abstract public function up(Schema $schema): void;

/**
* @throws MigrationException|DBALException
*/
/** @throws MigrationException|DBALException */
public function down(Schema $schema): void
{
$this->abortIf(true, sprintf('No down() migration implemented for "%s"', static::class));
Expand All @@ -142,14 +123,12 @@ public function down(Schema $schema): void
protected function addSql(
string $sql,
array $params = [],
array $types = []
array $types = [],
): void {
$this->plannedSql[] = new Query($sql, $params, $types);
}

/**
* @return Query[]
*/
/** @return Query[] */
public function getSql(): array
{
return $this->plannedSql;
Expand All @@ -160,10 +139,8 @@ protected function write(string $message): void
$this->logger->notice($message, ['migration' => $this]);
}

/**
* @throws IrreversibleMigration
*/
protected function throwIrreversibleMigrationException(?string $message = null): void
/** @throws IrreversibleMigration */
protected function throwIrreversibleMigrationException(string|null $message = null): void
{
if ($message === null) {
$message = 'This migration is irreversible and cannot be reverted.';
Expand Down
Loading

0 comments on commit d591226

Please sign in to comment.