Skip to content

Commit

Permalink
Merge 3.x into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Mar 12, 2023
2 parents 944a129 + e47e346 commit 87d132d
Show file tree
Hide file tree
Showing 28 changed files with 155 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2, composer-normalize:2
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -54,7 +54,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -65,7 +65,7 @@ jobs:
composer-options: --prefer-dist --prefer-stable

- name: Psalm
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.1
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.2

rector:
name: Rector
Expand All @@ -79,7 +79,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/symfony-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -54,7 +54,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -79,7 +79,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand All @@ -104,7 +104,7 @@ jobs:
- name: Install PHP with extensions
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'
coverage: none
tools: composer:v2

Expand Down
23 changes: 6 additions & 17 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
Expand All @@ -39,31 +38,21 @@ jobs:
symfony-require: ['']
variant: [normal]
include:
- php-version: '7.4'
- php-version: '8.0'
dependencies: lowest
allowed-to-fail: false
variant: normal
- php-version: '8.1'
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 4.4.*
variant: symfony/symfony:"4.4.*"
- php-version: '8.1'
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 5.4.*
variant: symfony/symfony:"5.4.*"
- php-version: '8.1'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.0.*
variant: symfony/symfony:"6.0.*"
- php-version: '8.1'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.1.*
variant: symfony/symfony:"6.1.*"
- php-version: '8.1'
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.2.*
Expand Down Expand Up @@ -103,6 +92,6 @@ jobs:
run: make coverage

- name: Send coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
file: build/logs/clover.xml
files: build/logs/clover.xml
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ phpstan:
.PHONY: phpstan

psalm:
vendor/bin/psalm --php-version=8.1
vendor/bin/psalm --php-version=8.2
.PHONY: psalm

rector:
Expand Down
35 changes: 18 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@
],
"homepage": "https://docs.sonata-project.org/projects/SonataTranslationBundle",
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0",
"sonata-project/admin-bundle": "^4.14",
"sonata-project/block-bundle": "^4.11",
"symfony/config": "^4.4 || ^5.4 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0",
"symfony/form": "^4.4 || ^5.4 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
"symfony/intl": "^4.4 || ^5.4 || ^6.0",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.0",
"symfony/config": "^4.4 || ^5.4 || ^6.2",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.2",
"symfony/form": "^4.4 || ^5.4 || ^6.2",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.2",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.2",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.2",
"symfony/intl": "^4.4 || ^5.4 || ^6.2",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.2",
"twig/twig": "^2.12 || ^3.0"
},
"require-dev": {
"doctrine/doctrine-bundle": "^2.4",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-fixtures-bundle": "^3.4",
"doctrine/orm": "^2.8",
"doctrine/orm": "^2.14",
"doctrine/persistence": "^2.0 || ^3.0",
"friendsofphp/php-cs-fixer": "^3.4",
"gedmo/doctrine-extensions": "^3.0",
"gedmo/doctrine-extensions": "^3.11",
"knplabs/doctrine-behaviors": "^2.2",
"matthiasnoback/symfony-config-test": "^4.2",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
Expand All @@ -54,16 +54,17 @@
"psalm/plugin-symfony": "^4.0",
"rector/rector": "^0.15",
"sonata-project/doctrine-orm-admin-bundle": "^4.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.0",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.0",
"symfony/phpunit-bridge": "^6.1",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.2",
"symfony/css-selector": "^4.4 || ^5.4 || ^6.2",
"symfony/doctrine-bridge": "^4.4.48 || ^5.4 || ^6.2",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.2",
"symfony/phpunit-bridge": "^6.2",
"vimeo/psalm": "^4.3.2",
"weirdan/doctrine-psalm-plugin": "^2.0"
},
"conflict": {
"doctrine/persistence": "<2.0",
"gedmo/doctrine-extensions": "<3.0",
"gedmo/doctrine-extensions": "<3.11",
"knplabs/doctrine-behaviors": "<2.2 || >=3.0"
},
"suggest": {
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_74,
LevelSetList::UP_TO_PHP_80,
]);

$rectorConfig->importNames();
Expand Down
12 changes: 4 additions & 8 deletions src/Admin/Extension/AbstractTranslatableAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,10 @@ abstract class AbstractTranslatableAdminExtension extends AbstractAdminExtension

protected ?string $translatableLocale = null;

protected TranslatableChecker $translatableChecker;

private LocaleProviderInterface $localeProvider;

