Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Allow Symfony 6 #319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 34 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,22 @@ jobs:
max-parallel: 10
fail-fast: true
matrix:
php: ['7.3', '7.4', '8.0']
sf_version: ['4.4.*', '5.2.*', '5.3.*']
strategy: ['default']
php: ['7.3', '7.4', '8.0', '8.1']
include:
- php: '7.3'
sf_version: '4.4.*'
strategy: 'lowest'
- php: '7.4'
sf_version: '5.4.*'
- php: '8.0'
sf_version: '5.4.*'
- php: '8.1'
sf_version: '5.4.*'
- php: '8.0'
sf_version: '6.0.*'
- php: '8.1'
sf_version: '6.0.*'
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
Expand All @@ -66,37 +80,14 @@ jobs:
- name: "Checkout code"
uses: actions/checkout@v2

- name: "Install Composer dependencies"
- name: "Install Composer dependencies (default)"
if: matrix.strategy != 'lowest'
env:
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
run: composer update --no-interaction --optimize-autoloader

- name: "Run tests"
env:
SYMFONY_DEPRECATIONS_HELPER: 'max[self]=2'
run: ./vendor/bin/simple-phpunit -v --testsuite main

phpunit-lowest:
name: "PHPUnit (Lowest)"
runs-on: ubuntu-latest
strategy:
max-parallel: 10
fail-fast: true
matrix:
php: ['7.4']
sf_version: ['4.4.*', '5.2.*', '5.3.*']
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer:v2, flex
coverage: none

- name: "Checkout code"
uses: actions/checkout@v2

- name: "Install Composer dependencies"
- name: "Install Composer dependencies (lowest)"
if: matrix.strategy == 'lowest'
env:
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
run: composer update --no-interaction --prefer-stable --prefer-lowest --optimize-autoloader
Expand All @@ -113,8 +104,20 @@ jobs:
max-parallel: 10
fail-fast: true
matrix:
php: ['7.3', '7.4', '8.0']
sf_version: ['4.4.*', '5.2.*', '5.3.*']
php: ['7.4', '8.0', '8.1']
include:
- php: '7.4'
sf_version: '4.4.*'
- php: '7.4'
sf_version: '5.4.*'
- php: '8.0'
sf_version: '5.4.*'
- php: '8.1'
sf_version: '5.4.*'
- php: '8.0'
sf_version: '6.0.*'
- php: '8.1'
sf_version: '6.0.*'
steps:
- name: "Setup PHP"
uses: shivammathur/setup-php@v2
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

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

## Version 5.16.1

### Fixed

- Allow Symfony 6

## Version 5.16.0

### Added
Expand Down
2 changes: 2 additions & 0 deletions Command/GeocodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ protected function configure()

