Skip to content

Commit c9318d5

Browse files
authored
Merge pull request #319 from norkunas/sf6
Allow Symfony 6
2 parents b9a62fd + b19dee6 commit c9318d5

25 files changed

+298
-201
lines changed

.github/workflows/ci.yml

+34-31
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,22 @@ jobs:
5353
max-parallel: 10
5454
fail-fast: true
5555
matrix:
56-
php: ['7.3', '7.4', '8.0']
57-
sf_version: ['4.4.*', '5.2.*', '5.3.*']
56+
strategy: ['default']
57+
php: ['7.3', '7.4', '8.0', '8.1']
58+
include:
59+
- php: '7.3'
60+
sf_version: '4.4.*'
61+
strategy: 'lowest'
62+
- php: '7.4'
63+
sf_version: '5.4.*'
64+
- php: '8.0'
65+
sf_version: '5.4.*'
66+
- php: '8.1'
67+
sf_version: '5.4.*'
68+
- php: '8.0'
69+
sf_version: '6.0.*'
70+
- php: '8.1'
71+
sf_version: '6.0.*'
5872
steps:
5973
- name: "Setup PHP"
6074
uses: shivammathur/setup-php@v2
@@ -66,37 +80,14 @@ jobs:
6680
- name: "Checkout code"
6781
uses: actions/checkout@v2
6882

69-
- name: "Install Composer dependencies"
83+
- name: "Install Composer dependencies (default)"
84+
if: matrix.strategy != 'lowest'
7085
env:
7186
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
7287
run: composer update --no-interaction --optimize-autoloader
7388

74-
- name: "Run tests"
75-
env:
76-
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
77-
run: ./vendor/bin/simple-phpunit -v --testsuite main
78-
79-
phpunit-lowest:
80-
name: "PHPUnit (Lowest)"
81-
runs-on: ubuntu-latest
82-
strategy:
83-
max-parallel: 10
84-
fail-fast: true
85-
matrix:
86-
php: ['7.4']
87-
sf_version: ['4.4.*', '5.2.*', '5.3.*']
88-
steps:
89-
- name: "Setup PHP"
90-
uses: shivammathur/setup-php@v2
91-
with:
92-
php-version: ${{ matrix.php }}
93-
tools: composer:v2, flex
94-
coverage: none
95-
96-
- name: "Checkout code"
97-
uses: actions/checkout@v2
98-
99-
- name: "Install Composer dependencies"
89+
- name: "Install Composer dependencies (lowest)"
90+
if: matrix.strategy == 'lowest'
10091
env:
10192
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
10293
run: composer update --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader
@@ -113,8 +104,20 @@ jobs:
113104
max-parallel: 10
114105
fail-fast: true
115106
matrix:
116-
php: ['7.3', '7.4', '8.0']
117-
sf_version: ['4.4.*', '5.2.*', '5.3.*']
107+
php: ['7.4', '8.0', '8.1']
108+
include:
109+
- php: '7.4'
110+
sf_version: '4.4.*'
111+
- php: '7.4'
112+
sf_version: '5.4.*'
113+
- php: '8.0'
114+
sf_version: '5.4.*'
115+
- php: '8.1'
116+
sf_version: '5.4.*'
117+
- php: '8.0'
118+
sf_version: '6.0.*'
119+
- php: '8.1'
120+
sf_version: '6.0.*'
118121
steps:
119122
- name: "Setup PHP"
120123
uses: shivammathur/setup-php@v2

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
The changelog describes what have been "Added", "Changed", "Removed" or "Fixed" between versions.
44

5+
## Version 5.16.1
6+
7+
### Fixed
8+
9+
- Allow Symfony 6
10+
511
## Version 5.16.0
612

713
### Added

Command/GeocodeCommand.php

+2
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ protected function configure()
6262

