Skip to content

Commit bd90d28

Browse files
committed
Fix Symfony 7.3-dev deprecations
1 parent 2ce7b72 commit bd90d28

File tree

5 files changed

+10
-18
lines changed

5 files changed

+10
-18
lines changed

.github/workflows/test-dev-stability.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
php-version:
19-
- "8.2"
19+
- "8.4"
2020
dependencies:
2121
- "highest"
2222
stability:
@@ -39,10 +39,6 @@ jobs:
3939
extensions: "pdo_sqlite"
4040
tools: "flex"
4141

42-
- name: "Require symfony/messenger"
43-
run: "composer require --dev symfony/messenger --no-update"
44-
if: "${{ startsWith(matrix.symfony-require, '4.') }}"
45-
4642
- name: "Install dependencies with Composer"
4743
uses: "ramsey/composer-install@v3"
4844
with:

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
"doctrine/cache": "^1.11 || ^2.0",
4848
"doctrine/coding-standard": "^13",
4949
"doctrine/deprecations": "^1.0",
50-
"doctrine/orm": "^2.17 || ^3.0",
50+
"doctrine/orm": "^2.17 || ^3.1",
5151
"friendsofphp/proxy-manager-lts": "^1.0",
5252
"phpstan/phpstan": "2.1.1",
5353
"phpstan/phpstan-phpunit": "2.0.3",

src/DependencyInjection/DoctrineExtension.php

+2-11
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
4040
use Doctrine\Persistence\Mapping\Driver\PHPDriver;
4141
use Doctrine\Persistence\Mapping\Driver\StaticPHPDriver;
42-
use Doctrine\Persistence\Reflection\RuntimeReflectionProperty;
4342
use InvalidArgumentException;
4443
use LogicException;
4544
use Symfony\Bridge\Doctrine\Attribute\MapEntity;
@@ -65,7 +64,7 @@
6564
use Symfony\Component\Messenger\MessageBusInterface;
6665
use Symfony\Component\PropertyInfo\PropertyInfoExtractorInterface;
6766
use Symfony\Component\Validator\Mapping\Loader\LoaderInterface;
68-
use Symfony\Component\VarExporter\LazyGhostTrait;
67+
use Symfony\Component\VarExporter\ProxyHelper;
6968

7069
use function array_intersect_key;
7170
use function array_keys;
@@ -77,7 +76,6 @@
7776
use function reset;
7877
use function sprintf;
7978
use function str_replace;
80-
use function trait_exists;
8179
use function trigger_deprecation;
8280

8381
/**
@@ -559,19 +557,12 @@ protected function ormLoad(array $config, ContainerBuilder $container)
559557
$container->setParameter('doctrine.default_entity_manager', $config['default_entity_manager']);
560558

561559
if ($config['enable_lazy_ghost_objects'] ?? false) {
562-
if (! trait_exists(LazyGhostTrait::class)) {
560+
if (! class_exists(ProxyHelper::class)) {
563561
throw new LogicException(
564562
'Lazy ghost objects cannot be enabled because the "symfony/var-exporter" library'
565563
. ' is not installed. Please run "composer require symfony/var-exporter".',
566564
);
567565
}
568-
569-
if (! class_exists(RuntimeReflectionProperty::class)) {
570-
throw new LogicException(
571-
'Lazy ghost objects cannot be enabled because the "doctrine/persistence" library'
572-
. ' version 3.1 or higher is not installed. Please run "composer update doctrine/persistence".',
573-
);
574-
}
575566
} elseif (! method_exists(ProxyFactory::class, 'resetUninitializedProxy')) {
576567
throw new LogicException(
577568
'Lazy ghost objects cannot be disabled for ORM 3.',

tests/CacheSchemaSubscriberTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public function testSchemaSubscriberWiring(): void
4949
$extension->load([
5050
'framework' => [
5151
'http_method_override' => false,
52+
'handle_all_throwables' => true,
53+
'php_errors' => ['log' => true],
5254
'cache' => [
5355
'pools' => [
5456
'my_cache_adapter' => ['adapter' => 'cache.adapter.doctrine_dbal'],

tests/Repository/ServiceEntityRepositoryTest.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public function testConstructorThrowsExceptionWhenNoManagerFound(): void
3535
$repo->getClassName();
3636
}
3737

38-
/** @requires function \Symfony\Component\VarExporter\ProxyHelper::generateLazyGhost */
38+
/**
39+
* @requires function \Symfony\Component\VarExporter\ProxyHelper::generateLazyGhost
40+
* @requires PHP < 8.4
41+
*/
3942
public function testConstructInitializesWhenImplementingLazyObjectInterface(): void
4043
{
4144
$registry = $this->getMockBuilder(ManagerRegistry::class)->getMock();

0 commit comments

Comments
 (0)