Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
},
"require-dev": {
"doctrine/orm": "^2.7",
"friendsofphp/php-cs-fixer": "^3.58",
"friendsofphp/php-cs-fixer": "^3.93",
"maglnet/composer-require-checker": "^4.17",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-doctrine": "^1.4",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.1"
"rector/rector": "^2.3"
},
"suggest": {
"doctrine/orm": "Required for EntityToIdentifierTransformer and EntityType"
Expand Down
2 changes: 2 additions & 0 deletions phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ parameters:
- 'symfony-addon-form-types/tests'
- 'symfony-addon-transformers/src'
- 'symfony-addon-transformers/tests'

treatPhpDocTypesAsCertain: false
15 changes: 8 additions & 7 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return RectorConfig::configure()
->withPaths([
Expand All @@ -14,9 +13,11 @@
__DIR__ . '/symfony-addon-transformers/src',
__DIR__ . '/symfony-addon-transformers/tests',
])
->withSets([
LevelSetList::UP_TO_PHP_82,
])
->withImportNames(
importShortClasses: false,
);
->withPhpSets()
->withAttributesSets()
->withPreparedSets(phpunitCodeQuality: true, doctrineCodeQuality: true, symfonyCodeQuality: true, symfonyConfigs: true)
->withComposerBased(doctrine: true, phpunit: true, symfony: true)
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withTypeCoverageLevel(0)
->withDeadCodeLevel(0)
->withCodeQualityLevel(0);
1 change: 1 addition & 0 deletions symfony-addon-constraints/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'global_namespace_import' => ['import_classes' => false],
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], // overrules @PhpCsFixer
'no_superfluous_elseif' => false, // overrules @PhpCsFixer
'php_unit_data_provider_method_order' => false, // overrules @PhpCsFixer
'phpdoc_align' => ['tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'], 'align' => 'left'], // overrules @Symfony
'yoda_style' => false, // overrules @Symfony
])
Expand Down
12 changes: 6 additions & 6 deletions symfony-addon-constraints/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
"symfony/validator": "7.3.*"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.58",
"friendsofphp/php-cs-fixer": "^3.93",
"maglnet/composer-require-checker": "^4.17",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.1"
"rector/rector": "^2.3"
},
"suggest": {
"darkwebdesign/symfony-addon-pack": "All Symfony add-ons bundled together"
Expand Down
2 changes: 2 additions & 0 deletions symfony-addon-constraints/phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ parameters:
paths:
- 'src'
- 'tests'

treatPhpDocTypesAsCertain: false
15 changes: 8 additions & 7 deletions symfony-addon-constraints/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])
->withSets([
LevelSetList::UP_TO_PHP_82,
])
->withImportNames(
importShortClasses: false,
);
->withPhpSets()
->withAttributesSets()
->withPreparedSets(phpunitCodeQuality: true, symfonyCodeQuality: true, symfonyConfigs: true)
->withComposerBased(phpunit: true, symfony: true)
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withTypeCoverageLevel(0)
->withDeadCodeLevel(0)
->withCodeQualityLevel(0);
2 changes: 1 addition & 1 deletion symfony-addon-constraints/src/BsnValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function validate(mixed $value, Constraint $constraint): void
$value = (string) $value;

if ('000000000' !== $value && preg_match('/^\d{9}$/', $value)) {
[$a, $b, $c, $d, $e, $f, $g, $h, $i] = array_map('intval', str_split($value));
[$a, $b, $c, $d, $e, $f, $g, $h, $i] = array_map(intval(...), str_split($value));

$sum = (9 * $a) + (8 * $b) + (7 * $c) + (6 * $d) + (5 * $e) + (4 * $f) + (3 * $g) + (2 * $h) + (-1 * $i);

Expand Down
42 changes: 18 additions & 24 deletions symfony-addon-constraints/tests/BsnValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @internal
*/
#[CoversClass(BsnValidator::class)]
class BsnValidatorTest extends ConstraintValidatorTestCase
final class BsnValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): BsnValidator
{
Expand Down Expand Up @@ -99,40 +99,34 @@ public function testValidateViolation(string|\Stringable $value): void
}