public function __construct(TranslatableChecker $translatableChecker, LocaleProviderInterface $localeProvider)
{
$this->translatableChecker = $translatableChecker;
$this->localeProvider = $localeProvider;
public function __construct(
protected TranslatableChecker $translatableChecker,
private LocaleProviderInterface $localeProvider
) {
}

public function configurePersistentParameters(AdminInterface $admin, array $parameters): array
Expand Down
13 changes: 3 additions & 10 deletions src/Admin/Extension/Gedmo/TranslatableAdminExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,13 @@
*/
final class TranslatableAdminExtension extends AbstractTranslatableAdminExtension
{
private TranslatableListener $translatableListener;

private ManagerRegistry $managerRegistry;

public function __construct(
TranslatableChecker $translatableChecker,
TranslatableListener $translatableListener,
ManagerRegistry $managerRegistry,
private TranslatableListener $translatableListener,
private ManagerRegistry $managerRegistry,
LocaleProviderInterface $localeProvider
) {
parent::__construct($translatableChecker, $localeProvider);

$this->translatableListener = $translatableListener;
$this->managerRegistry = $managerRegistry;
}

public function alterNewInstance(AdminInterface $admin, object $object): void
Expand Down Expand Up @@ -89,7 +82,7 @@ private function setLocale(object $object): void
if (!isset($configuration['locale'])) {
throw new \LogicException(sprintf(
'There is no locale or language property found on class: "%s"',
\get_class($object)
$object::class
));
}

Expand Down
9 changes: 4 additions & 5 deletions src/Block/LocaleSwitcherBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
*/
final class LocaleSwitcherBlockService extends AbstractBlockService
{
private LocaleProviderInterface $localeProvider;

public function __construct(Environment $twig, LocaleProviderInterface $localeProvider)
{
public function __construct(
Environment $twig,
private LocaleProviderInterface $localeProvider
) {
parent::__construct($twig);
$this->localeProvider = $localeProvider;
}

public function configureSettings(OptionsResolver $resolver): void
Expand Down
5 changes: 1 addition & 4 deletions src/EventSubscriber/LocaleSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
*/
final class LocaleSubscriber implements EventSubscriberInterface
{
private string $defaultLocale;

public function __construct(string $defaultLocale = 'en')
public function __construct(private string $defaultLocale = 'en')
{
$this->defaultLocale = $defaultLocale;
}

public function onKernelRequest(RequestEvent $event): void
Expand Down
5 changes: 1 addition & 4 deletions src/Filter/TranslationFieldFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,8 @@

final class TranslationFieldFilter extends Filter
{
private string $filterMode;

public function __construct(string $filterMode = TranslationFilterMode::GEDMO)
public function __construct(private string $filterMode = TranslationFilterMode::GEDMO)
{
$this->filterMode = $filterMode;
}

public function filter(ProxyQueryInterface $query, string $alias, string $field, FilterData $data): void
Expand Down
15 changes: 3 additions & 12 deletions src/Provider/Knplabs/LocaleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,11 @@

final class LocaleProvider implements KnpLocaleProviderInterface
{
private RequestStack $requestStack;

private KnpLocaleProviderInterface $localeProvider;

private SonataLocaleProviderInterface $sonataLocaleProvider;

public function __construct(
RequestStack $requestStack,
KnpLocaleProviderInterface $localeProvider,
SonataLocaleProviderInterface $sonataLocaleProvider
private RequestStack $requestStack,
private KnpLocaleProviderInterface $localeProvider,
private SonataLocaleProviderInterface $sonataLocaleProvider
) {
$this->requestStack = $requestStack;
$this->localeProvider = $localeProvider;
$this->sonataLocaleProvider = $sonataLocaleProvider;
}

public function provideCurrentLocale(): ?string
Expand Down
12 changes: 4 additions & 8 deletions src/Provider/RequestLocaleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@

final class RequestLocaleProvider implements LocaleProviderInterface
{
private RequestStack $requestStack;

private string $defaultTranslationLocale;

private ?string $translatableLocale = null;

public function __construct(RequestStack $requestStack, string $defaultTranslationLocale)
{
$this->requestStack = $requestStack;
$this->defaultTranslationLocale = $defaultTranslationLocale;
public function __construct(
private RequestStack $requestStack,
private string $defaultTranslationLocale
) {
}

public function get(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Twig/Extension/IntlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function getLanguageName(string $language, string $locale): string
{
try {
return Languages::getName($language, $locale);
} catch (MissingResourceException $exception) {
} catch (MissingResourceException) {
return $language;
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/Twig/Extension/SonataTranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,8 @@
*/
final class SonataTranslationExtension extends AbstractExtension
{
protected TranslatableChecker $translatableChecker;

public function __construct(TranslatableChecker $translatableChecker)
public function __construct(protected TranslatableChecker $translatableChecker)
{
$this->translatableChecker = $translatableChecker;
}

public function setTranslatableChecker(TranslatableChecker $translatableChecker): void
Expand Down
4 changes: 2 additions & 2 deletions tests/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ protected function configureContainer(ContainerBuilder $container, LoaderInterfa
'auto_mapping' => true,
'mappings' => [
'tests' => [
'type' => 'annotation',
'type' => 'attribute',
'dir' => '%kernel.project_dir%/Entity',
'is_bundle' => false,
'prefix' => 'Sonata\TranslationBundle\Tests\App\Entity',
],
'gedmo_translatable' => [
'type' => 'annotation',
'type' => 'attribute',
'prefix' => 'Gedmo\Translatable\Entity',
'dir' => '%kernel.project_dir%/../../vendor/gedmo/doctrine-extensions/src/Translatable/Entity',
'is_bundle' => false,
Expand Down

0 comments on commit 87d132d

Please sign in to comment.