Skip to content

Commit cc5d719

Browse files
Merge branch '6.2' of github.com:darkwebdesign/symfony-addon-pack
2 parents bb73611 + 0e8d793 commit cc5d719

File tree

8 files changed

+45
-58
lines changed

8 files changed

+45
-58
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
[![Total Downloads](https://poser.pugx.org/darkwebdesign/symfony-addon-constraints/downloads?format=flat)](https://packagist.org/packages/darkwebdesign/symfony-addon-constraints)
55
[![License](https://poser.pugx.org/darkwebdesign/symfony-addon-constraints/license?format=flat)](https://packagist.org/packages/darkwebdesign/symfony-addon-constraints)
66

7-
[![Build Status](https://github.com/darkwebdesign/symfony-addon-constraints/actions/workflows/build.yaml/badge.svg?branch=6.1)](https://github.com/darkwebdesign/symfony-addon-constraints/actions/workflows/build.yaml)
8-
[![Coverage Status](https://codecov.io/gh/darkwebdesign/symfony-addon-constraints/branch/6.1/graph/badge.svg)](https://codecov.io/gh/darkwebdesign/symfony-addon-constraints)
7+
[![Build Status](https://github.com/darkwebdesign/symfony-addon-constraints/actions/workflows/build.yaml/badge.svg?branch=6.2)](https://github.com/darkwebdesign/symfony-addon-constraints/actions/workflows/build.yaml)
8+
[![Coverage Status](https://codecov.io/gh/darkwebdesign/symfony-addon-constraints/branch/6.2/graph/badge.svg)](https://codecov.io/gh/darkwebdesign/symfony-addon-constraints)
99
[![PHP Version](https://img.shields.io/badge/php-8.1%2B-777BB3.svg)](https://php.net/)
10-
[![Symfony Version](https://img.shields.io/badge/symfony-6.1-93C74B.svg)](https://symfony.com/)
10+
[![Symfony Version](https://img.shields.io/badge/symfony-6.2-93C74B.svg)](https://symfony.com/)
1111

1212
Symfony Add-on Constraints is a collection of extra Symfony validation constraints that you can use in your Symfony
1313
applications.
1414

15-
Learn more about it in its [documentation](https://darkwebdesign.github.io/symfony-addon-pack/docs/6.1).
15+
Learn more about it in its [documentation](https://darkwebdesign.github.io/symfony-addon-pack/docs/6.2).
1616

1717
## Features
1818

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
"require": {
1212
"ext-json": "*",
1313
"php": "^8.1",
14-
"symfony/validator": "6.1.*"
14+
"symfony/validator": "6.2.*"
1515
},
1616
"require-dev": {
1717
"friendsofphp/php-cs-fixer": "^3.58",
1818
"phpstan/extension-installer": "^1.3",
1919
"phpstan/phpstan": "^1.11",
2020
"phpstan/phpstan-phpunit": "^1.4",
2121
"phpstan/phpstan-symfony": "^1.4",
22-
"phpunit/phpunit": "^9.5",
22+
"phpunit/phpunit": "^10.5",
2323
"rector/rector": "^1.1"
2424
},
2525
"suggest": {

phpunit.xml.dist

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,29 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
44
bootstrap="vendor/autoload.php"
5-
cacheResultFile=".phpunit.cache/test-results"
5+
cacheDirectory=".phpunit.cache"
66
colors="true"
77
executionOrder="depends,defects"
8-
forceCoversAnnotation="true"
9-
beStrictAboutCoversAnnotation="true"
8+
requireCoverageMetadata="true"
9+
beStrictAboutCoverageMetadata="true"
1010
beStrictAboutOutputDuringTests="true"
1111
beStrictAboutTodoAnnotatedTests="true"
12-
convertDeprecationsToExceptions="true"
1312
failOnRisky="true"
14-
failOnWarning="true"
15-
verbose="true">
13+
failOnWarning="true">
1614

1715
<testsuites>
1816
<testsuite name="DarkWeb Design Symfony Add-on Constraints Test Suite">
1917
<directory>tests</directory>
2018
</testsuite>
2119
</testsuites>
2220

23-
<coverage cacheDirectory=".phpunit.cache/code-coverage"
24-
processUncoveredFiles="true">
21+
<source restrictDeprecations="true"
22+
restrictNotices="true"
23+
restrictWarnings="true">
2524
<include>
2625
<directory suffix=".php">src</directory>
2726
</include>
28-
</coverage>
27+
</source>
2928

3029
</phpunit>

rector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
])
1414
->withSets([
1515
LevelSetList::UP_TO_PHP_81,
16-
SymfonySetList::SYMFONY_61,
16+
SymfonySetList::SYMFONY_62,
1717
])
1818
->withImportNames(
1919
importShortClasses: false,

tests/BsnValidatorTest.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,26 @@
2525
use DarkWebDesign\SymfonyAddonConstraints\Bsn;
2626
use DarkWebDesign\SymfonyAddonConstraints\BsnValidator;
2727
use DarkWebDesign\SymfonyAddonConstraints\Tests\Models\ToStringObject;
28+
use PHPUnit\Framework\Attributes\CoversClass;
29+
use PHPUnit\Framework\Attributes\DataProvider;
2830
use Symfony\Component\Validator\Constraints as Assert;
2931
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
3032
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
3133

3234
/**
3335
* @template-extends ConstraintValidatorTestCase<BsnValidator>
3436
*
35-
* @covers \DarkWebDesign\SymfonyAddonConstraints\BsnValidator
36-
*
3737
* @internal
3838
*/
39+
#[CoversClass(BsnValidator::class)]
3940
class BsnValidatorTest extends ConstraintValidatorTestCase
4041
{
4142
protected function createValidator(): BsnValidator
4243
{
4344
return new BsnValidator();
4445
}
4546

46-
/**
47-
* @dataProvider providerValidBsn
48-
*/
47+
#[DataProvider('providerValidBsn')]
4948
public function testValidate(string|\Stringable $value): void
5049
{
5150
$this->validator->validate($value, new Bsn());
@@ -76,9 +75,7 @@ public function testValidateEmptyString(): void
7675
$this->assertNoViolation();
7776
}
7877

79-
/**
80-
* @dataProvider providerNoScalar
81-
*/
78+
#[DataProvider('providerNoScalar')]
8279
public function testValidateNoScalar(mixed $value): void
8380
{
8481
$this->expectException(UnexpectedTypeException::class);
@@ -88,9 +85,7 @@ public function testValidateNoScalar(mixed $value): void
8885
$this->assertNoViolation();
8986
}
9087

91-
/**
92-
* @dataProvider providerInvalidBsn
93-
*/
88+
#[DataProvider('providerInvalidBsn')]
9489
public function testValidateViolation(string|\Stringable $value): void
9590
{
9691
$constraint = new Bsn();
@@ -105,7 +100,7 @@ public function testValidateViolation(string|\Stringable $value): void
105100
/**
106101
* @return array<string, array{string|\Stringable}>
107102
*/
108-
public function providerValidBsn(): array
103+
public static function providerValidBsn(): array
109104
{
110105
return [
111106
'valid1' => ['111222333'],
@@ -117,7 +112,7 @@ public function providerValidBsn(): array
117112
/**
118113
* @return array<string, array{mixed}>
119114
*/
120-
public function providerNoScalar(): array
115+
public static function providerNoScalar(): array
121116
{
122117
return [
123118
'array' => [['foo', 'bar']],
@@ -130,7 +125,7 @@ public function providerNoScalar(): array
130125
/**
131126
* @return array<string, array{string|\Stringable}>
132127
*/
133-
public function providerInvalidBsn(): array
128+
public static function providerInvalidBsn(): array
134129
{
135130
return [
136131
'zeros' => ['000000000'],

tests/CollectionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@
2323
namespace DarkWebDesign\SymfonyAddonConstraints\Tests;
2424

2525
use DarkWebDesign\SymfonyAddonConstraints\Collection;
26+
use PHPUnit\Framework\Attributes\CoversClass;
2627
use PHPUnit\Framework\TestCase;
2728
use Symfony\Component\Validator\Constraints as Assert;
2829
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
2930
use Symfony\Component\Validator\Exception\MissingOptionsException;
3031

3132
/**
32-
* @covers \DarkWebDesign\SymfonyAddonConstraints\Collection
33-
*
3433
* @internal
3534
*/
35+
#[CoversClass(Collection::class)]
3636
class CollectionTest extends TestCase
3737
{
3838
public function testConstruct(): void

tests/CollectionValidatorTest.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,20 @@
2525
use DarkWebDesign\SymfonyAddonConstraints\Collection;
2626
use DarkWebDesign\SymfonyAddonConstraints\CollectionValidator;
2727
use DarkWebDesign\SymfonyAddonConstraints\Tests\Models\TraversableObject;
28+
use PHPUnit\Framework\Attributes\CoversClass;
29+
use PHPUnit\Framework\Attributes\DataProvider;
30+
use PHPUnit\Framework\Attributes\UsesClass;
2831
use Symfony\Component\Validator\Constraints as Assert;
2932
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
3033
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
3134

3235
/**
3336
* @template-extends ConstraintValidatorTestCase<CollectionValidator>
3437
*
35-
* @covers \DarkWebDesign\SymfonyAddonConstraints\CollectionValidator
36-
*
37-
* @uses \DarkWebDesign\SymfonyAddonConstraints\Collection
38-
*
3938
* @internal
4039
*/
40+
#[CoversClass(CollectionValidator::class)]
41+
#[UsesClass(Collection::class)]
4142
class CollectionValidatorTest extends ConstraintValidatorTestCase
4243
{
4344
protected function createValidator(): CollectionValidator
@@ -47,9 +48,8 @@ protected function createValidator(): CollectionValidator
4748

4849
/**
4950
* @param string[]|iterable $value
50-
*
51-
* @dataProvider providerValidCollection
5251
*/
52+
#[DataProvider('providerValidCollection')]
5353
public function testValidate(iterable $value): void
5454
{
5555
$constraints = [
@@ -88,9 +88,7 @@ public function testValidateNull(): void
8888
$this->assertNoViolation();
8989
}
9090

91-
/**
92-
* @dataProvider providerNoArray
93-
*/
91+
#[DataProvider('providerNoArray')]
9492
public function testValidateNoArray(mixed $value): void
9593
{
9694
$this->expectException(UnexpectedTypeException::class);
@@ -105,7 +103,7 @@ public function testValidateNoArray(mixed $value): void
105103
/**
106104
* @return array<string, array{string[]|iterable}>
107105
*/
108-
public function providerValidCollection(): array
106+
public static function providerValidCollection(): array
109107
{
110108
return [
111109
'empty' => [[]],
@@ -117,7 +115,7 @@ public function providerValidCollection(): array
117115
/**
118116
* @return array<string, array{mixed}>
119117
*/
120-
public function providerNoArray(): array
118+
public static function providerNoArray(): array
121119
{
122120
return [
123121
'bool' => [true],

tests/JsonValidatorTest.php

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,26 @@
2525
use DarkWebDesign\SymfonyAddonConstraints\Json;
2626
use DarkWebDesign\SymfonyAddonConstraints\JsonValidator;
2727
use DarkWebDesign\SymfonyAddonConstraints\Tests\Models\ToStringObject;
28+
use PHPUnit\Framework\Attributes\CoversClass;
29+
use PHPUnit\Framework\Attributes\DataProvider;
2830
use Symfony\Component\Validator\Constraints as Assert;
2931
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
3032
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
3133

3234
/**
3335
* @template-extends ConstraintValidatorTestCase<JsonValidator>
3436
*
35-
* @covers \DarkWebDesign\SymfonyAddonConstraints\JsonValidator
36-
*
3737
* @internal
3838
*/
39+
#[CoversClass(JsonValidator::class)]
3940
class JsonValidatorTest extends ConstraintValidatorTestCase
4041
{
4142
protected function createValidator(): JsonValidator
4243
{
4344
return new JsonValidator();
4445
}
4546

46-
/**
47-
* @dataProvider providerValidJson
48-
*/
47+
#[DataProvider('providerValidJson')]
4948
public function testValidate(mixed $value): void
5049
{
5150
$this->validator->validate($value, new Json());
@@ -76,9 +75,7 @@ public function testValidateEmptyString(): void
7675
$this->assertNoViolation();
7776
}
7877

79-
/**
80-
* @dataProvider providerNoScalar
81-
*/
78+
#[DataProvider('providerNoScalar')]
8279
public function testValidateNoScalar(mixed $value): void
8380
{
8481
$this->expectException(UnexpectedTypeException::class);
@@ -88,9 +85,7 @@ public function testValidateNoScalar(mixed $value): void
8885
$this->assertNoViolation();
8986
}
9087

91-
/**
92-
* @dataProvider providerInvalidJson
93-
*/
88+
#[DataProvider('providerInvalidJson')]
9489
public function testValidateViolation(string $value): void
9590
{
9691
$constraint = new Json();
@@ -105,7 +100,7 @@ public function testValidateViolation(string $value): void
105100
/**
106101
* @return array<string, array{mixed}>
107102
*/
108-
public function providerValidJson(): array
103+
public static function providerValidJson(): array
109104
{
110105
return [
111106
'bool' => [true],
@@ -121,7 +116,7 @@ public function providerValidJson(): array
121116
/**
122117
* @return array<string, array{mixed}>
123118
*/
124-
public function providerNoScalar(): array
119+
public static function providerNoScalar(): array
125120
{
126121
return [
127122
'array' => [['foo', 'bar']],
@@ -134,7 +129,7 @@ public function providerNoScalar(): array
134129
/**
135130
* @return array<string, array{string}>
136131
*/
137-
public function providerInvalidJson(): array
132+
public static function providerInvalidJson(): array
138133
{
139134
return [
140135
'string' => ['json'],

0 commit comments

Comments
 (0)