Skip to content

Commit

Permalink
[make:*] drop Symfony 6.3 support
Browse files Browse the repository at this point in the history
  • Loading branch information
jrushlow committed Jan 26, 2024
1 parent 23b5e83 commit 140f401
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 41 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,18 @@ jobs:
php-version:
- '8.2'
symfony-version:
- '6.3.x-dev'
- '6.4.x-dev'
- '7.0.x-dev'
dependency-versions: ['highest']
allow-dev-deps-in-apps: ['0']
include:
# testing lowest PHP+dependencies with lowest Symfony
- php-version: '8.1'
symfony-version: '6.3.*'
symfony-version: '6.4.*'
dependency-versions: 'lowest'
# testing lowest PHP+dependencies with highest Symfony
- php-version: '8.1'
symfony-version: '6.3.*'
symfony-version: '6.4.*'
dependency-versions: 'highest'

steps:
Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
"php": ">=8.1",
"doctrine/inflector": "^2.0",
"nikic/php-parser": "^4.18|^5.0",
"symfony/config": "^6.3|^7.0",
"symfony/console": "^6.3|^7.0",
"symfony/dependency-injection": "^6.3|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/console": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/deprecation-contracts": "^2.2|^3",
"symfony/filesystem": "^6.3|^7.0",
"symfony/finder": "^6.3|^7.0",
"symfony/framework-bundle": "^6.3|^7.0",
"symfony/http-kernel": "^6.3|^7.0",
"symfony/process": "^6.3|^7.0"
"symfony/filesystem": "^6.4|^7.0",
"symfony/finder": "^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0"
},
"require-dev": {
"composer/semver": "^3.0",
"doctrine/doctrine-bundle": "^2.5.0",
"doctrine/orm": "^2.10.0",
"symfony/http-client": "^6.3|^7.0",
"symfony/phpunit-bridge": "^6.3|^7.0",
"symfony/security-core": "^6.3|^7.0",
"symfony/yaml": "^6.3|^7.0",
"symfony/http-client": "^6.4|^7.0",
"symfony/phpunit-bridge": "^6.4.1|^7.0",
"symfony/security-core": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0",
"twig/twig": "^3.0|^4.x-dev"
},
"config": {
Expand Down
30 changes: 4 additions & 26 deletions src/Test/MakerTestEnvironment.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,12 @@ public function prepareDirectory(): void
$dependencies = $this->determineMissingDependencies();
if ($dependencies) {
// -v actually silences the "very" verbose output in case of an error
$composerProcess = MakerTestProcess::create(sprintf('composer require %s -v', implode(' ', $dependencies)), $this->path);
$composerProcess = MakerTestProcess::create(sprintf('composer require %s -v', implode(' ', $dependencies)), $this->path)
->run(true)
;

// @legacy Temporary code until doctrine/dbal 3.7 is out (which supports symfony/console 7.0
$composerProcess->run(true);
if (!$composerProcess->isSuccessful()) {
if (str_contains($composerProcess->getErrorOutput(), 'Declaration of Doctrine\DBAL\Tools\Console\Command\RunSqlCommand::execute')) {
$this->patchDoctrineDbalForSymfony7();
} else {
throw new \Exception(sprintf('Error running command: composer require %s -v. Output: "%s". Error: "%s"', implode(' ', $dependencies), $composerProcess->getOutput(), $composerProcess->getErrorOutput()));
}
throw new \Exception(sprintf('Error running command: composer require %s -v. Output: "%s". Error: "%s"', implode(' ', $dependencies), $composerProcess->getOutput(), $composerProcess->getErrorOutput()));
}
}

Expand Down Expand Up @@ -449,22 +445,4 @@ private function addMakerBundleRepoToComposer(string $composerJsonPath): void

file_put_contents($composerJsonPath, json_encode($composerJson, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES));
}

private function patchDoctrineDbalForSymfony7(): void
{
$commandPath = $this->path.'/vendor/doctrine/dbal/src/Tools/Console/Command/RunSqlCommand.php';
$contents = file_get_contents($commandPath);

$needle = 'protected function execute(InputInterface $input, OutputInterface $output)';
if (str_contains($contents, $needle.': int')) {
return;
}

$contents = str_replace(
$needle,
$needle.': int',
$contents
);
file_put_contents($commandPath, $contents);
}
}

0 comments on commit 140f401

Please sign in to comment.