Skip to content

Commit

Permalink
Merge pull request #1102 from nicolas-grekas/php-8
Browse files Browse the repository at this point in the history
Allow PHP 8
  • Loading branch information
alcaeus committed Dec 23, 2020
2 parents af91502 + f646b25 commit 3952069
Show file tree
Hide file tree
Showing 225 changed files with 1,874 additions and 1,079 deletions.
664 changes: 664 additions & 0 deletions .github/phpstan-baseline.neon

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions .github/workflows/bc-check.yml
@@ -1,19 +1,19 @@

name: "Backward Compatibility Check"
#name: "Backward Compatibility Check"

on:
pull_request:
#on:
# pull_request:

jobs:
roave_bc_check:
name: "Roave BC Check"
runs-on: "ubuntu-20.04"
steps:
- uses: "actions/checkout@v2"
with:
fetch-depth: 0
#jobs:
# roave_bc_check:
# name: "Roave BC Check"
# runs-on: "ubuntu-20.04"
# steps:
# - uses: "actions/checkout@v2"
# with:
# fetch-depth: 0

- name: "Roave BC Check"
uses: "docker://nyholm/roave-bc-check-ga"
with:
args: "--from=${{ github.event.pull_request.base.sha }}"
# - name: "Roave BC Check"
# uses: "docker://nyholm/roave-bc-check-ga"
# with:
# args: "--from=${{ github.event.pull_request.base.sha }}"
1 change: 1 addition & 0 deletions .github/workflows/continuous-integration.yml
Expand Up @@ -19,6 +19,7 @@ jobs:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
deps:
- "normal"
include:
Expand Down
10 changes: 6 additions & 4 deletions bin/doctrine-migrations.php
Expand Up @@ -8,16 +8,18 @@
use Phar;
use Symfony\Component\Console\Helper\HelperSet;
use Symfony\Component\Console\Helper\QuestionHelper;
use const DIRECTORY_SEPARATOR;
use const E_USER_ERROR;
use const PHP_EOL;

use function extension_loaded;
use function file_exists;
use function getcwd;
use function is_readable;
use function trigger_error;

