Skip to content

Commit a888538

Browse files
committed
Add types declarations
1 parent 06c094c commit a888538

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+94
-188
lines changed

src/BazingaGeocoderBundle.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@
2323
*/
2424
class BazingaGeocoderBundle extends Bundle
2525
{
26-
/**
27-
* @return void
28-
*/
29-
public function build(ContainerBuilder $container)
26+
public function build(ContainerBuilder $container): void
3027
{
3128
parent::build($container);
3229

src/Command/GeocodeCommand.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@ public function __construct(ProviderAggregator $geocoder)
3434
parent::__construct();
3535
}
3636

37-
/**
38-
* @return void
39-
*/
40-
protected function configure()
37+
protected function configure(): void
4138
{
4239
$this
4340
->setName('geocoder:geocode')

src/DataCollector/GeocoderDataCollector.php

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,14 @@ public function __construct()
3434
$this->data['providers'] = [];
3535
}
3636

37-
/**
38-
* @return void
39-
*/
40-
public function reset()
37+
public function reset(): void
4138
{
4239
$this->instances = [];
4340
$this->data['queries'] = [];
4441
$this->data['providers'] = [];
4542
}
4643

47-
/**
48-
* @return void
49-
*/
50-
public function collect(Request $request, Response $response, \Throwable $exception = null)
44+
public function collect(Request $request, Response $response, \Throwable $exception = null): void
5145
{
5246
if (!empty($this->data['queries'])) {
5347
// To avoid collection more that once.
@@ -101,15 +95,10 @@ public function getProviders(): array
10195
*/
10296
public function getProviderQueries(string $provider): array
10397
{
104-
return array_filter($this->data['queries'], static function ($data) use ($provider) {
105-
return $data['providerName'] === $provider;
106-
});
98+
return array_filter($this->data['queries'], static fn ($data): bool => $data['providerName'] === $provider);
10799
}
108100

109-
/**
110-
* @return void
111-
*/
112-
public function addInstance(ProfilingPlugin $instance)
101+
public function addInstance(ProfilingPlugin $instance): void
113102
{
114103
$this->instances[] = $instance;
115104
$this->data['providers'][] = $instance->getName();

src/DependencyInjection/BazingaGeocoderExtension.php

Lines changed: 3 additions & 7 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);
@@ -78,10 +76,8 @@ public function load(array $configs, ContainerBuilder $container)
7876

7977
/**
8078
* @param array<mixed, mixed> $config
81-
*
82-
* @return void
8379
*/
84-
private function loadProviders(ContainerBuilder $container, array $config)
80+
private function loadProviders(ContainerBuilder $container, array $config): void
8581
{
8682
foreach ($config['providers'] as $providerName => $providerConfig) {
8783
try {
@@ -181,7 +177,7 @@ public function configureProviderPlugins(ContainerBuilder $container, array $con
181177
->addTag('bazinga_geocoder.profiling_plugin');
182178
}
183179

184-
return array_map(static fn (string $id) => new Reference($id), $plugins);
180+
return array_map(static fn (string $id): Reference => new Reference($id), $plugins);
185181
}
186182

187183
/**

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: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,9 @@ class FactoryValidatorPass implements CompilerPassInterface
2626
/**
2727
* @var string[]
2828
*/
29-
private static $factoryServiceIds = [];
29+
private static array $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)) {
@@ -40,12 +37,7 @@ public function process(ContainerBuilder $container)
4037
}
4138
}
4239

43-
/**
44-
* @param string $factoryServiceId
45-
*
46-
* @return void
47-
*/
48-
public static function addFactoryServiceId($factoryServiceId)
40+
public static function addFactoryServiceId(string $factoryServiceId): void
4941
{
5042
self::$factoryServiceIds[] = $factoryServiceId;
5143
}

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/DependencyInjection/Configuration.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,7 @@ public function getConfigTreeBuilder(): TreeBuilder
5656
->arrayNode('fake_ip')
5757
->beforeNormalization()
5858
->ifString()
59-
->then(function ($value) {
60-
return ['ip' => $value];
61-
})
59+
->then(fn ($value): array => ['ip' => $value])
6260
->end()
6361
->canBeEnabled()
6462
->children()
@@ -73,10 +71,7 @@ public function getConfigTreeBuilder(): TreeBuilder
7371
return $treeBuilder;
7472
}
7573

76-
/**
77-
* @return ArrayNodeDefinition
78-
*/
79-
private function getProvidersNode()
74+
private function getProvidersNode(): ArrayNodeDefinition
8075
{
8176
$treeBuilder = new TreeBuilder('providers');
8277
$rootNode = $treeBuilder->getRootNode();
@@ -111,10 +106,8 @@ private function getProvidersNode()
111106

112107
/**
113108
* Create plugin node of a client.
114-
*
115-
* @return ArrayNodeDefinition The plugin node
116109
*/
117-
private function createClientPluginNode()
110+
private function createClientPluginNode(): ArrayNodeDefinition
118111
{
119112
$treeBuilder = new TreeBuilder('plugins');
120113
$rootNode = $treeBuilder->getRootNode();

src/Doctrine/ORM/GeocoderListener.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ public function getSubscribedEvents(): array
4545
];
4646
}
4747

48-
/**
49-
* @return void
50-
*/
51-
public function onFlush(OnFlushEventArgs $args)
48+
public function onFlush(OnFlushEventArgs $args): void
5249
{
5350
$em = method_exists($args, 'getObjectManager') ? $args->getObjectManager() : $args->getEntityManager();
5451
$uow = $em->getUnitOfWork();
@@ -92,10 +89,8 @@ public function onFlush(OnFlushEventArgs $args)
9289

9390
/**
9491
* @param object $entity
95-
*
96-
* @return void
9792
*/
98-
private function geocodeEntity(ClassMetadata $metadata, $entity)
93+
private function geocodeEntity(ClassMetadata $metadata, $entity): void
9994
{
10095
if (null !== $metadata->addressGetter) {
10196
$address = $metadata->addressGetter->invoke($entity);

src/Mapping/ClassMetadata.php

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,11 @@
1717
*/
1818
class ClassMetadata
1919
{
20-
/**
21-
* @var \ReflectionProperty
22-
*/
23-
public $addressProperty;
20+
public \ReflectionProperty $addressProperty;
2421

25-
/**
26-
* @var \ReflectionProperty
27-
*/
28-
public $latitudeProperty;
22+
public \ReflectionProperty $latitudeProperty;
2923

30-
/**
31-
* @var \ReflectionProperty
32-
*/
33-
public $longitudeProperty;
24+
public \ReflectionProperty $longitudeProperty;
3425

35-
/**
36-
* @var \ReflectionMethod
37-
*/
38-
public $addressGetter;
26+
public ?\ReflectionMethod $addressGetter = null;
3927
}

0 commit comments

Comments
 (0)