Skip to content

Commit d858b4c

Browse files
authored
Drop support for Symfony 3 + 4 (doctrine#403)
1 parent 9aa3df0 commit d858b4c

File tree

7 files changed

+39
-64
lines changed

7 files changed

+39
-64
lines changed

.github/workflows/continuous-integration.yml

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ jobs:
2323
strategy:
2424
matrix:
2525
php-version:
26-
- "7.1"
27-
- "7.2"
28-
- "7.3"
2926
- "7.4"
3027
- "8.0"
3128
- "8.1"
@@ -35,17 +32,9 @@ jobs:
3532
- "highest"
3633
stability:
3734
- "stable"
38-
extra_constraint:
39-
- ""
4035
include:
4136
- dependencies: "lowest"
42-
php-version: "7.1"
43-
- dependencies: "highest"
44-
extra_constraint: "symfony/lts:v3"
45-
php-version: "7.3"
46-
- dependencies: "highest"
47-
stability: "dev"
48-
php-version: "7.3"
37+
php-version: "7.4"
4938
- dependencies: "highest"
5039
stability: "dev"
5140
php-version: "8.3"
@@ -58,28 +47,15 @@ jobs:
5847

5948
- name: "Install PHP with PCOV"
6049
uses: "shivammathur/setup-php@v2"
61-
if: "${{ matrix.php-version != '7.1' }}"
6250
with:
6351
php-version: "${{ matrix.php-version }}"
6452
coverage: "pcov"
6553
ini-values: "zend.assertions=1"
6654

67-
- name: "Install PHP with XDebug"
68-
uses: "shivammathur/setup-php@v2"
69-
if: "${{ matrix.php-version == '7.1' }}"
70-
with:
71-
php-version: "${{ matrix.php-version }}"
72-
coverage: "xdebug"
73-
ini-values: "zend.assertions=1"
74-
7555
- name: "Use dev stability"
7656
run: "composer config minimum-stability dev"
7757
if: "${{ matrix.stability == 'dev' }}"
7858

79-
- name: "Add extra constraint"
80-
run: "composer require --no-update ${{matrix.extra_constraint}}"
81-
if: "${{ contains(matrix.extra_constraint, '/') }}"
82-
8359
- name: "Install dependencies with Composer"
8460
uses: "ramsey/composer-install@v2"
8561
with:

Command/LoadDataFixturesDoctrineCommand.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
use function assert;
2323
use function implode;
2424
use function sprintf;
25-
use function trigger_error;
26-
27-
use const E_USER_DEPRECATED;
25+
use function trigger_deprecation;
2826

2927
/**
3028
* Load data fixtures from bundles.
@@ -33,21 +31,22 @@ class LoadDataFixturesDoctrineCommand extends DoctrineCommand
3331
{
3432
use CommandCompatibility;
3533

36-
/** @var SymfonyFixturesLoader */
37-
private $fixturesLoader;
34+
private SymfonyFixturesLoader $fixturesLoader;
3835

3936
/** @var PurgerFactory[] */
40-
private $purgerFactories;
37+
private array $purgerFactories;
4138

4239
/** @param PurgerFactory[] $purgerFactories */
4340
public function __construct(SymfonyFixturesLoader $fixturesLoader, ?ManagerRegistry $doctrine = null, array $purgerFactories = [])
4441
{
4542
if ($doctrine === null) {
46-
@trigger_error(sprintf(
43+
trigger_deprecation(
44+
'doctrine/fixtures-bundle',
45+
'3.2',
4746
'Argument 2 of %s() expects an instance of %s, not passing it will throw a \TypeError in DoctrineFixturesBundle 4.0.',
4847
__METHOD__,
49-
ManagerRegistry::class
50-
), E_USER_DEPRECATED);
48+
ManagerRegistry::class,
49+
);
5150
}
5251

5352
parent::__construct($doctrine);

Loader/SymfonyFixturesLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
final class SymfonyFixturesLoader extends SymfonyBridgeLoader
2121
{
2222
/** @var FixtureInterface[] */
23-
private $loadedFixtures = [];
23+
private array $loadedFixtures = [];
2424

2525
/** @var array<string, array<string, bool>> */
26-
private $groupsFixtureMapping = [];
26+
private array $groupsFixtureMapping = [];
2727

2828
/**
2929
* @internal

Tests/Command/LoadDataFixturesDoctrineCommandTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Doctrine\Bundle\FixturesBundle\Loader\SymfonyFixturesLoader;
1010
use Doctrine\Persistence\ManagerRegistry;
1111
use PHPUnit\Framework\TestCase;
12+
use Symfony\Bridge\PhpUnit\ExpectDeprecationTrait;
1213
use Symfony\Component\DependencyInjection\Container;
1314
use TypeError;
1415

@@ -18,14 +19,15 @@
1819

1920
class LoadDataFixturesDoctrineCommandTest extends TestCase
2021
{
21-
/**
22-
* @group legacy
23-
* @expectedDeprecation Argument 2 of Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand::__construct() expects an instance of Doctrine\Persistence\ManagerRegistry, not passing it will throw a \TypeError in DoctrineFixturesBundle 4.0.
24-
*/
22+
use ExpectDeprecationTrait;
23+
24+
/** @group legacy */
2525
public function testInstantiatingWithoutManagerRegistry(): void
2626
{
2727
$loader = new SymfonyFixturesLoader(new Container());
2828

29+
$this->expectDeprecation('Since doctrine/fixtures-bundle 3.2: Argument 2 of Doctrine\Bundle\FixturesBundle\Command\LoadDataFixturesDoctrineCommand::__construct() expects an instance of Doctrine\Persistence\ManagerRegistry, not passing it will throw a \TypeError in DoctrineFixturesBundle 4.0.');
30+
2931
try {
3032
new LoadDataFixturesDoctrineCommand($loader);
3133
} catch (TypeError $e) {

Tests/IntegrationTestKernel.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Doctrine\Bundle\FixturesBundle\Tests;
66

7+
use Closure;
78
use Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle;
89
use Doctrine\Bundle\FixturesBundle\Tests\Fixtures\FooBundle\FooBundle;
910
use Doctrine\Persistence\ManagerRegistry;
@@ -17,11 +18,8 @@
1718

1819
class IntegrationTestKernel extends Kernel
1920
{
20-
/** @var callable */
21-
private $servicesCallback;
22-
23-
/** @var int */
24-
private $randomKey;
21+
private ?Closure $servicesCallback = null;
22+
private int $randomKey;
2523

2624
public function __construct(string $environment, bool $debug)
2725
{
@@ -46,7 +44,7 @@ public function registerBundles(): array
4644
];
4745
}
4846

49-
public function addServices(callable $callback): void
47+
public function addServices(Closure $callback): void
5048
{
5149
$this->servicesCallback = $callback;
5250
}

Tests/Purger/ORMPurgerFactoryTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@
1414

1515
class ORMPurgerFactoryTest extends TestCase
1616
{
17-
/** @var ORMPurgerFactory */
18-
private $factory;
17+
private ORMPurgerFactory $factory;
1918

20-
/** @var EntityManagerInterface|MockObject */
21-
private $em;
19+
/** @var EntityManagerInterface&MockObject */
20+
private EntityManagerInterface $em;
2221

2322
protected function setUp(): void
2423
{

composer.json

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,24 @@
2020
}
2121
],
2222
"require": {
23-
"php": "^7.1 || ^8.0",
23+
"php": "^7.4 || ^8.0",
2424
"doctrine/data-fixtures": "^1.3",
25-
"doctrine/doctrine-bundle": "^1.11|^2.0",
26-
"doctrine/orm": "^2.6.0",
27-
"doctrine/persistence": "^1.3.7|^2.0|^3.0",
28-
"symfony/config": "^3.4|^4.3|^5.0|^6.0|^7.0",
29-
"symfony/console": "^3.4|^4.3|^5.0|^6.0|^7.0",
30-
"symfony/dependency-injection": "^3.4.47|^4.3|^5.0|^6.0|^7.0",
31-
"symfony/doctrine-bridge": "^3.4|^4.1|^5.0|^6.0|^7.0",
32-
"symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0|^7."
25+
"doctrine/doctrine-bundle": "^2.2",
26+
"doctrine/orm": "^2.14.0",
27+
"doctrine/persistence": "^2.4|^3.0",
28+
"symfony/config": "^5.4|^6.0|^7.0",
29+
"symfony/console": "^5.4|^6.0|^7.0",
30+
"symfony/dependency-injection": "^5.4|^6.0|^7.0",
31+
"symfony/deprecation-contracts": "^2.1|^3",
32+
"symfony/doctrine-bridge": "^5.4|^6.0|^7.0",
33+
"symfony/http-kernel": "^5.4|^6.0|^7.0"
3334
},
3435
"require-dev": {
35-
"doctrine/coding-standard": "^9 || ^12",
36-
"phpstan/phpstan": "^1.4.10",
37-
"phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20",
38-
"symfony/phpunit-bridge": "^6.3",
39-
"vimeo/psalm": "^4.22"
36+
"doctrine/coding-standard": "^12",
37+
"phpstan/phpstan": "^1.10.39",
38+
"phpunit/phpunit": "^9.6.13",
39+
"symfony/phpunit-bridge": "^6.3.6",
40+
"vimeo/psalm": "^4.30"
4041
},
4142
"autoload": {
4243
"psr-4": { "Doctrine\\Bundle\\FixturesBundle\\": "" }

0 commit comments

Comments
 (0)