(static function () : void {
use const DIRECTORY_SEPARATOR;
use const E_USER_ERROR;
use const PHP_EOL;

(static function (): void {
$autoloadFiles = [
__DIR__ . '/../vendor/autoload.php',
__DIR__ . '/../../../autoload.php',
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Expand Up @@ -11,23 +11,23 @@
{"name": "Michael Simonson", "email": "contact@mikesimonson.com" }
],
"require": {
"php": "^7.1",
"php": "^7.1 || ^8.0",
"composer/package-versions-deprecated": "^1.8",
"doctrine/dbal": "^2.9",
"ocramius/proxy-manager": "^2.0.2",
"friendsofphp/proxy-manager-lts": "^1.0",
"symfony/console": "^3.4||^4.4.16||^5.0",
"symfony/stopwatch": "^3.4||^4.0||^5.0"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"doctrine/coding-standard": "^6.0",
"doctrine/coding-standard": "^8.2",
"doctrine/orm": "^2.6",
"jdorn/sql-formatter": "^1.1",
"mikey179/vfsstream": "^1.6",
"phpstan/phpstan": "^0.10",
"phpstan/phpstan-deprecation-rules": "^0.10",
"phpstan/phpstan-phpunit": "^0.10",
"phpstan/phpstan-strict-rules": "^0.10",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-deprecation-rules": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^7.5 || ^8.5 || ^9.4",
"symfony/process": "^3.4||^4.0||^5.0",
"symfony/yaml": "^3.4||^4.0||^5.0"
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/3.9.0/box.phar -O box.phar
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
fi
29 changes: 15 additions & 14 deletions lib/Doctrine/Migrations/AbstractMigration.php
Expand Up @@ -14,6 +14,7 @@
use Doctrine\Migrations\Exception\MigrationException;
use Doctrine\Migrations\Exception\SkipMigration;
use Doctrine\Migrations\Version\Version;

use function sprintf;

/**
Expand Down Expand Up @@ -57,17 +58,17 @@ public function __construct(Version $version)
*
* Extending class should override this function to alter the return value.
*/
public function isTransactional() : bool
public function isTransactional(): bool
{
return true;
}

public function getDescription() : string
public function getDescription(): string
{
return '';
}

public function warnIf(bool $condition, string $message = '') : void
public function warnIf(bool $condition, string $message = ''): void
{
if (! $condition) {
return;
Expand All @@ -85,7 +86,7 @@ public function warnIf(bool $condition, string $message = '') : void
/**
* @throws AbortMigration
*/
public function abortIf(bool $condition, string $message = '') : void
public function abortIf(bool $condition, string $message = ''): void
{
if ($condition) {
throw new AbortMigration($message ?: 'Unknown Reason');
Expand All @@ -95,7 +96,7 @@ public function abortIf(bool $condition, string $message = '') : void
/**
* @throws SkipMigration
*/
public function skipIf(bool $condition, string $message = '') : void
public function skipIf(bool $condition, string $message = ''): void
{
if ($condition) {
throw new SkipMigration($message ?: 'Unknown Reason');
Expand All @@ -105,40 +106,40 @@ public function skipIf(bool $condition, string $message = '') : void
/**
* @throws MigrationException|DBALException
*/
public function preUp(Schema $schema) : void
public function preUp(Schema $schema): void
{
}

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

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

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

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

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

/**
* @param mixed[] $params
Expand All @@ -148,19 +149,19 @@ protected function addSql(
string $sql,
array $params = [],
array $types = []
) : void {
): void {
$this->version->addSql($sql, $params, $types);
}

protected function write(string $message) : void
protected function write(string $message): void
{
$this->outputWriter->write($message);
}

/**
* @throws IrreversibleMigration
*/
protected function throwIrreversibleMigrationException(?string $message = null) : void
protected function throwIrreversibleMigrationException(?string $message = null): void
{
if ($message === null) {
$message = 'This migration is irreversible and cannot be reverted.';
Expand Down
Expand Up @@ -8,6 +8,7 @@
use Doctrine\Migrations\Configuration\Exception\FileNotFound;
use Doctrine\Migrations\Configuration\Exception\InvalidConfigurationKey;
use Doctrine\Migrations\Configuration\Exception\UnknownConfigurationValue;

use function dirname;
use function file_exists;
use function getcwd;
Expand Down Expand Up @@ -61,7 +62,7 @@ abstract class AbstractFileConfiguration extends Configuration
/**
* @throws FileNotFound
*/
public function load(string $file) : void
public function load(string $file): void
{
if ($this->loaded) {
throw FileAlreadyLoaded::new();
Expand All @@ -83,15 +84,15 @@ public function load(string $file) : void
$this->loaded = true;
}

public function getFile() : string
public function getFile(): string
{
return $this->file;
}

/**
* @param mixed[] $config
*/
protected function setConfiguration(array $config) : void
protected function setConfiguration(array $config): void
{
foreach ($config as $configurationKey => $configurationValue) {
if (! in_array($configurationKey, self::ALLOWED_CONFIGURATION_KEYS, true)) {
Expand All @@ -108,7 +109,7 @@ protected function setConfiguration(array $config) : void
}
}

protected function getDirectoryRelativeToFile(string $file, string $input) : string
protected function getDirectoryRelativeToFile(string $file, string $input): string
{
$path = realpath(dirname($file) . '/' . $input);

Expand All @@ -120,16 +121,16 @@ protected function getDirectoryRelativeToFile(string $file, string $input) : str
* load the given configuration file whether it be xml, yaml, etc. or something
* else.
*/
abstract protected function doLoad(string $file) : void;
abstract protected function doLoad(string $file): void;

private function loadMigrationsFromDirectory(string $migrationsDirectory) : void
private function loadMigrationsFromDirectory(string $migrationsDirectory): void
{
$this->setMigrationsDirectory($migrationsDirectory);
$this->registerMigrationsFromDirectory($migrationsDirectory);
}

/** @param string[][] $migrations */
private function loadMigrations(array $migrations) : void
private function loadMigrations(array $migrations): void
{
foreach ($migrations as $migration) {
$this->registerMigration(
Expand All @@ -139,7 +140,7 @@ private function loadMigrations(array $migrations) : void
}
}

private function setMigrationOrganization(string $migrationOrganization) : void
private function setMigrationOrganization(string $migrationOrganization): void
{
if (strcasecmp($migrationOrganization, self::VERSIONS_ORGANIZATION_BY_YEAR) === 0) {
$this->setMigrationsAreOrganizedByYear();
Expand Down
3 changes: 1 addition & 2 deletions lib/Doctrine/Migrations/Configuration/ArrayConfiguration.php
Expand Up @@ -11,8 +11,7 @@
*/
class ArrayConfiguration extends AbstractFileConfiguration
{
/** @inheritdoc */
protected function doLoad(string $file) : void
protected function doLoad(string $file): void
{
$config = require $file;

Expand Down

0 comments on commit 3952069

Please sign in to comment.