Skip to content

Commit 523a9ad

Browse files
authored
Merge branch 'master' into patch-1
2 parents 3080319 + b601378 commit 523a9ad

File tree

81 files changed

+715
-1363
lines changed

Some content is hidden

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

81 files changed

+715
-1363
lines changed

.editorconfig

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,18 @@ indent_style = space
88
insert_final_newline = true
99
trim_trailing_whitespace = true
1010

11-
[*.{yml,yaml}]
11+
[.github/**/*.{yml,yaml}]
1212
indent_size = 2
13+
14+
[*.{yml,yaml}]
15+
trim_trailing_whitespace = false
16+
17+
[**.md]
18+
indent_size = unset
19+
indent_style = unset
20+
21+
[*.json]
22+
insert_final_newline = false
23+
24+
[*.{neon,neon.dist}]
25+
indent_style = tab

.github/workflows/ci.yml

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,15 @@ jobs:
6262
max-parallel: 10
6363
fail-fast: false
6464
matrix:
65-
php: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
66-
sf_version: [ '5.4.*', '6.4.*', '7.2.*', '7.3.*' ]
65+
php: [ '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
66+
sf_version: [ '6.4.*', '7.2.*', '7.3.*' ]
6767
exclude:
68-
- php: '7.4'
69-
sf_version: '6.4.*'
7068
- php: '8.0'
7169
sf_version: '6.4.*'
72-
- php: '7.4'
73-
sf_version: '7.2.*'
7470
- php: '8.0'
7571
sf_version: '7.2.*'
7672
- php: '8.1'
7773
sf_version: '7.2.*'
78-
- php: '7.4'
79-
sf_version: '7.3.*'
8074
- php: '8.0'
8175
sf_version: '7.3.*'
8276
- php: '8.1'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
composer.lock
22
phpunit.xml
3+
/config/reference.php
34
vendor/
45
.php-cs-fixer.cache
56
.phpunit.result.cache

.php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
->setRules([
1010
'@Symfony' => true,
1111
'no_superfluous_phpdoc_tags' => false,
12+
'phpdoc_to_comment' => ['ignored_tags' => ['var']], // phpstan errors pops up without this
1213
])
1314
->setFinder($finder)
1415
;

composer.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,17 @@
1414
}
1515
],
1616
"require": {
17-
"php": "^7.4 || ^8.0",
17+
"php": "^8.1",
1818
"geocoder-php/plugin": "^1.5",
19-
"php-http/curl-client": "^2.3",
2019
"php-http/discovery": "^1.14",
2120
"symfony/console": "^5.4 || ^6.4 || ^7.0",
2221
"symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0",
2322
"symfony/options-resolver": "^5.4 || ^6.4 || ^7.0",
2423
"willdurand/geocoder": "^4.6|^5.0"
2524
},
2625
"require-dev": {
27-
"doctrine/annotations": "^1.11.1 || ^2.0",
2826
"doctrine/doctrine-bundle": "^2.3",
29-
"doctrine/orm": "^2.8 || ^3.0",
27+
"doctrine/orm": "^2.20 || ^3.0",
3028
"fakerphp/faker": "^1.20",
3129
"friendsofphp/php-cs-fixer": "^3.13",
3230
"geocoder-php/algolia-places-provider": "^0.4",
@@ -62,21 +60,17 @@
6260
"nyholm/nsa": "^1.3",
6361
"nyholm/psr7": "^1.5",
6462
"nyholm/symfony-bundle-test": "^2.0 || ^3.0",
65-
"php-http/message": "^1.13",
66-
"php-http/mock-client": "^1.6",
6763
"phpstan/phpstan": "^1.9.2",
6864
"psr/http-client": "^1.0",
6965
"psr/simple-cache": "^1.0 || ^2.0",
7066
"symfony/cache": "^5.4 || ^6.4 || ^7.0",
7167
"symfony/config": "^5.4 || ^6.4 || ^7.0",
68+
"symfony/http-client": "^5.4 || ^6.4 || ^7.0",
7269
"symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.0",
7370
"symfony/validator": "^5.4 || ^6.4 || ^7.0",
7471
"symfony/var-exporter": "^5.4 || ^6.4 || ^7.0",
7572
"symfony/yaml": "^5.4 || ^6.4 || ^7.0"
7673
},
77-
"conflict": {
78-
"geocoder-php/nominatim-provider": "<5.0"
79-
},
8074
"autoload": {
8175
"psr-4": {
8276
"Bazinga\\GeocoderBundle\\": "src/"
@@ -88,7 +82,7 @@
8882
}
8983
},
9084
"scripts": {
91-
"test": "vendor/bin/simple-phpunit --testsuite main"
85+
"test": "SYMFONY_DEPRECATIONS_HELPER=ignoreFile='./tests/baseline-ignore' vendor/bin/simple-phpunit --testsuite main"
9286
},
9387
"config": {
9488
"allow-plugins": {
@@ -101,7 +95,7 @@
10195
"prefer-stable": true,
10296
"extra": {
10397
"branch-alias": {
104-
"dev-master": "5.0-dev"
98+
"dev-master": "6.0-dev"
10599
}
106100
}
107101
}

config/profiling.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
6+
7+
use Bazinga\GeocoderBundle\DataCollector\GeocoderDataCollector;
8+
9+
return static function (ContainerConfigurator $container) {
10+
$services = $container->services();
11+
12+
$services->set(GeocoderDataCollector::class)
13+
->tag('data_collector', ['template' => '@BazingaGeocoder/Collector/geocoder.html.twig', 'id' => 'geocoder']);
14+
};

config/profiling.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

config/services.php

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
6+
7+
use Bazinga\GeocoderBundle\Command\GeocodeCommand;
8+
use Bazinga\GeocoderBundle\Plugin\FakeIpPlugin;
9+
use Bazinga\GeocoderBundle\Validator\Constraint\AddressValidator;
10+
use Geocoder\Dumper\Dumper;
11+
use Geocoder\Dumper\GeoArray;
12+
use Geocoder\Dumper\GeoJson;
13+
use Geocoder\Dumper\Gpx;
14+
use Geocoder\Dumper\Kml;
15+
use Geocoder\Dumper\Wkb;
16+
use Geocoder\Dumper\Wkt;
17+
use Geocoder\ProviderAggregator;
18+
19+
return static function (ContainerConfigurator $container) {
20+
$services = $container->services();
21+
$services->instanceof(Dumper::class)
22+
->public();
23+
24+
$services
25+
->set(GeoArray::class)
26+
->set(GeoJson::class)
27+
->set(Gpx::class)
28+
->set(Kml::class)
29+
->set(Wkb::class)
30+
->set(Wkt::class)
31+
32+
->load('Bazinga\\GeocoderBundle\\ProviderFactory\\', __DIR__.'/../src/ProviderFactory')
33+
->autowire()
34+
->autoconfigure()
35+
36+
->set(ProviderAggregator::class)
37+
38+
->set(FakeIpPlugin::class)
39+
->args([null, null, false])
40+
41+
->set(GeocodeCommand::class)
42+
->args([
43+
service(ProviderAggregator::class),
44+
])
45+
->tag('console.command')
46+
47+
->set(AddressValidator::class)
48+
->args([
49+
service(ProviderAggregator::class),
50+
])
51+
->tag('validator.constraint_validator')
52+
;
53+
};

config/services.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

doc/doctrine.md

Lines changed: 13 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,18 @@ First of all, update your entity:
1010

1111
```php
1212

13-
use Bazinga\GeocoderBundle\Mapping\Annotations as Geocoder;
13+
use Bazinga\GeocoderBundle\Mapping\Attributes as Geocoder;
1414

15-
/**
16-
* @Geocoder\Geocodeable
17-
*/
15+
#[Geocoder\Geocodeable()]
1816
class User
1917
{
20-
/**
21-
* @Geocoder\Address
22-
*/
18+
#[Geocoder\Address()]
2319
private $address;
2420

25-
/**
26-
* @Geocoder\Latitude
27-
*/
21+
#[Geocoder\Latitude()]
2822
private $latitude;
2923

30-
/**
31-
* @Geocoder\Longitude
32-
*/
24+
#[Geocoder\Longitude()]
3325
private $longitude;
3426
}
3527
```
@@ -38,47 +30,36 @@ Instead of annotating a property, you can also annotate a getter:
3830

3931
```php
4032

41-
use Bazinga\GeocoderBundle\Mapping\Annotations as Geocoder;
33+
use Bazinga\GeocoderBundle\Mapping\Attributes as Geocoder;
4234

43-
/**
44-
* @Geocoder\Geocodeable
45-
*/
35+
#[Geocoder\Geocodeable()]
4636
class User
4737
{
48-
/**
49-
* @Geocoder\Latitude
50-
*/
38+
#[Geocoder\Latitude()]
5139
private $latitude;
5240

53-
/**
54-
* @Geocoder\Longitude
55-
*/
41+
#[Geocoder\Longitude()]
5642
private $longitude;
5743

58-
/**
59-
* @Geocoder\Address
60-
*/
44+
#[Geocoder\Address()]
6145
public function getAddress(): string
6246
{
6347
// Your code...
6448
}
6549
}
6650
```
6751

68-
Secondly, register the Doctrine event listener and its dependencies in your `config/services.yaml` file.
52+
Secondly, register the Doctrine event listener and its dependencies in your `config/services.yaml` or `config/services.php` file.
6953
You have to indicate which provider to use to reverse geocode the address. Here we use `acme` provider we declared in bazinga_geocoder configuration earlier.
7054

7155
```yaml
72-
Bazinga\GeocoderBundle\Mapping\Driver\AnnotationDriver:
73-
class: Bazinga\GeocoderBundle\Mapping\Driver\AnnotationDriver
74-
arguments:
75-
- '@annotations.reader'
56+
Bazinga\GeocoderBundle\Mapping\Driver\AttributeDriver: ~
7657

7758
Bazinga\GeocoderBundle\Doctrine\ORM\GeocoderListener:
7859
class: Bazinga\GeocoderBundle\Doctrine\ORM\GeocoderListener
7960
arguments:
8061
- '@bazinga_geocoder.provider.acme'
81-
- '@Bazinga\GeocoderBundle\Mapping\Driver\AnnotationDriver'
62+
- '@Bazinga\GeocoderBundle\Mapping\Driver\AttributeDriver'
8263
tags:
8364
- { name: doctrine.event_listener, event: onFlush }
8465
```
@@ -96,40 +77,3 @@ $em->flush();
9677
echo $user->getLatitude(); // will output 52.516325
9778
echo $user->getLongitude(); // will output 13.377264
9879
```
99-
100-
## PHP 8
101-
102-
If you are using PHP 8, you can use [Attributes](https://www.php.net/manual/en/language.attributes.overview.php) in your entity:
103-
104-
```php
105-
106-
use Bazinga\GeocoderBundle\Mapping\Annotations as Geocoder;
107-
108-
#[Geocoder\Geocodeable()]
109-
class User
110-
{
111-
#[Geocoder\Address()]
112-
private $address;
113-
114-
#[Geocoder\Latitude()]
115-
private $latitude;
116-
117-
#[Geocoder\Longitude()]
118-
private $longitude;
119-
}
120-
```
121-
122-
Then update your service configuration to register the `AttributeDriver`:
123-
124-
```yaml
125-
Bazinga\GeocoderBundle\Mapping\Driver\AttributeDriver:
126-
class: Bazinga\GeocoderBundle\Mapping\Driver\AttributeDriver
127-
128-
Bazinga\GeocoderBundle\Doctrine\ORM\GeocoderListener:
129-
class: Bazinga\GeocoderBundle\Doctrine\ORM\GeocoderListener
130-
arguments:
131-
- '@bazinga_geocoder.provider.acme'
132-
- '@Bazinga\GeocoderBundle\Mapping\Driver\AttributeDriver'
133-
tags:
134-
- { name: doctrine.event_listener, event: onFlush }
135-
```

0 commit comments

Comments
 (0)