Skip to content

Commit

Permalink
Merge pull request #354 from norkunas/fix-deprecation
Browse files Browse the repository at this point in the history
Fix deprecation and CS
  • Loading branch information
norkunas committed May 22, 2024
2 parents 7024d70 + 8d7ec63 commit 0e1b7eb
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 653 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v4

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--optimize-autoloader"

Expand All @@ -47,7 +47,7 @@ jobs:
uses: actions/checkout@v4

- name: "Install Composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--optimize-autoloader"

Expand All @@ -64,13 +64,13 @@ jobs:
dependencies: ['highest']
php: [ '7.4', '8.0', '8.1', '8.2' ]
sf_version: [ '4.4.*', '5.4.*', '6.4.*', '7.0.*' ]
include:
- php: '7.4'
sf_version: '4.4.*'
dependencies: 'lowest'
- php: '7.4'
sf_version: '5.4.*'
dependencies: 'lowest'
# include:
# - php: '7.4'
# sf_version: '4.4.*'
# dependencies: 'lowest'
# - php: '7.4'
# sf_version: '5.4.*'
# dependencies: 'lowest'
exclude:
- php: '7.4'
sf_version: '4.4.*'
Expand Down Expand Up @@ -98,12 +98,12 @@ jobs:
- name: "Install Composer dependencies"
env:
SYMFONY_REQUIRE: ${{ matrix.sf_version }}
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
composer-options: "--optimize-autoloader"
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run tests"
env:
SYMFONY_DEPRECATIONS_HELPER: 'baselineFile=./tests/allowed.json'
SYMFONY_DEPRECATIONS_HELPER: 'ignoreFile=./tests/baseline-ignore'
run: ./vendor/bin/simple-phpunit -v
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"psr/simple-cache": "^1.0 || ^2.0",
"symfony/cache": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/config": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^5.2 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^6.1",
"symfony/validator": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/var-exporter": "^5.0 || ^6.0 || ^7.0",
"symfony/yaml": "^4.4 || ^5.0 || ^6.0 || ^7.0"
Expand Down
7 changes: 1 addition & 6 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ parameters:
count: 1
path: src/DependencyInjection/BazingaGeocoderExtension.php

-
message: "#^Cannot cast mixed to int\\.$#"
count: 2
path: src/DependencyInjection/BazingaGeocoderExtension.php

-
message: "#^Cannot cast mixed to string\\.$#"
count: 1
Expand All @@ -82,7 +77,7 @@ parameters:

-
message: "#^Parameter \\#1 \\$id of class Symfony\\\\Component\\\\DependencyInjection\\\\Reference constructor expects string, mixed given\\.$#"
count: 3
count: 1
path: src/DependencyInjection/BazingaGeocoderExtension.php

-
Expand Down
2 changes: 1 addition & 1 deletion src/DataCollector/GeocoderDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public function reset()
/**
* @return void
*/
public function collect(Request $request, Response $response, \Throwable $exception = null)
public function collect(Request $request, Response $response, ?\Throwable $exception = null)
{
if (!empty($this->data['queries'])) {
// To avoid collection more that once.
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/BazingaGeocoderExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* @author William Durand <[email protected]>.
Expand Down
2 changes: 1 addition & 1 deletion src/Plugin/FakeIpPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FakeIpPlugin implements Plugin
private ?string $replacement;
private ?Generator $faker = null;

public function __construct(?string $needle, string $replacement = null, bool $useFaker = false)
public function __construct(?string $needle, ?string $replacement = null, bool $useFaker = false)
{
$this->needle = $needle;
$this->replacement = $replacement;
Expand Down
2 changes: 1 addition & 1 deletion src/ProviderFactory/AbstractFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ abstract class AbstractFactory implements ProviderFactoryInterface

protected ?ClientInterface $httpClient;

public function __construct(ClientInterface $httpClient = null)
public function __construct(?ClientInterface $httpClient = null)
{
$this->httpClient = $httpClient;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Validator/Constraint/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Address extends Constraint
/**
* @param string[]|null $options
*/
public function __construct(array $options = null, string $message = null, array $groups = null, $payload = null)
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, $payload = null)
{
parent::__construct($options, $groups, $payload);

Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/CustomTestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function getKernelParameters(): array
/**
* @internal
*/
public function setAnnotatedClassCache(array $annotatedClasses)
public function setAnnotatedClassCache(array $annotatedClasses): void
{
file_put_contents(($this->warmupDir ?: $this->getBuildDir()).'/annotations.map', sprintf('<?php return %s;', var_export($annotatedClasses, true)));
}
Expand All @@ -91,7 +91,7 @@ public function setAnnotatedClassCache(array $annotatedClasses)
* The built version of the service container is used when fresh, otherwise the
* container is built.
*/
protected function initializeContainer()
protected function initializeContainer(): void
{
$class = $this->getContainerClass();
$buildDir = $this->warmupDir ?: $this->getBuildDir();
Expand Down
11 changes: 11 additions & 0 deletions tests/Functional/GeocoderListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\StreamInterface;
use Symfony\Bridge\Doctrine\ArgumentResolver\EntityValueResolver;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel;
Expand Down Expand Up @@ -78,6 +79,16 @@ protected static function createKernel(array $options = []): KernelInterface
],
]);
}

if (class_exists(EntityValueResolver::class)) {
$container->prependExtensionConfig('doctrine', [
'orm' => [
'controller_resolver' => [
'auto_mapping' => false,
],
],
]);
}
});
}
$kernel->handleOptions($options);
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Helper/CacheHelperV8.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function get(string $key, mixed $default = null): mixed
{
}

public function set(string $key, mixed $value, int|\DateInterval $ttl = null): bool
public function set(string $key, mixed $value, int|\DateInterval|null $ttl = null): bool
{
return true;
}
Expand All @@ -43,7 +43,7 @@ public function getMultiple(iterable $keys, mixed $default = null): iterable
return [];
}

public function setMultiple(iterable $values, int|\DateInterval $ttl = null): bool
public function setMultiple(iterable $values, int|\DateInterval|null $ttl = null): bool
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Functional/config/listener.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ doctrine:
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
auto_mapping: false

bazinga_geocoder:
profiling:
Expand Down
Loading

0 comments on commit 0e1b7eb

Please sign in to comment.