/**
* @return array<string, array{string|\Stringable}>
* @return \Iterator<string, array{string|\Stringable}>
*/
public static function providerValidBsn(): array
public static function providerValidBsn(): \Iterator
{
return [
'valid1' => ['111222333'],
'valid2' => ['123456782'],
'objectToString' => [new ToStringObject('270590791')],
];
yield 'valid1' => ['111222333'];
yield 'valid2' => ['123456782'];
yield 'objectToString' => [new ToStringObject('270590791')];
}

/**
* @return array<string, array{mixed}>
* @return \Iterator<string, array{mixed}>
*/
public static function providerNoScalar(): array
public static function providerNoScalar(): \Iterator
{
return [
'array' => [['foo', 'bar']],
'object' => [new \stdClass()],
'resource' => [tmpfile()],
'callable' => [function () {}],
];
yield 'array' => [['foo', 'bar']];
yield 'object' => [new \stdClass()];
yield 'resource' => [tmpfile()];
yield 'callable' => [function (): void {}];
}

/**
* @return array<string, array{string|\Stringable}>
* @return \Iterator<string, array{string|\Stringable}>
*/
public static function providerInvalidBsn(): array
public static function providerInvalidBsn(): \Iterator
{
return [
'zeros' => ['000000000'],
'invalid1' => ['999999999'],
'invalid2' => ['876543242'],
'toStringObject' => [new ToStringObject('597944111')],
];
yield 'zeros' => ['000000000'];
yield 'invalid1' => ['999999999'];
yield 'invalid2' => ['876543242'];
yield 'toStringObject' => [new ToStringObject('597944111')];
}
}
9 changes: 4 additions & 5 deletions symfony-addon-constraints/tests/CollectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

use DarkWebDesign\SymfonyAddonConstraints\Collection;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DoesNotPerformAssertions;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
Expand All @@ -34,26 +35,24 @@
* @internal
*/
#[CoversClass(Collection::class)]
class CollectionTest extends TestCase
final class CollectionTest extends TestCase
{
#[DoesNotPerformAssertions]
public function testConstruct(): void
{
new Collection([
'constraints' => [
new Assert\NotBlank(),
],
]);

$this->assertTrue(true);
}

#[DoesNotPerformAssertions]
public function testConstructDefaultOption(): void
{
new Collection([
new Assert\NotBlank(),
]);

$this->assertTrue(true);
}

public function testConstructMissingRequiredConstraintsOption(): void
Expand Down
34 changes: 15 additions & 19 deletions symfony-addon-constraints/tests/CollectionValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
#[CoversClass(CollectionValidator::class)]
#[UsesClass(Collection::class)]
class CollectionValidatorTest extends ConstraintValidatorTestCase
final class CollectionValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): CollectionValidator
{
Expand Down Expand Up @@ -102,30 +102,26 @@ public function testValidateNoArray(mixed $value): void
}

/**
* @return array<string, array{string[]|iterable}>
* @return \Iterator<string, array{iterable<string>}>
*/
public static function providerValidCollection(): array
public static function providerValidCollection(): \Iterator
{
return [
'empty' => [[]],
'array' => [['my.email@address.com']],
'traversableObject' => [new TraversableObject(['my.email@address.com'])],
];
yield 'empty' => [[]];
yield 'array' => [['my.email@address.com']];
yield 'traversableObject' => [new TraversableObject(['my.email@address.com'])];
}

