Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25a5149

Browse files
Upgrade to PHP 7.4
PHP 7.4 is minimum supported version. zlikavac32/php-enum had to be upgraded as well. Symfony 3 is no longer supported and minimum version is 4.4
1 parent 10ee248 commit 25a5149

File tree

9 files changed

+44
-47
lines changed

9 files changed

+44
-47
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
vendor/
22
composer.lock
33
phpunit.xml
4+
.phpunit.result.cache

‎.travis.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@ install: composer update $COMPOSER_FLAGS
1313
matrix:
1414
include:
1515
-
16-
php: 7.2
16+
php: 7.4
1717
-
18-
php: 7.2
19-
env: COMPOSER_FLAGS='--prefer-lowest'
20-
-
21-
php: 7.3
22-
-
23-
php: 7.3
18+
php: 7.4
2419
env: COMPOSER_FLAGS='--prefer-lowest'
2520
-
2621
php: nightly

‎CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# PHP-Enum Symfony changelog
22

3+
## Unreleased
4+
5+
* **[CHANGED]** Minimum supported `zlikavac32/php-enum` version is 3.0.0
6+
* **[CHANGED]** Minimum supported PHP version is 7.4
7+
38
## 0.5.0 (2019年03月26日)
49

510
* **[ADDED]** Support for `zlikavac32/php-enum:^2.0`

