Skip to content

Commit c66803e

Browse files
authored
Merge pull request #224 from kamilmusial/3.x
Symfony 6 support
2 parents 16e054d + c174c6e commit c66803e

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ jobs:
1515
fail-fast: false
1616
matrix:
1717
symfony-version:
18-
- '^4.4'
1918
- '^5.4'
19+
- '^6.0'
2020
php-version:
21-
- "7.4"
22-
- "8.0"
23-
- "8.1"
21+
- '8.1'
22+
- '8.2'
2423
dependencies:
2524
- "lowest"
2625
- "highest"

composer.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,19 @@
1515
}
1616
],
1717
"require": {
18-
"php": "^7.4 || ^8.0",
19-
"symfony/framework-bundle": "^4.4 || ^5.4 ",
20-
"symfony/intl": "^4.4 || ^5.4",
21-
"symfony/templating": "^4.4 || ^5.4 ",
22-
"symfony/validator": "^4.4 || ^5.4 ",
23-
"symfony/yaml": "^4.4 || ^5.4 ",
18+
"php": "^8.1",
19+
"symfony/framework-bundle": "^5.4 || ^6.0 ",
20+
"symfony/intl": "^5.4 || ^6.0",
21+
"symfony/templating": "^5.4 || ^6.0",
22+
"symfony/validator": "^5.4 || ^6.0",
23+
"symfony/yaml": "^5.4 || ^6.0",
2424
"psr/log": "^1.0 || ^2.0 || ^3.0"
2525
},
2626
"require-dev": {
2727
"symfony/phpunit-bridge": ">=5.4",
2828
"ext-intl": "*",
2929
"twig/twig": "^1.41 || ^2.0 || ^3.0",
30-
"symfony/form": "^4.4 || ^5.4",
30+
"symfony/form": "^5.4 || ^6.0",
3131
"symfony/flex": "^1.0 || ^2.0",
3232
"dg/bypass-finals": "^1.4"
3333
},
@@ -50,5 +50,11 @@
5050
"allow-contrib": true,
5151
"require": "^5.4"
5252
}
53+
},
54+
"scripts": {
55+
"auto-scripts": {
56+
"cache:clear": "symfony-cmd",
57+
"assets:install %PUBLIC_DIR%": "symfony-cmd"
58+
}
5359
}
5460
}

src/Form/Extension/ChoiceList/LocaleChoiceList.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
*/
2222
class LocaleChoiceList extends ArrayChoiceList
2323
{
24-
private $localeChoices;
25-
private $preferredChoices;
24+
private $localeChoices = [];
25+
private $preferredChoices = [];
2626

2727
/**
2828
* Construct the LocaleChoiceList
@@ -33,7 +33,6 @@ class LocaleChoiceList extends ArrayChoiceList
3333
*/
3434
public function __construct(LocaleInformation $information, $languagesOnly = true, $strictMode = false)
3535
{
36-
$this->localeChoices = array();
3736
$allowedLocales = $strictMode
3837
? $information->getAllowedLocalesFromConfiguration()
3938
: $information->getAllAllowedLanguages();

tests/Form/Extension/Type/LocaleTypeTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testConfigureOptions()
2727
$resolver
2828
->expects($this->once())
2929
->method('setDefaults')
30-
->with(array('choices' => null, 'preferred_choices' => null));
30+
->with(array('choices' => [], 'preferred_choices' => null));
3131

3232
$type = new LocaleType($choiceList);
3333
$type->configureOptions($resolver);
@@ -49,7 +49,10 @@ public function testGetName()
4949

5050
protected function getMockLocaleChoiceList()
5151
{
52-
return $this->createMock(LocaleChoiceList::class);
52+
$mockLocaleChoiceList = $this->createMock(LocaleChoiceList::class);
53+
$mockLocaleChoiceList->method('getOriginalKeys')->willReturn([]);
54+
55+
return $mockLocaleChoiceList;
5356
}
5457

5558
protected function getMockOptionsResolverInterface()

tests/Validator/BaseMetaValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
use PHPUnit\Framework\TestCase;
1818
use Symfony\Component\Config\FileLocator;
19+
use Symfony\Component\Validator\ConstraintValidatorInterface;
1920
use Symfony\Component\Validator\Validation;
2021
use Symfony\Component\Yaml\Parser as YamlParser;
2122

@@ -121,7 +122,7 @@ public function __construct(LocaleValidator $localeValidator, LocaleAllowedValid
121122
/**
122123
* {@inheritDoc}
123124
*/
124-
public function getInstance(Constraint $constraint)
125+
public function getInstance(Constraint $constraint): ConstraintValidatorInterface
125126
{
126127
$className = $constraint->validatedBy();
127128

0 commit comments

Comments
 (0)