Skip to content

Commit e91d669

Browse files
itaelleAugustin Pasquini
andauthored
Ready for Symfony 7
* Update symfony/intl version constraint to include 7.0 * Update Symfony packages to support version 7.0 * Update assoconnect/absolute-percent-value-bundle version * Sf7: fixing constraints & allowing ^6.4 --------- Co-authored-by: Augustin Pasquini <augustin.pasquini@assoconnect.com>
1 parent 5a44060 commit e91d669

9 files changed

Lines changed: 81 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
strategy:
1212
fail-fast: false
1313
matrix:
14-
php-versions: [ '8.2', '8.3' ]
14+
php-versions: [ '8.3' ]
1515
dependency-versions: [ 'highest', 'lowest' ]
1616
runs-on: ubuntu-latest
1717
steps:

composer.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,27 @@
3030
"require": {
3131
"doctrine/doctrine-bundle": "^2.12",
3232
"giggsey/libphonenumber-for-php": "^8.13",
33-
"php": "^8.2",
33+
"php": "^8.3",
3434
"symfony/http-kernel": "^6.4|^7.0",
35-
"symfony/validator": "^6.4",
35+
"symfony/validator": "^6.4|^7.0",
3636
"egulias/email-validator": "^3.2|^4.0",
37-
"symfony/property-access": "^6.4",
37+
"symfony/property-access": "^6.4|^7.0",
3838
"jeremykendall/php-domain-parser": "^6.0",
3939
"moneyphp/money": "^3.0|^4.0",
4040
"assoconnect/php-date": "^2.0",
4141
"doctrine/orm": "^2.7",
42-
"symfony/intl": "^5.0|^6.0",
42+
"symfony/intl": "^6.0|^7.0",
4343
"assoconnect/doctrine-types-bundle": "^v2.13",
4444
"assoconnect/php-percent":"^1.1",
45-
"assoconnect/absolute-percent-value-bundle": "^1.4",
45+
"assoconnect/absolute-percent-value-bundle": "^1.5",
4646
"webmozart/assert": "^1.11",
4747
"psr/simple-cache": "^1.0"
4848
},
4949
"require-dev": {
5050
"doctrine/cache": "~1.0",
51-
"symfony/phpunit-bridge": "^6.4.3",
52-
"symfony/framework-bundle": "^6.4",
53-
"symfony/yaml": "^6.4",
51+
"symfony/phpunit-bridge": "^6.4.3|^7.0",
52+
"symfony/framework-bundle": "^6.4|^7.0",
53+
"symfony/yaml": "^6.4|^7.0",
5454
"dg/bypass-finals": "^1.1",
5555
"assoconnect/php-quality-config": "^1.16",
5656
"guzzlehttp/guzzle": "^7.7",

phpstan-baseline.neon

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,17 +456,22 @@ parameters:
456456
path: src/Test/Functional/App/Entity/MyEntityParent.php
457457

458458
-
459-
message: "#^Public property `checkDNS` not marked as readonly\\.$#"
459+
message: "#^Method AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\Email\\:\\:__construct\\(\\) has parameter \\$normalizer with no signature specified for callable\\.$#"
460460
count: 1
461461
path: src/Validator/Constraints/Email.php
462462

463463
-
464-
message: "#^Public property `dnsMessage` not marked as readonly\\.$#"
464+
message: "#^Method AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\Email\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
465+
count: 1
466+
path: src/Validator/Constraints/Email.php
467+
468+
-
469+
message: "#^Public property `checkDNS` not marked as readonly\\.$#"
465470
count: 1
466471
path: src/Validator/Constraints/Email.php
467472

468473
-
469-
message: "#^Public property `mode` not marked as readonly\\.$#"
474+
message: "#^Public property `dnsMessage` not marked as readonly\\.$#"
470475
count: 1
471476
path: src/Validator/Constraints/Email.php
472477

@@ -480,6 +485,11 @@ parameters:
480485
count: 1
481486
path: src/Validator/Constraints/EmployerIdentificationNumber.php
482487

488+
-
489+
message: "#^Return type \\(string\\) of method AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\Entity\\:\\:getTargets\\(\\) should be covariant with return type \\('class'\\|'property'\\|array\\<'class'\\|'property'\\>\\) of method Symfony\\\\Component\\\\Validator\\\\Constraint\\:\\:getTargets\\(\\)$#"
490+
count: 1
491+
path: src/Validator/Constraints/Entity.php
492+
483493
-
484494
message: "#^Method AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\EntityValidator\\:\\:getFieldAttributes\\(\\) has parameter \\$reflectionClass with generic class ReflectionClass but does not specify its types\\: T$#"
485495
count: 1
@@ -495,6 +505,11 @@ parameters:
495505
count: 1
496506
path: src/Validator/Constraints/EntityValidator.php
497507

508+
-
509+
message: "#^Parameter \\#1 \\$constraints of class Symfony\\\\Component\\\\Validator\\\\Constraints\\\\All constructor expects array\\<Symfony\\\\Component\\\\Validator\\\\Constraint\\>\\|Symfony\\\\Component\\\\Validator\\\\Constraint\\|null, array\\<string, array\\<int, Symfony\\\\Component\\\\Validator\\\\Constraints\\\\Type\\>\\> given\\.$#"
510+
count: 1
511+
path: src/Validator/Constraints/EntityValidator.php
512+
498513
-
499514
message: "#^Class AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\FloatScale has an uninitialized property \\$scale\\. Give it default value or assign it in the constructor\\.$#"
500515
count: 1
@@ -516,12 +531,12 @@ parameters:
516531
path: src/Validator/Constraints/FrenchRna.php
517532

518533
-
519-
message: "#^Public property `message` not marked as readonly\\.$#"
534+
message: "#^Method AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\FrenchSiren\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
520535
count: 1
521536
path: src/Validator/Constraints/FrenchSiren.php
522537

523538
-
524-
message: "#^Public property `message` not marked as readonly\\.$#"
539+
message: "#^Method AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\FrenchSiret\\:\\:__construct\\(\\) has parameter \\$options with no value type specified in iterable type array\\.$#"
525540
count: 1
526541
path: src/Validator/Constraints/FrenchSiret.php
527542

@@ -649,3 +664,13 @@ parameters:
649664
message: "#^Missing native return typehint float$#"
650665
count: 2
651666
path: src/Validator/ConstraintsSetProvider/Field/IntegerProvider.php
667+
668+
-
669+
message: "#^Parameter \\#1 \\$array1 of static method AssoConnect\\\\ValidatorBundle\\\\Test\\\\ConstraintValidatorTestCase\\<AssoConnect\\\\ValidatorBundle\\\\Validator\\\\Constraints\\\\EntityValidator\\>\\:\\:assertArrayContainsSameObjects\\(\\) expects array, array\\|Symfony\\\\Component\\\\Validator\\\\Constraint given\\.$#"
670+
count: 1
671+
path: tests/Validator/Constraints/EntityValidatorTest.php
672+
673+
-
674+
message: "#^Parameter \\#1 \\$constraints of class Symfony\\\\Component\\\\Validator\\\\Constraints\\\\All constructor expects array\\<Symfony\\\\Component\\\\Validator\\\\Constraint\\>\\|Symfony\\\\Component\\\\Validator\\\\Constraint\\|null, array\\<string, array\\<int, Symfony\\\\Component\\\\Validator\\\\Constraints\\\\Type\\>\\> given\\.$#"
675+
count: 1
676+
path: tests/Validator/Constraints/EntityValidatorTest.php

phpstan.neon.dist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ parameters:
22
paths:
33
- src/
44
- tests/
5+
reportUnmatchedIgnoredErrors: false
56
exceptions:
67
uncheckedExceptionClasses:
78
- 'Symfony\Component\Validator\Exception\ConstraintDefinitionException'

src/Test/ConstraintValidatorTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace AssoConnect\ValidatorBundle\Test;
66

77
use Symfony\Component\Validator\Constraint;
8-
use Symfony\Component\Validator\Constraints\ExpressionLanguageSyntax;
8+
use Symfony\Component\Validator\Constraints\NotBlank;
99
use Symfony\Component\Validator\ConstraintValidator;
1010
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
1111
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase as SymfonyConstraintValidatorTestCase;
@@ -32,7 +32,7 @@ protected static function assertArrayContainsSameObjects(array $array1, array $a
3232
public function testUnknownConstraintThrowsAnException(): void
3333
{
3434
$this->expectException(UnexpectedTypeException::class);
35-
$this->validator->validate(0, new ExpressionLanguageSyntax());
35+
$this->validator->validate(0, new NotBlank());
3636
}
3737

3838
/**

src/Validator/Constraints/Email.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ class Email extends _Email
1818
public string $tldMessage = 'The value {{ domain }} is not a valid domain name.';
1919
public string $dnsMessage = 'The domain {{ domain }} is not setup to received emails.';
2020

21-
/** @var mixed */
22-
public $mode = 'strict';
23-
2421
public bool $checkDNS = false;
22+
23+
public function __construct(
24+
?array $options = null,
25+
?string $message = null,
26+
?string $mode = null,
27+
?callable $normalizer = null,
28+
?array $groups = null,
29+
mixed $payload = null,
30+
) {
31+
parent::__construct($options, $message, $mode, $normalizer, $groups, $payload);
32+
$this->mode ??= 'strict';
33+
}
2534
}

src/Validator/Constraints/EmailValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class EmailValidator extends _EmailValidator
2626

2727
public function __construct(
2828
PublicSuffixListClient $publicSuffixListClient,
29-
string $defaultMode = _Email::VALIDATION_MODE_LOOSE
29+
string $defaultMode = 'html5'
3030
) {
3131
parent::__construct($defaultMode);
3232
$this->publicSuffixListClient = $publicSuffixListClient;

src/Validator/Constraints/FrenchSiren.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ class FrenchSiren extends Luhn
1414
{
1515
public const INVALID_FORMAT_ERROR = '4d762774-3g50-4bd5-a6d5-b10a3299d8d3';
1616

17-
/** @var mixed */
18-
public $message = 'The value {{ value }} is not a valid SIREN number.';
17+
public function __construct(
18+
?array $options = null,
19+
?string $message = null,
20+
?array $groups = null,
21+
mixed $payload = null,
22+
) {
23+
parent::__construct(
24+
$options,
25+
$message ?? 'The value {{ value }} is not a valid SIREN number.',
26+
$groups,
27+
$payload,
28+
);
29+
}
1930
}

src/Validator/Constraints/FrenchSiret.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ class FrenchSiret extends Luhn
1414
{
1515
public const INVALID_FORMAT_ERROR = 'cbe06561-776e-45c2-b33c-a73141746d43';
1616

17-
/** @var mixed */
18-
public $message = 'The value {{ value }} is not a valid SIRET number.';
17+
public function __construct(
18+
?array $options = null,
19+
?string $message = null,
20+
?array $groups = null,
21+
mixed $payload = null,
22+
) {
23+
parent::__construct(
24+
$options,
25+
$message ?? 'The value {{ value }} is not a valid SIRET number.',
26+
$groups,
27+
$payload,
28+
);
29+
}
1930
}

0 commit comments

Comments
 (0)