Skip to content

Commit

Permalink
Support Symfony 7
Browse files Browse the repository at this point in the history
  • Loading branch information
iquito committed Dec 1, 2023
1 parent 323226e commit 9f74838
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 29 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Squirrel Validator Cascade

Reimplements the `Valid` constraint in the Symfony validator component as `Cascade` attribute which is more straightforward to use than `Valid` and has no surprising behavior.

This component is compatible with the Symfony validator component in version 5.x (v2.x with annotation/attribute support) and 6.x (v3.x with only attribute support) and will be adapted to support future versions of Symfony (if any changes are necessary for that).
This component is compatible with the Symfony validator component in version 5.x (v2.x with annotation/attribute support) and 6.x/7.x (v3.x with only attribute support) and will be adapted to support future versions of Symfony (if any changes are necessary for that).

Installation
------------
Expand Down
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "squirrelphp/validator-cascade",
"type": "library",
"description": "Cascade annotation for Symfony Validator annotation, reimplementing the Valid constraint in a more flexible and understandable way",
"description": "Cascade attribute for Symfony Validator, reimplementing the Valid constraint in a more flexible and understandable way",
"keywords": [
"php",
"symfony",
Expand All @@ -20,16 +20,20 @@
],
"require": {
"php": ">=8.0",
"symfony/validator": "^6.0"
"symfony/validator": "^6.0|^7.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.3",
"captainhook/plugin-composer": "^5.0",
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^10.0",
"mockery/mockery": "^1.0"
},
"config": {
"sort-packages": false
"sort-packages": false,
"allow-plugins": {
"bamarni/composer-bin-plugin": true,
"captainhook/plugin-composer": true
}
},
"autoload": {
"psr-4": {
Expand Down
23 changes: 12 additions & 11 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" colors="true" bootstrap="vendor/autoload.php">
<coverage includeUncoveredFiles="false"/>
<testsuites>
<testsuite name="Squirrel Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
</phpunit>
8 changes: 1 addition & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="v4.15.0@a1b5e489e6fcebe40cb804793d964e99fc347820">
<file src="src/Cascade.php">
<PropertyNotSetInConstructor occurrences="1">
<code>Cascade</code>
</PropertyNotSetInConstructor>
</file>
</files>
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591"/>
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
2 changes: 1 addition & 1 deletion ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<rule ref="SlevomatCodingStandard.Classes.ClassConstantVisibility"/>
<rule ref="SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue"/>
<rule ref="SlevomatCodingStandard.TypeHints.ParameterTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.TypeHints.PropertyTypeHintSpacing"/>
<rule ref="SlevomatCodingStandard.Classes.PropertyDeclaration"/>
<rule ref="SlevomatCodingStandard.Namespaces.MultipleUsesPerLine"/>
<rule ref="SlevomatCodingStandard.Namespaces.UseDoesNotStartWithBackslash"/>
<rule ref="SlevomatCodingStandard.Classes.DisallowLateStaticBindingForConstants"/>
Expand Down
6 changes: 3 additions & 3 deletions tests/OrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ protected function setUp(): void
parent::setUp();

$this->validator = \Symfony\Component\Validator\Validation::createValidatorBuilder()
->enableAnnotationMapping()
->enableAttributeMapping()
->getValidator();
}

public function testWithDifferentGroups()
public function testWithDifferentGroups(): void
{
$order = new Order();
$order->shippingAddress = new Address();
Expand Down Expand Up @@ -80,7 +80,7 @@ public function testWithDifferentGroups()
}
}

public function testWithNullValue()
public function testWithNullValue(): void
{
$order = new Order();
$order->shippingAddress = new Address();
Expand Down
7 changes: 6 additions & 1 deletion vendor-bin/phpcs/composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"require": {
"squizlabs/php_codesniffer": "^3.5",
"slevomat/coding-standard": "^7.0"
"slevomat/coding-standard": "^8.0"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
2 changes: 1 addition & 1 deletion vendor-bin/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"require": {
"vimeo/psalm": "^4.0"
"vimeo/psalm": "^5.0"
}
}

0 comments on commit 9f74838

Please sign in to comment.