6363
/**
6464
* {@inheritdoc}
65+
*
66+
* @return int
6567
*/
6668
protected function execute(InputInterface $input, OutputInterface $output)
6769
{

DependencyInjection/BazingaGeocoderExtension.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function load(array $configs, ContainerBuilder $container)
5959
$definition->replaceArgument(2, $config['fake_ip']['use_faker']);
6060

6161
if ($config['fake_ip']['use_faker'] && !class_exists(Generator::class)) {
62-
throw new \LogicException('To enable this option, you must install fzaninotto/faker package.');
62+
throw new \LogicException('To enable this option, you must install fakerphp/faker package.');
6363
}
6464
} else {
6565
$container->removeDefinition(FakeIpPlugin::class);
@@ -173,7 +173,7 @@ public function configureProviderPlugins(ContainerBuilder $container, array $con
173173
}
174174

175175
/**
176-
* {@inheritdoc}
176+
* @return Configuration
177177
*/
178178
public function getConfiguration(array $config, ContainerBuilder $container)
179179
{

Doctrine/ORM/GeocoderListener.php

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public function __construct(Provider $geocoder, DriverInterface $driver)
4444

4545
/**
4646
* {@inheritdoc}
47+
*
48+
* @return array
4749
*/
4850
public function getSubscribedEvents()
4951
{

Plugin/FakeIpPlugin.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Geocoder\Plugin\Plugin;
1818
use Geocoder\Query\GeocodeQuery;
1919
use Geocoder\Query\Query;
20+
use Http\Promise\Promise;
2021

2122
/**
2223
* Replace local IP with something better.
@@ -52,7 +53,7 @@ public function __construct(?string $needle, string $replacement = null, bool $u
5253
}
5354

5455
/**
55-
* {@inheritdoc}
56+
* @return Promise
5657
*/
5758
public function handleQuery(Query $query, callable $next, callable $first)
5859
{

Plugin/ProfilingPlugin.php

+4
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Geocoder\Query\GeocodeQuery;
2020
use Geocoder\Query\Query;
2121
use Geocoder\Query\ReverseQuery;
22+
use Http\Promise\Promise;
2223

2324
/**
2425
* @author Tobias Nyholm <[email protected]>
@@ -40,6 +41,9 @@ public function __construct(string $name)
4041
$this->name = $name;
4142
}
4243

44+
/**
45+
* @return Promise
46+
*/
4347
public function handleQuery(Query $query, callable $next, callable $first)
4448
{
4549
$startTime = microtime(true);

Resources/doc/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ bazinga_geocoder:
215215
ip: 123.123.123.123
216216
```
217217

218-
You can also let [Faker](https://github.com/fzaninotto/Faker) generate fake ip for you.
218+
You can also let [Faker](https://github.com/fakerphp/faker) generate fake ip for you.
219219

220220
```yaml
221221
bazinga_geocoder:

Tests/Command/GeocodeCommandTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class GeocodeCommandTest extends TestCase
3232
{
3333
private static $address = '10 rue Gambetta, Paris, France';
3434

35-
public function testExecute()
35+
public function testExecute(): void
3636
{
3737
$coordinates = new Coordinates(1, 2);
3838
$country = new Country('France', 'FR');
@@ -59,7 +59,7 @@ public function testExecute()
5959

6060
$kernel->expects($this->any())
6161
->method('getContainer')
62-
->will($this->returnValue($container));
62+
->willReturn($container);
6363

6464
$kernel->expects($this->any())
6565
->method('getBundles')

Tests/DependencyInjection/Compiler/AddProvidersPassTest.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,22 @@
1717
use Geocoder\ProviderAggregator;
1818
use Http\Client\Curl\Client;
1919
use PHPUnit\Framework\TestCase;
20-
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
2120
use Symfony\Component\DependencyInjection\ContainerBuilder;
2221
use Symfony\Component\DependencyInjection\Definition;
2322

2423
class AddProvidersPassTest extends TestCase
2524
{
26-
use SetUpTearDownTrait;
27-
2825
/**
2926
* @var AddProvidersPass
3027
*/
3128
private $compilerPass;
3229

33-
protected function doSetUp()
30+
protected function setUp(): void
3431
{
3532
$this->compilerPass = new AddProvidersPass();
3633
}
3734

38-
public function testRegistersProviders()
35+
public function testRegistersProviders(): void
3936
{
4037
$containerBuilder = new ContainerBuilder();
4138
$containerBuilder->setDefinition(ProviderAggregator::class, new Definition(ProviderAggregator::class));

Tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php

+5-8
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,11 @@
1414

1515
use Bazinga\GeocoderBundle\DependencyInjection\Compiler\FactoryValidatorPass;
1616
use PHPUnit\Framework\TestCase;
17-
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
1817
use Symfony\Component\DependencyInjection\ContainerBuilder;
1918
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
2019

2120
class FactoryValidatorPassTest extends TestCase
2221
{
23-
use SetUpTearDownTrait;
24-
2522
/**
2623
* @var FactoryValidatorPass
2724
*/
@@ -32,22 +29,22 @@ class FactoryValidatorPassTest extends TestCase
3229
*/
3330
private $factoryId;
3431

35-
protected function doSetUp()
32+
protected function setUp(): void
3633
{
3734
$this->compilerPass = new FactoryValidatorPass();
3835
$this->factoryId = 'dummy_factory_id';
3936
$this->compilerPass::addFactoryServiceId($this->factoryId);
4037
}
4138

42-
protected function doTearDown()
39+
protected function tearDown(): void
4340
{
4441
$reflection = new \ReflectionObject($this->compilerPass);
4542
$prop = $reflection->getProperty('factoryServiceIds');
4643
$prop->setAccessible(true);
4744
$prop->setValue([]);
4845
}
4946

50-
public function testProcessThrows()
47+
public function testProcessThrows(): void
5148
{
5249
$this->expectException(ServiceNotFoundException::class);
5350
$this->expectExceptionMessage("Factory with ID \"$this->factoryId\" could not be found");
@@ -65,7 +62,7 @@ public function testProcessThrows()
6562
$this->compilerPass->process($container);
6663
}
6764

68-
public function testProcessDoesntThrowIfAliasExists()
65+
public function testProcessDoesntThrowIfAliasExists(): void
6966
{
7067
$container = $this->createMock(ContainerBuilder::class);
7168
$container->expects($this->once())
@@ -80,7 +77,7 @@ public function testProcessDoesntThrowIfAliasExists()
8077
$this->compilerPass->process($container);
8178
}
8279

83-
public function testProcessDoesntThrowIfDefinitionExists()
80+
public function testProcessDoesntThrowIfDefinitionExists(): void
8481
{
8582
$container = $this->createMock(ContainerBuilder::class);
8683
$container->expects($this->once())

Tests/DependencyInjection/Compiler/ProfilerPassTest.php

+2-5
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,23 @@
1616
use Bazinga\GeocoderBundle\DependencyInjection\Compiler\ProfilerPass;
1717
use Bazinga\GeocoderBundle\Plugin\ProfilingPlugin;
1818
use PHPUnit\Framework\TestCase;
19-
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
2019
use Symfony\Component\DependencyInjection\ContainerBuilder;
2120
use Symfony\Component\DependencyInjection\Definition;
2221
use Symfony\Component\DependencyInjection\Reference;
2322

2423
class ProfilerPassTest extends TestCase
2524
{
26-
use SetUpTearDownTrait;
27-
2825
/**
2926
* @var ProfilerPass
3027
*/
3128
private $compilerPass;
3229

33-
protected function doSetUp()
30+
protected function setUp(): void
3431
{
3532
$this->compilerPass = new ProfilerPass();
3633
}
3734

38-
public function testRegistersProviders()
35+
public function testRegistersProviders(): void
3936
{
4037
$geocoderDataCollectorDefinition = new Definition(GeocoderDataCollector::class);
4138

Tests/DependencyInjection/ConfigurationTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
class ConfigurationTest extends TestCase
2424
{
25-
public function testGetConfigTreeBuilder()
25+
public function testGetConfigTreeBuilder(): void
2626
{
2727
$config = Yaml::parse(file_get_contents(__DIR__.'/Fixtures/config.yml'));
2828

@@ -38,7 +38,7 @@ public function testGetConfigTreeBuilder()
3838
$this->assertSame('33.33.33.11', $config['fake_ip']['ip']);
3939
}
4040

41-
public function testGetConfigTreeBuilderNoDebug()
41+
public function testGetConfigTreeBuilderNoDebug(): void
4242
{
4343
$config = Yaml::parse(file_get_contents(__DIR__.'/Fixtures/config.yml'));
4444

0 commit comments

Comments
 (0)