/**
* {@inheritdoc}
*
* @return int
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
Expand Down
4 changes: 2 additions & 2 deletions DependencyInjection/BazingaGeocoderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function load(array $configs, ContainerBuilder $container)
$definition->replaceArgument(2, $config['fake_ip']['use_faker']);

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

/**
* {@inheritdoc}
* @return Configuration
*/
public function getConfiguration(array $config, ContainerBuilder $container)
{
Expand Down
2 changes: 2 additions & 0 deletions Doctrine/ORM/GeocoderListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ public function __construct(Provider $geocoder, DriverInterface $driver)

/**
* {@inheritdoc}
*
* @return array
*/
public function getSubscribedEvents()
{
Expand Down
3 changes: 2 additions & 1 deletion Plugin/FakeIpPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Geocoder\Plugin\Plugin;
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\Query;
use Http\Promise\Promise;

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

/**
* {@inheritdoc}
* @return Promise
*/
public function handleQuery(Query $query, callable $next, callable $first)
{
Expand Down
4 changes: 4 additions & 0 deletions Plugin/ProfilingPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use Geocoder\Query\GeocodeQuery;
use Geocoder\Query\Query;
use Geocoder\Query\ReverseQuery;
use Http\Promise\Promise;

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

/**
* @return Promise
*/
public function handleQuery(Query $query, callable $next, callable $first)
{
$startTime = microtime(true);
Expand Down
2 changes: 1 addition & 1 deletion Resources/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ bazinga_geocoder:
ip: 123.123.123.123
```

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

```yaml
bazinga_geocoder:
Expand Down
4 changes: 2 additions & 2 deletions Tests/Command/GeocodeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GeocodeCommandTest extends TestCase
{
private static $address = '10 rue Gambetta, Paris, France';

public function testExecute()
public function testExecute(): void
{
$coordinates = new Coordinates(1, 2);
$country = new Country('France', 'FR');
Expand All @@ -59,7 +59,7 @@ public function testExecute()

$kernel->expects($this->any())
->method('getContainer')
->will($this->returnValue($container));
->willReturn($container);

$kernel->expects($this->any())
->method('getBundles')
Expand Down
7 changes: 2 additions & 5 deletions Tests/DependencyInjection/Compiler/AddProvidersPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,22 @@
use Geocoder\ProviderAggregator;
use Http\Client\Curl\Client;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;

class AddProvidersPassTest extends TestCase
{
use SetUpTearDownTrait;

/**
* @var AddProvidersPass
*/
private $compilerPass;

protected function doSetUp()
protected function setUp(): void
{
$this->compilerPass = new AddProvidersPass();
}

public function testRegistersProviders()
public function testRegistersProviders(): void
{
$containerBuilder = new ContainerBuilder();
$containerBuilder->setDefinition(ProviderAggregator::class, new Definition(ProviderAggregator::class));
Expand Down
13 changes: 5 additions & 8 deletions Tests/DependencyInjection/Compiler/FactoryValidatorPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@

use Bazinga\GeocoderBundle\DependencyInjection\Compiler\FactoryValidatorPass;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;

class FactoryValidatorPassTest extends TestCase
{
use SetUpTearDownTrait;

/**
* @var FactoryValidatorPass
*/
Expand All @@ -32,22 +29,22 @@ class FactoryValidatorPassTest extends TestCase
*/
private $factoryId;

protected function doSetUp()
protected function setUp(): void
{
$this->compilerPass = new FactoryValidatorPass();
$this->factoryId = 'dummy_factory_id';
$this->compilerPass::addFactoryServiceId($this->factoryId);
}

protected function doTearDown()
protected function tearDown(): void
{
$reflection = new \ReflectionObject($this->compilerPass);
$prop = $reflection->getProperty('factoryServiceIds');
$prop->setAccessible(true);
$prop->setValue([]);
}

public function testProcessThrows()
public function testProcessThrows(): void
{
$this->expectException(ServiceNotFoundException::class);
$this->expectExceptionMessage("Factory with ID \"$this->factoryId\" could not be found");
Expand All @@ -65,7 +62,7 @@ public function testProcessThrows()
$this->compilerPass->process($container);
}

public function testProcessDoesntThrowIfAliasExists()
public function testProcessDoesntThrowIfAliasExists(): void
{
$container = $this->createMock(ContainerBuilder::class);
$container->expects($this->once())
Expand All @@ -80,7 +77,7 @@ public function testProcessDoesntThrowIfAliasExists()
$this->compilerPass->process($container);
}

public function testProcessDoesntThrowIfDefinitionExists()
public function testProcessDoesntThrowIfDefinitionExists(): void
{
$container = $this->createMock(ContainerBuilder::class);
$container->expects($this->once())
Expand Down
7 changes: 2 additions & 5 deletions Tests/DependencyInjection/Compiler/ProfilerPassTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,23 @@
use Bazinga\GeocoderBundle\DependencyInjection\Compiler\ProfilerPass;
use Bazinga\GeocoderBundle\Plugin\ProfilingPlugin;
use PHPUnit\Framework\TestCase;
use Symfony\Bridge\PhpUnit\SetUpTearDownTrait;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;

class ProfilerPassTest extends TestCase
{
use SetUpTearDownTrait;

/**
* @var ProfilerPass
*/
private $compilerPass;

protected function doSetUp()
protected function setUp(): void
{
$this->compilerPass = new ProfilerPass();
}

public function testRegistersProviders()
public function testRegistersProviders(): void
{
$geocoderDataCollectorDefinition = new Definition(GeocoderDataCollector::class);

Expand Down
4 changes: 2 additions & 2 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
class ConfigurationTest extends TestCase
{
public function testGetConfigTreeBuilder()
public function testGetConfigTreeBuilder(): void
{
$config = Yaml::parse(file_get_contents(__DIR__.'/Fixtures/config.yml'));

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

public function testGetConfigTreeBuilderNoDebug()
public function testGetConfigTreeBuilderNoDebug(): void
{
$config = Yaml::parse(file_get_contents(__DIR__.'/Fixtures/config.yml'));

Expand Down
Loading