‎composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
],
1313
"minimum-stability": "stable",
1414
"require": {
15-
"php": ">=7.2",
16-
"zlikavac32/php-enum": "^1.3 || ^2.0",
17-
"symfony/form": "^3.3 || ^4.0",
18-
"symfony/options-resolver": "^3.3 || ^4.0",
19-
"symfony/validator": "^3.3 || ^4.0"
15+
"php": ">=7.4",
16+
"zlikavac32/php-enum": "^3.0",
17+
"symfony/form": "^4.4",
18+
"symfony/options-resolver": "^4.4",
19+
"symfony/validator": "^4.4"
2020
},
2121
"require-dev": {
22-
"phpunit/phpunit": "^7.0"
22+
"phpunit/phpunit": "^8.2"
2323
},
2424
"autoload": {
2525
"psr-4": {

‎src/Validator/Constraints/AbstractEnumConstraint.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
abstract class AbstractEnumConstraint extends Choice
1515
{
1616
/**
17-
* @var string|Enum
17+
* @var string|Enum Although this will contain string, Zlikavac32\Enum\Enum is hinted so that static calls to
18+
* this property can also be statically resolved
1819
*/
19-
public $enumClass;
20+
public ?string$enumClass = null;
2021

2122
public function __construct(Closure $callback, $options = null)
2223
{

‎tests/Form/Type/EnumTypeTest.php

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@
1616
class EnumTypeTest extends TypeTestCase
1717
{
1818

19-
/**
20-
* @expectedException LogicException
21-
* @expectedExceptionMessage Option choices is overridden by the type so don't pass your own value
22-
*/
2319
public function testThatPassingChoicesOptionThrowsException(): void
2420
{
21+
$this->expectException(LogicException::class);
22+
$this->expectExceptionMessage('Option choices is overridden by the type so don\'t pass your own value');
23+
2524
$this->factory->create(
2625
EnumType::class,
2726
null,
@@ -32,12 +31,11 @@ public function testThatPassingChoicesOptionThrowsException(): void
3231
);
3332
}
3433

35-
/**
36-
* @expectedException LogicException
37-
* @expectedExceptionMessage Option choice_loader is overridden by the type so don't pass your own value
38-
*/
3934
public function testThatPassingChoiceLoaderOptionThrowsException(): void
4035
{
36+
$this->expectException(LogicException::class);
37+
$this->expectExceptionMessage('Option choice_loader is overridden by the type so don\'t pass your own value');
38+
4139
$this->factory->create(
4240
EnumType::class,
4341
null,
@@ -48,12 +46,11 @@ public function testThatPassingChoiceLoaderOptionThrowsException(): void
4846
);
4947
}
5048

51-
/**
52-
* @expectedException LogicException
53-
* @expectedExceptionMessage stdClass does not have Zlikavac32\Enum\Enum as it's parent
54-
*/
5549
public function testThatEnumClassMustBeValid(): void
5650
{
51+
$this->expectException(LogicException::class);
52+
$this->expectExceptionMessage('stdClass does not have Zlikavac32\Enum\Enum as it\'s parent');
53+
5754
$this->factory->create(
5855
EnumType::class,
5956
null,

‎tests/Validator/Constraints/AbstractEnumConstraintTest.php

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,28 @@
1313

1414
class AbstractEnumConstraintTest extends TestCase
1515
{
16-
/**
17-
* @expectedException LogicException
18-
* @expectedExceptionMessage Enum class can not be null
19-
*/
16+
2017
public function testThatEnumClassCanNotBeNull(): void
2118
{
19+
$this->expectException(LogicException::class);
20+
$this->expectExceptionMessage('Enum class can not be null');
21+
2222
$this->create(null);
2323
}
2424

25-
/**
26-
* @expectedException LogicException
27-
* @expectedExceptionMessage stdClass does not have Zlikavac32\Enum\Enum as it's parent
28-
*/
2925
public function testThatEnumClassMustHaveEnumAsItsParent(): void
3026
{
27+
$this->expectException(LogicException::class);
28+
$this->expectExceptionMessage('stdClass does not have Zlikavac32\Enum\Enum as it\'s parent');
29+
3130
$this->create(stdClass::class);
3231
}
3332

34-
/**
35-
* @expectedException LogicException
36-
* @expectedExceptionMessage Key choices is overridden internally so it should not be set from the outside
37-
*/
3833
public function testThatChoicesOptionMustNotBeSet(): void
3934
{
35+
$this->expectException(LogicException::class);
36+
$this->expectExceptionMessage('Key choices is overridden internally so it should not be set from the outside');
37+
4038
$this->create(
4139
[
4240
'choices' => [
@@ -46,12 +44,11 @@ public function testThatChoicesOptionMustNotBeSet(): void
4644
);
4745
}
4846

49-
/**
50-
* @expectedException LogicException
51-
* @expectedExceptionMessage Key callback is overridden internally so it should not be set from the outside
52-
*/
5347
public function testThatCallbackOptionMustNotBeSet(): void
5448
{
49+
$this->expectException(LogicException::class);
50+
$this->expectExceptionMessage('Key callback is overridden internally so it should not be set from the outside');
51+
5552
$this->create(
5653
[
5754
'callback' => function () {
@@ -60,12 +57,11 @@ public function testThatCallbackOptionMustNotBeSet(): void
6057
);
6158
}
6259

63-
/**
64-
* @expectedException LogicException
65-
* @expectedExceptionMessage Key strict is overridden internally so it should not be set from the outside
66-
*/
6760
public function testThatStrictOptionMustNotBeSet(): void
6861
{
62+
$this->expectException(LogicException::class);
63+
$this->expectExceptionMessage('Key strict is overridden internally so it should not be set from the outside');
64+
6965
$this->create(
7066
[
7167
'strict' => false,

‎tests/Validator/Constraints/ValidEnumElementNameTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public function testThatInvalidInstanceBuildsViolation()
5757

5858
$this->buildViolation('The value you selected is not a valid choice.')
5959
->setParameter('{{ value }}', '"MAYBE"')
60+
->setParameter('{{ choices }}', '"NO", "YES"')
6061
->setCode(ValidEnumElementName::NO_SUCH_CHOICE_ERROR)
6162
->assertRaised();
6263
}

‎tests/Validator/Constraints/ValidEnumElementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function testThatInvalidInstanceBuildsViolation()
5656

5757
$this->buildViolation('The value you selected is not a valid choice.')
5858
->setParameter('{{ value }}', 'object')
59+
->setParameter('{{ choices }}', 'object, object')
5960
->setCode(ValidEnumElement::NO_SUCH_CHOICE_ERROR)
6061
->assertRaised();
6162
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /