Skip to content

Commit 6ceaf27

Browse files
feat: allow doctrine/doctrine-bundle 3 (#384)
* feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 * feat: allow doctrine/doctrine-bundle 3 --------- Co-authored-by: Christopher Georg <[email protected]>
1 parent 43bb945 commit 6ceaf27

File tree

11 files changed

+81
-81
lines changed

11 files changed

+81
-81
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",

phpstan-baseline.php

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,197 +1,199 @@
1-
<?php declare(strict_types = 1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
$ignoreErrors = [];
46
$ignoreErrors[] = [
57
// identifier: argument.type
68
'message' => '#^Parameter \\#1 \\$name of method Geocoder\\\\ProviderAggregator\\:\\:using\\(\\) expects string, mixed given\\.$#',
79
'count' => 1,
8-
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
10+
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
911
];
1012
$ignoreErrors[] = [
1113
// identifier: argument.type
1214
'message' => '#^Parameter \\#1 \\$string of function strtolower expects string, string\\|null given\\.$#',
1315
'count' => 1,
14-
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
16+
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
1517
];
1618
$ignoreErrors[] = [
1719
// identifier: argument.type
1820
'message' => '#^Parameter \\#1 \\$text of static method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:create\\(\\) expects string, mixed given\\.$#',
1921
'count' => 1,
20-
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
22+
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
2123
];
2224
$ignoreErrors[] = [
2325
// identifier: argument.type
2426
'message' => '#^Parameter \\#3 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#',
2527
'count' => 1,
26-
'path' => __DIR__ . '/src/Command/GeocodeCommand.php',
28+
'path' => __DIR__.'/src/Command/GeocodeCommand.php',
2729
];
2830
$ignoreErrors[] = [
2931
// identifier: foreach.nonIterable
3032
'message' => '#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#',
3133
'count' => 3,
32-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
34+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
3335
];
3436
$ignoreErrors[] = [
3537
// identifier: offsetAccess.nonOffsetAccessible
3638
'message' => '#^Cannot access offset \'aliases\' on mixed\\.$#',
3739
'count' => 1,
38-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
40+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
3941
];
4042
$ignoreErrors[] = [
4143
// identifier: offsetAccess.nonOffsetAccessible
4244
'message' => '#^Cannot access offset \'enabled\' on mixed\\.$#',
4345
'count' => 1,
44-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
46+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
4547
];
4648
$ignoreErrors[] = [
4749
// identifier: offsetAccess.nonOffsetAccessible
4850
'message' => '#^Cannot access offset \'factory\' on mixed\\.$#',
4951
'count' => 5,
50-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
52+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
5153
];
5254
$ignoreErrors[] = [
5355
// identifier: offsetAccess.nonOffsetAccessible
5456
'message' => '#^Cannot access offset \'id\' on mixed\\.$#',
5557
'count' => 1,
56-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
58+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
5759
];
5860
$ignoreErrors[] = [
5961
// identifier: offsetAccess.nonOffsetAccessible
6062
'message' => '#^Cannot access offset \'options\' on mixed\\.$#',
6163
'count' => 4,
62-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
64+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
6365
];
6466
$ignoreErrors[] = [
6567
// identifier: offsetAccess.nonOffsetAccessible
6668
'message' => '#^Cannot access offset \'reference\' on mixed\\.$#',
6769
'count' => 2,
68-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
70+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
6971
];
7072
$ignoreErrors[] = [
7173
// identifier: staticMethod.nonObject
7274
'message' => '#^Cannot call static method validate\\(\\) on mixed\\.$#',
7375
'count' => 1,
74-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
76+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
7577
];
7678
$ignoreErrors[] = [
7779
// identifier: cast.string
7880
'message' => '#^Cannot cast mixed to string\\.$#',
7981
'count' => 1,
80-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
82+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
8183
];
8284
$ignoreErrors[] = [
8385
// identifier: argument.type
8486
'message' => '#^Parameter \\#1 \\$alias of method Symfony\\\\Component\\\\DependencyInjection\\\\ContainerBuilder\\:\\:setAlias\\(\\) expects string, mixed given\\.$#',
8587
'count' => 1,
86-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
88+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
8789
];
8890
$ignoreErrors[] = [
8991
// identifier: argument.type
9092
'message' => '#^Parameter \\#1 \\$callback of function array_map expects \\(callable\\(mixed\\)\\: mixed\\)\\|null, Closure\\(string\\)\\: Symfony\\\\Component\\\\DependencyInjection\\\\Reference given\\.$#',
9193
'count' => 1,
92-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
94+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
9395
];
9496
$ignoreErrors[] = [
9597
// identifier: argument.type
9698
'message' => '#^Parameter \\#1 \\$factoryServiceId of static method Bazinga\\\\GeocoderBundle\\\\DependencyInjection\\\\Compiler\\\\FactoryValidatorPass\\:\\:addFactoryServiceId\\(\\) expects string, mixed given\\.$#',
9799
'count' => 1,
98-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
100+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
99101
];
100102
$ignoreErrors[] = [
101103
// identifier: argument.type
102104
'message' => '#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, mixed given\\.$#',
103105
'count' => 1,
104-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
106+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
105107
];
106108
$ignoreErrors[] = [
107109
// identifier: argument.type
108110
'message' => '#^Parameter \\#1 \\$id of method Symfony\\\\Component\\\\DependencyInjection\\\\ContainerBuilder\\:\\:getDefinition\\(\\) expects string, mixed given\\.$#',
109111
'count' => 1,
110-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
112+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
111113
];
112114
$ignoreErrors[] = [
113115
// identifier: argument.type
114116
'message' => '#^Parameter \\#1 \\$object_or_class of function class_implements expects object\\|string, mixed given\\.$#',
115117
'count' => 1,
116-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
118+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
117119
];
118120
$ignoreErrors[] = [
119121
// identifier: argument.type
120122
'message' => '#^Parameter \\#1 \\$options of method Bazinga\\\\GeocoderBundle\\\\DependencyInjection\\\\BazingaGeocoderExtension\\:\\:findReferences\\(\\) expects array\\<int\\|string, mixed\\>, mixed given\\.$#',
121123
'count' => 2,
122-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
124+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
123125
];
124126
$ignoreErrors[] = [
125127
// identifier: argument.type
126128
'message' => '#^Parameter \\#1 \\$string of function ltrim expects string, mixed given\\.$#',
127129
'count' => 1,
128-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
130+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
129131
];
130132
$ignoreErrors[] = [
131133
// identifier: argument.type
132134
'message' => '#^Parameter \\#2 \\$config of method Bazinga\\\\GeocoderBundle\\\\DependencyInjection\\\\BazingaGeocoderExtension\\:\\:configureProviderPlugins\\(\\) expects array\\<int\\|string, mixed\\>, mixed given\\.$#',
133135
'count' => 1,
134-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
136+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
135137
];
136138
$ignoreErrors[] = [
137139
// identifier: argument.type
138140
'message' => '#^Parameter \\#2 \\.\\.\\.\\$values of function sprintf expects bool\\|float\\|int\\|string\\|null, mixed given\\.$#',
139141
'count' => 1,
140-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
142+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
141143
];
142144
$ignoreErrors[] = [
143145
// identifier: encapsedStringPart.nonString
144146
'message' => '#^Part \\$providerName \\(mixed\\) of encapsed string cannot be cast to string\\.$#',
145147
'count' => 1,
146-
'path' => __DIR__ . '/src/DependencyInjection/BazingaGeocoderExtension.php',
148+
'path' => __DIR__.'/src/DependencyInjection/BazingaGeocoderExtension.php',
147149
];
148150
$ignoreErrors[] = [
149151
// identifier: method.nonObject
150152
'message' => '#^Cannot call method getLatitude\\(\\) on Geocoder\\\\Model\\\\Coordinates\\|null\\.$#',
151153
'count' => 1,
152-
'path' => __DIR__ . '/src/Doctrine/ORM/GeocoderListener.php',
154+
'path' => __DIR__.'/src/Doctrine/ORM/GeocoderListener.php',
153155
];
154156
$ignoreErrors[] = [
155157
// identifier: method.nonObject
156158
'message' => '#^Cannot call method getLongitude\\(\\) on Geocoder\\\\Model\\\\Coordinates\\|null\\.$#',
157159
'count' => 1,
158-
'path' => __DIR__ . '/src/Doctrine/ORM/GeocoderListener.php',
160+
'path' => __DIR__.'/src/Doctrine/ORM/GeocoderListener.php',
159161
];
160162
$ignoreErrors[] = [
161163
// identifier: argument.type
162164
'message' => '#^Parameter \\#1 \\$text of method Geocoder\\\\Query\\\\GeocodeQuery\\:\\:withText\\(\\) expects string, string\\|null given\\.$#',
163165
'count' => 1,
164-
'path' => __DIR__ . '/src/Plugin/FakeIpPlugin.php',
166+
'path' => __DIR__.'/src/Plugin/FakeIpPlugin.php',
165167
];
166168
$ignoreErrors[] = [
167169
// identifier: argument.type
168170
'message' => '#^Parameter \\#2 \\$replace of function str_replace expects array\\|string, string\\|null given\\.$#',
169171
'count' => 1,
170-
'path' => __DIR__ . '/src/Plugin/FakeIpPlugin.php',
172+
'path' => __DIR__.'/src/Plugin/FakeIpPlugin.php',
171173
];
172174
$ignoreErrors[] = [
173175
// identifier: argument.type
174176
'message' => '#^Parameter \\#1 \\$accountId of class GeoIp2\\\\WebService\\\\Client constructor expects int, int\\|null given\\.$#',
175177
'count' => 1,
176-
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
178+
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
177179
];
178180
$ignoreErrors[] = [
179181
// identifier: argument.type
180182
'message' => '#^Parameter \\#1 \\$filename of class GeoIp2\\\\Database\\\\Reader constructor expects string, string\\|null given\\.$#',
181183
'count' => 1,
182-
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
184+
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
183185
];
184186
$ignoreErrors[] = [
185187
// identifier: argument.type
186188
'message' => '#^Parameter \\#1 \\$geoIpProvider of class Geocoder\\\\Provider\\\\GeoIP2\\\\GeoIP2Adapter constructor expects GeoIp2\\\\ProviderInterface, GeoIp2\\\\ProviderInterface\\|null given\\.$#',
187189
'count' => 1,
188-
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
190+
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
189191
];
190192
$ignoreErrors[] = [
191193
// identifier: argument.type
192194
'message' => '#^Parameter \\#2 \\$licenseKey of class GeoIp2\\\\WebService\\\\Client constructor expects string, string\\|null given\\.$#',
193195
'count' => 1,
194-
'path' => __DIR__ . '/src/ProviderFactory/GeoIP2Factory.php',
196+
'path' => __DIR__.'/src/ProviderFactory/GeoIP2Factory.php',
195197
];
196198

197199
return ['parameters' => ['ignoreErrors' => $ignoreErrors]];

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/Fixtures/Entity/DummyWithStringableGetter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#[Entity]
2727
#[Geocodeable]
28-
final class DummyWithStringableGetter
28+
class DummyWithStringableGetter
2929
{
3030
#[Id]
3131
#[GeneratedValue]

tests/Functional/Fixtures/Entity/StringableAddress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use Doctrine\ORM\Mapping\Embeddable;
1717

1818
#[Embeddable]
19-
final class StringableAddress implements \Stringable
19+
class StringableAddress implements \Stringable
2020
{
2121
public function __construct(
2222
#[Column]

0 commit comments

Comments
 (0)