Skip to content

Commit dcd60fd

Browse files
committed
Allow Symfony 6
1 parent b9a62fd commit dcd60fd

20 files changed

+170
-147
lines changed

.github/workflows/ci.yml

+77-58
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,20 @@ 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+
# sf_version: '6.0.*'
67+
- php: '8.1'
68+
sf_version: '5.4.*'
69+
# sf_version: '6.0.*'
5870
steps:
5971
- name: "Setup PHP"
6072
uses: shivammathur/setup-php@v2
@@ -66,37 +78,14 @@ jobs:
6678
- name: "Checkout code"
6779
uses: actions/checkout@v2
6880

69-
- name: "Install Composer dependencies"
81+
- name: "Install Composer dependencies (default)"
82+
if: matrix.strategy != 'lowest'
7083
env:
7184
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
7285
run: composer update --no-interaction --optimize-autoloader
7386

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"
87+
- name: "Install Composer dependencies (lowest)"
88+
if: matrix.strategy == 'lowest'
10089
env:
10190
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
10291
run: composer update --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader
@@ -106,32 +95,62 @@ jobs:
10695
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
10796
run: ./vendor/bin/simple-phpunit -v --testsuite main
10897

109-
doctrine:
110-
name: "PHPUnit (Doctrine)"
111-
runs-on: ubuntu-latest
112-
strategy:
113-
max-parallel: 10
114-
fail-fast: true
115-
matrix:
116-
php: ['7.3', '7.4', '8.0']
117-
sf_version: ['4.4.*', '5.2.*', '5.3.*']
118-
steps:
119-
- name: "Setup PHP"
120-
uses: shivammathur/setup-php@v2
121-
with:
122-
php-version: ${{ matrix.php }}
123-
tools: composer:v2, flex
124-
coverage: none
125-
126-
- name: "Checkout code"
127-
uses: actions/checkout@v2
128-
129-
- name: "Install Composer dependencies"
130-
env:
131-
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
132-
run: composer update --prefer-source --no-interaction --optimize-autoloader
133-
134-
- name: "Run tests"
135-
env:
136-
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
137-
run: ./vendor/bin/simple-phpunit -v --testsuite doctrine
98+
# phpunit-lowest:
99+
# name: "PHPUnit (Lowest)"
100+
# runs-on: ubuntu-latest
101+
# strategy:
102+
# max-parallel: 10
103+
# fail-fast: true
104+
# matrix:
105+
# php: ['7.4']
106+
# sf_version: ['4.4.*', '5.3.*', '5.4.*', '6.0.*']
107+
# steps:
108+
# - name: "Setup PHP"
109+
# uses: shivammathur/setup-php@v2
110+
# with:
111+
# php-version: ${{ matrix.php }}
112+
# tools: composer:v2, flex
113+
# coverage: none
114+
#
115+
# - name: "Checkout code"
116+
# uses: actions/checkout@v2
117+
#
118+
# - name: "Install Composer dependencies"
119+
# env:
120+
# SYMFONY_REQUIRE: ${{ matrix.sf_version }}
121+
# run: composer update --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader
122+
#
123+
# - name: "Run tests"
124+
# env:
125+
# SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
126+
# run: ./vendor/bin/simple-phpunit -v --testsuite main
127+
#
128+
# doctrine:
129+
# name: "PHPUnit (Doctrine)"
130+
# runs-on: ubuntu-latest
131+
# strategy:
132+
# max-parallel: 10
133+
# fail-fast: true
134+
# matrix:
135+
# php: ['7.3', '7.4', '8.0', '8.1']
136+
# sf_version: ['4.4.*', '5.3.*', '5.4.*', '6.0.*']
137+
# steps:
138+
# - name: "Setup PHP"
139+
# uses: shivammathur/setup-php@v2
140+
# with:
141+
# php-version: ${{ matrix.php }}
142+
# tools: composer:v2, flex
143+
# coverage: none
144+
#
145+
# - name: "Checkout code"
146+
# uses: actions/checkout@v2
147+
#
148+
# - name: "Install Composer dependencies"
149+
# env:
150+
# SYMFONY_REQUIRE: ${{ matrix.sf_version }}
151+
# run: composer update --prefer-source --no-interaction --optimize-autoloader
152+
#
153+
# - name: "Run tests"
154+
# env:
155+
# SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
156+
# run: ./vendor/bin/simple-phpunit -v --testsuite doctrine

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -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
{

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);

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)