Skip to content

Commit 23f3668

Browse files
committed
feat: allow doctrine/doctrine-bundle 3
1 parent 80d51ce commit 23f3668

File tree

8 files changed

+19
-22
lines changed

8 files changed

+19
-22
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"willdurand/geocoder": "^4.6|^5.0"
2424
},
2525
"require-dev": {
26-
"doctrine/doctrine-bundle": "^2.3",
26+
"doctrine/doctrine-bundle": "^2.18 || ^3.0",
2727
"doctrine/orm": "^2.20 || ^3.0",
2828
"fakerphp/faker": "^1.20",
2929
"friendsofphp/php-cs-fixer": "^3.13",

src/DependencyInjection/BazingaGeocoderExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ class BazingaGeocoderExtension extends Extension
4141
{
4242
/**
4343
* @param array<mixed, mixed> $configs
44-
*
45-
* @return void
4644
*/
47-
public function load(array $configs, ContainerBuilder $container)
45+
public function load(array $configs, ContainerBuilder $container): void
4846
{
4947
$processor = new Processor();
5048
$configuration = $this->getConfiguration($configs, $container);

src/DependencyInjection/Compiler/AddProvidersPass.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,8 @@ class AddProvidersPass implements CompilerPassInterface
2525
/**
2626
* Get all providers based on their tag (`bazinga_geocoder.provider`) and
2727
* register them.
28-
*
29-
* @return void
3028
*/
31-
public function process(ContainerBuilder $container)
29+
public function process(ContainerBuilder $container): void
3230
{
3331
if (!$container->hasDefinition(ProviderAggregator::class)) {
3432
return;

src/DependencyInjection/Compiler/FactoryValidatorPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,7 @@ class FactoryValidatorPass implements CompilerPassInterface
2828
*/
2929
private static $factoryServiceIds = [];
3030

31-
/**
32-
* @return void
33-
*/
34-
public function process(ContainerBuilder $container)
31+
public function process(ContainerBuilder $container): void
3532
{
3633
foreach (self::$factoryServiceIds as $id) {
3734
if (!$container->hasAlias($id) && !$container->hasDefinition($id)) {

src/DependencyInjection/Compiler/ProfilerPass.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,7 @@
2424
*/
2525
class ProfilerPass implements CompilerPassInterface
2626
{
27-
/**
28-
* @return void
29-
*/
30-
public function process(ContainerBuilder $container)
27+
public function process(ContainerBuilder $container): void
3128
{
3229
if (!$container->hasDefinition(GeocoderDataCollector::class)) {
3330
return;

src/Mapping/Driver/AttributeDriver.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function isGeocodeable(object $object): bool
3131
}
3232

3333
/**
34-
* @throws MappingException
34+
* @throws MappingException|\ReflectionException
3535
*/
3636
public function loadMetadataFromObject(object $object): ClassMetadata
3737
{
@@ -76,6 +76,8 @@ public function loadMetadataFromObject(object $object): ClassMetadata
7676
* @param T $object
7777
*
7878
* @return \ReflectionClass<T>
79+
*
80+
* @throws \ReflectionException
7981
*/
8082
private static function getReflection(object $object): \ReflectionClass
8183
{
@@ -84,7 +86,12 @@ private static function getReflection(object $object): \ReflectionClass
8486
return ClassUtils::newReflectionObject($object);
8587
}
8688

89+
if (PHP_VERSION_ID < 80400) {
90+
/** @var \ReflectionClass<T> */
91+
return new \ReflectionClass(DefaultProxyClassNameResolver::getClass($object));
92+
}
93+
8794
/** @var \ReflectionClass<T> */
88-
return new \ReflectionClass(DefaultProxyClassNameResolver::getClass($object));
95+
return new \ReflectionClass($object);
8996
}
9097
}

tests/Functional/GeocoderListenerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,14 @@ public function process(ContainerBuilder $container): void
7171
$kernel->addTestConfig(static function (ContainerBuilder $container) {
7272
$container->prependExtensionConfig('doctrine', [
7373
'orm' => [
74-
'report_fields_where_declared' => true,
74+
//'report_fields_where_declared' => true,
7575
],
7676
]);
7777

7878
if (method_exists(Configuration::class, 'setLazyGhostObjectEnabled') && Kernel::VERSION_ID >= 60100) {
7979
$container->prependExtensionConfig('doctrine', [
8080
'orm' => [
81-
'enable_lazy_ghost_objects' => true,
81+
//'enable_lazy_ghost_objects' => true,
8282
],
8383
]);
8484
}
@@ -87,7 +87,7 @@ public function process(ContainerBuilder $container): void
8787
$container->prependExtensionConfig('doctrine', [
8888
'orm' => [
8989
'controller_resolver' => [
90-
'auto_mapping' => false,
90+
//'auto_mapping' => false,
9191
],
9292
],
9393
]);

tests/Functional/config/listener.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ doctrine:
66
driver: pdo_sqlite
77
path: '%kernel.cache_dir%/test.sqlite'
88
orm:
9-
auto_generate_proxy_classes: true
9+
#auto_generate_proxy_classes: true
1010
validate_xml_mapping: true
11-
report_fields_where_declared: true
11+
#report_fields_where_declared: true
1212
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
1313
auto_mapping: false
1414

0 commit comments

Comments
 (0)