/**
* @return array<string, array{mixed}>
* @return \Iterator<string, array{mixed}>
*/
public static function providerNoArray(): array
public static function providerNoArray(): \Iterator
{
return [
'bool' => [true],
'int' => [1],
'float' => [1.2],
'string' => ['foo'],
'object' => [new \stdClass()],
'resource' => [tmpfile()],
'callable' => [function () {}],
];
yield 'bool' => [true];
yield 'int' => [1];
yield 'float' => [1.2];
yield 'string' => ['foo'];
yield 'object' => [new \stdClass()];
yield 'resource' => [tmpfile()];
yield 'callable' => [function (): void {}];
}
}
48 changes: 21 additions & 27 deletions symfony-addon-constraints/tests/JsonValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
* @internal
*/
#[CoversClass(JsonValidator::class)]
class JsonValidatorTest extends ConstraintValidatorTestCase
final class JsonValidatorTest extends ConstraintValidatorTestCase
{
protected function createValidator(): JsonValidator
{
Expand Down Expand Up @@ -99,43 +99,37 @@ public function testValidateViolation(string $value): void
}

/**
* @return array<string, array{mixed}>
* @return \Iterator<string, array{mixed}>
*/
public static function providerValidJson(): array
public static function providerValidJson(): \Iterator
{
return [
'bool' => [true],
'int' => [123],
'float' => [10.99],
'stringInt' => ['123'],
'stringArray' => ['[1, 2, 3]'],
'stringObject' => ['{"a": 1, "b": 2}'],
'objectToString' => [new ToStringObject('123')],
];
yield 'bool' => [true];
yield 'int' => [123];
yield 'float' => [10.99];
yield 'stringInt' => ['123'];
yield 'stringArray' => ['[1, 2, 3]'];
yield 'stringObject' => ['{"a": 1, "b": 2}'];
yield 'objectToString' => [new ToStringObject('123')];
}

/**
* @return array<string, array{mixed}>
* @return \Iterator<string, array{mixed}>
*/
public static function providerNoScalar(): array
public static function providerNoScalar(): \Iterator
{
return [
'array' => [['foo', 'bar']],
'object' => [new \stdClass()],
'resource' => [tmpfile()],
'callable' => [function () {}],
];
yield 'array' => [['foo', 'bar']];
yield 'object' => [new \stdClass()];
yield 'resource' => [tmpfile()];
yield 'callable' => [function (): void {}];
}

/**
* @return array<string, array{string}>
* @return \Iterator<string, array{string}>
*/
public static function providerInvalidJson(): array
public static function providerInvalidJson(): \Iterator
{
return [
'string' => ['json'],
'stringArray' => ['[1, 2, 3'],
'stringObject' => ['{"a": 1, "b": 2'],
];
yield 'string' => ['json'];
yield 'stringArray' => ['[1, 2, 3'];
yield 'stringObject' => ['{"a": 1, "b": 2'];
}
}
1 change: 1 addition & 0 deletions symfony-addon-form-types/.php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
'global_namespace_import' => ['import_classes' => false],
'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], // overrules @PhpCsFixer
'no_superfluous_elseif' => false, // overrules @PhpCsFixer
'php_unit_data_provider_method_order' => false, // overrules @PhpCsFixer
'phpdoc_align' => ['tags' => ['method', 'param', 'property', 'return', 'throws', 'type', 'var'], 'align' => 'left'], // overrules @Symfony
'yoda_style' => false, // overrules @Symfony
])
Expand Down
14 changes: 7 additions & 7 deletions symfony-addon-form-types/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
"require-dev": {
"darkwebdesign/symfony-addon-transformers": "7.3.*",
"doctrine/orm": "^2.7",
"friendsofphp/php-cs-fixer": "^3.58",
"friendsofphp/php-cs-fixer": "^3.93",
"maglnet/composer-require-checker": "^4.17",
"phpstan/extension-installer": "^1.3",
"phpstan/phpstan": "^1.11",
"phpstan/phpstan-doctrine": "^1.4",
"phpstan/phpstan-phpunit": "^1.4",
"phpstan/phpstan-symfony": "^1.4",
"phpstan/extension-installer": "^1.4",
"phpstan/phpstan": "^2.1",
"phpstan/phpstan-doctrine": "^2.0",
"phpstan/phpstan-phpunit": "^2.0",
"phpstan/phpstan-symfony": "^2.0",
"phpunit/phpunit": "^10.5",
"rector/rector": "^1.1"
"rector/rector": "^2.3"
},
"suggest": {
"darkwebdesign/symfony-addon-pack": "All Symfony add-ons bundled together",
Expand Down
2 changes: 2 additions & 0 deletions symfony-addon-form-types/phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ parameters:
paths:
- 'src'
- 'tests'

treatPhpDocTypesAsCertain: false
Loading