Skip to content

Commit 986991a

Browse files
committed
updates for upgraded QA
1 parent ce3b936 commit 986991a

22 files changed

+50
-70
lines changed

.github/workflows/symfony.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ jobs:
1818
strategy:
1919
matrix:
2020
php-version:
21-
- '7.4'
2221
- '8.1'
2322

2423
steps:
@@ -56,8 +55,6 @@ jobs:
5655
strategy:
5756
matrix:
5857
php-version:
59-
- '7.4'
60-
- '8.0'
6158
- '8.1'
6259

6360
steps:

.php-cs-fixer.dist.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
file that was distributed with this source code.',
1818
'location' => 'after_declare_strict',
1919
],
20+
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
21+
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
2022
])
2123
->setRiskyAllowed(true)
2224
->setFinder($finder)

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Version 1.0.1
2+
=============
3+
15 September 2023
4+
5+
- Allow newer versions of Twig (@Guite)
6+
- Correct symfony/contracts to be more specific and fix Symfony v6 compatibility (@craigh)
7+
- Fix small issue in unit tests (@On5-Repos)
8+
- Fix dev dependencies at specific version (@mbabker)
9+
- Reduce github actions matrix to only php 8.1 for QA related tools (@mbabker)
10+
- Correct new QA issues from upgrades to tools (@craigh)
11+
12+
Version 1.0.0
13+
=============
14+
21 June 2022
15+
16+
- Initial release

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
"symfony/validator": "^5.4 || ^6.0"
3030
},
3131
"require-dev": {
32-
"friendsofphp/php-cs-fixer": "^3.8",
33-
"phpstan/extension-installer": "^1.1",
34-
"phpstan/phpstan": "^1.6",
35-
"phpstan/phpstan-symfony": "^1.1",
36-
"phpunit/phpunit": "^9.5",
32+
"friendsofphp/php-cs-fixer": "3.26.1",
33+
"phpstan/extension-installer": "1.3.1",
34+
"phpstan/phpstan": "1.10.34",
35+
"phpstan/phpstan-symfony": "1.3.2",
36+
"phpunit/phpunit": "9.6.12",
3737
"roave/security-advisories": "dev-latest"
3838
},
3939
"suggest": {

phpstan.neon.dist

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
parameters:
22
paths:
33
- src
4-
- tests
54
level: 8

src/Container/AbstractSpecificationContainer.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,8 @@
1515

1616
abstract class AbstractSpecificationContainer implements SpecificationContainerInterface
1717
{
18-
/**
19-
* {@inheritDoc}
20-
*/
2118
abstract public function getFormSpecifications(array $params = []): array;
2219

23-
/**
24-
* {@inheritDoc}
25-
*/
2620
public function getLabels(string $locale = ''): array
2721
{
2822
$labels = [];
@@ -33,9 +27,6 @@ public function getLabels(string $locale = ''): array
3327
return $labels;
3428
}
3529

36-
/**
37-
* {@inheritDoc}
38-
*/
3930
public function getGroupedLabels(string $locale = ''): array
4031
{
4132
$labels = [];

src/Entity/AbstractResponseData.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,11 @@ abstract class AbstractResponseData implements ResponseDataInterface
2222
*/
2323
protected ?array $data = [];
2424

25-
/**
26-
* {@inheritDoc}
27-
*/
2825
public function getData(): ?array
2926
{
3027
return $this->data;
3128
}
3229

33-
/**
34-
* {@inheritDoc}
35-
*/
3630
public function setData(?array $data): void
3731
{
3832
$this->data = $data;

src/Form/Data/FormTypesChoices.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
namespace Zikula\Bundle\DynamicFormBundle\Form\Data;
1515

1616
use ArrayAccess;
17-
use Exception;
1817
use Iterator;
1918

2019
/**
@@ -23,7 +22,7 @@
2322
* @implements Iterator<string|null, array<string, string>|false>
2423
* @implements ArrayAccess<string, array<string, string>>
2524
*/
26-
class FormTypesChoices implements ArrayAccess, Iterator
25+
class FormTypesChoices implements \ArrayAccess, \Iterator
2726
{
2827
/**
2928
* @var array<string, array<string, string>>
@@ -43,9 +42,6 @@ public function offsetExists($offset): bool
4342
return isset($this->choices[$offset]);
4443
}
4544

46-
/**
47-
* @return mixed
48-
*/
4945
#[\ReturnTypeWillChange]
5046
public function offsetGet($offset)
5147
{
@@ -59,26 +55,20 @@ public function offsetSet($offset, $value): void
5955

6056
public function offsetUnset($offset): void
6157
{
62-
throw new Exception('Not allowed to unset!');
58+
throw new \Exception('Not allowed to unset!');
6359
}
6460

6561
public function rewind(): void
6662
{
6763
reset($this->choices);
6864
}
6965

70-
/**
71-
* @return mixed
72-
*/
7366
#[\ReturnTypeWillChange]
7467
public function current()
7568
{
7669
return current($this->choices);
7770
}
7871

79-
/**
80-
* @return mixed
81-
*/
8272
#[\ReturnTypeWillChange]
8373
public function key()
8474
{

src/Form/DataMapper/ChoiceWithOtherDataMapper.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
class ChoiceWithOtherDataMapper implements DataMapperInterface
2121
{
22-
/**
23-
* {@inheritDoc}
24-
*/
2522
public function mapDataToForms($viewData, \Traversable $forms): void
2623
{
2724
/** @var FormInterface[] $forms */
@@ -58,9 +55,6 @@ public function mapDataToForms($viewData, \Traversable $forms): void
5855
$forms['other']->setData($other);
5956
}
6057

61-
/**
62-
* {@inheritDoc}
63-
*/
6458
public function mapFormsToData(\Traversable $forms, &$viewData): void
6559
{
6660
/** @var FormInterface[] $forms */
@@ -87,7 +81,7 @@ public function mapFormsToData(\Traversable $forms, &$viewData): void
8781
$choicesData = array_merge($choicesData, $otherValue);
8882
}
8983

90-
$viewData = is_array($choicesData) ? implode(',', $choicesData) : $choicesData;
84+
$viewData = implode(',', $choicesData);
9185
}
9286
}
9387
}

src/Form/Type/ChoiceWithOtherType.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ class ChoiceWithOtherType extends AbstractType
2828
{
2929
public const OTHER_VALUE = 'other';
3030

31-
/**
32-
* {@inheritdoc}
33-
*/
3431
public function buildForm(FormBuilderInterface $builder, array $options): void
3532
{
3633
$builder
@@ -54,9 +51,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
5451
});
5552
}
5653

57-
/**
58-
* {@inheritdoc}
59-
*/
6054
public function configureOptions(OptionsResolver $resolver): void
6155
{
6256
$resolver->setDefaults([

src/Form/Type/FormSpecificationCollectionType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public function configureOptions(OptionsResolver $resolver): void
3131
'entry_type' => FormSpecificationType::class,
3232
'allow_add' => true,
3333
'allow_delete' => true,
34-
'delete_empty' => function (AbstractFormSpecification $property = null) {
34+
'delete_empty' => function (?AbstractFormSpecification $property = null) {
3535
return null === $property || empty($property->getName());
3636
},
3737
'prototype' => true, // required for javascript to work

src/Provider/LocaleProvider.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ public function __construct(EventDispatcherInterface $eventDispatcher, bool $tra
2828
$this->translate = $translate;
2929
}
3030

31-
/**
32-
* {@inheritDoc}
33-
*/
3431
public function getSupportedLocales(): array
3532
{
3633
if (!$this->translate) {
@@ -41,10 +38,7 @@ public function getSupportedLocales(): array
4138
return $event->getSupportedLocales();
4239
}
4340

44-
/**
45-
* {@inheritDoc}
46-
*/
47-
public function getSupportedLocaleNames(string $displayLocale = null): array
41+
public function getSupportedLocaleNames(?string $displayLocale = null): array
4842
{
4943
if (!$this->translate) {
5044
return ['Default' => 'default'];

src/Provider/LocaleProviderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ public function getSupportedLocales(): array;
2727
*
2828
* @return array<string, string>
2929
*/
30-
public function getSupportedLocaleNames(string $displayLocale = null): array;
30+
public function getSupportedLocaleNames(?string $displayLocale = null): array;
3131
}

tests/Form/Data/FormTypesChoicesTest.php

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
namespace Zikula\Bundle\DynamicFormBundle\Tests\Form\Data;
1515

16-
use ArrayAccess;
17-
use Iterator;
1816
use PHPUnit\Framework\TestCase;
19-
use Traversable;
2017
use Zikula\Bundle\DynamicFormBundle\Form\Data\FormTypesChoices;
2118

2219
class FormTypesChoicesTest extends TestCase
@@ -27,9 +24,9 @@ class FormTypesChoicesTest extends TestCase
2724
public function testEmptyInstantiation(): void
2825
{
2926
$foo = new FormTypesChoices();
30-
$this->assertInstanceOf(ArrayAccess::class, $foo);
31-
$this->assertInstanceOf(Iterator::class, $foo);
32-
$this->assertInstanceOf(Traversable::class, $foo);
27+
$this->assertInstanceOf(\ArrayAccess::class, $foo);
28+
$this->assertInstanceOf(\Iterator::class, $foo);
29+
$this->assertInstanceOf(\Traversable::class, $foo);
3330
}
3431

3532
/**
@@ -41,9 +38,9 @@ public function testInstantiationWithArg(): void
4138
'foo' => ['bar' => 'bar'],
4239
'three' => ['nine' => 'nine'],
4340
]);
44-
$this->assertInstanceOf(ArrayAccess::class, $foo);
45-
$this->assertInstanceOf(Iterator::class, $foo);
46-
$this->assertInstanceOf(Traversable::class, $foo);
41+
$this->assertInstanceOf(\ArrayAccess::class, $foo);
42+
$this->assertInstanceOf(\Iterator::class, $foo);
43+
$this->assertInstanceOf(\Traversable::class, $foo);
4744
$this->assertArrayHasKey('foo', $foo);
4845
$this->assertArrayHasKey('three', $foo);
4946
}

tests/Form/DataTransformer/ArrayToStringTransformerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ArrayToStringTransformerTest extends TestCase
2323
{
2424
/**
2525
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\ArrayToStringTransformer::transform
26+
*
2627
* @dataProvider data
2728
*/
2829
public function testTransform(string $storedAs, string $submitted, string $restored): void
@@ -33,6 +34,7 @@ public function testTransform(string $storedAs, string $submitted, string $resto
3334

3435
/**
3536
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\ArrayToStringTransformer::reverseTransform
37+
*
3638
* @dataProvider data
3739
*/
3840
public function testReverseTransform(string $storedAs, string $submitted, string $restored): void
@@ -52,6 +54,7 @@ public function data(): \Iterator
5254
* @param string[] $restored
5355
*
5456
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\ArrayToStringTransformer::transform
57+
*
5558
* @dataProvider dataMultiple
5659
*/
5760
public function testTransformMultiple(string $storedAs, array $submitted, array $restored): void
@@ -65,6 +68,7 @@ public function testTransformMultiple(string $storedAs, array $submitted, array
6568
* @param string[] $restored
6669
*
6770
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\ArrayToStringTransformer::reverseTransform
71+
*
6872
* @dataProvider dataMultiple
6973
*/
7074
public function testReverseTransformMultiple(string $storedAs, array $submitted, array $restored): void

tests/Form/DataTransformer/ChoiceValuesTransformerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class ChoiceValuesTransformerTest extends TestCase
2222
* @param array<string, string> $storedAs
2323
*
2424
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\ChoiceValuesTransformer::transform
25+
*
2526
* @dataProvider data
2627
*/
2728
public function testTransform(array $storedAs, string $submitted, string $restored): void
@@ -34,6 +35,7 @@ public function testTransform(array $storedAs, string $submitted, string $restor
3435
* @param array<string, string> $storedAs
3536
*
3637
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\ChoiceValuesTransformer::reverseTransform
38+
*
3739
* @dataProvider data
3840
*/
3941
public function testReverseTransform(array $storedAs, string $submitted, string $restored): void

tests/Form/DataTransformer/DefaultLabelToLabelsTransformerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class DefaultLabelToLabelsTransformerTest extends TestCase
2222
* @param array<string, string> $storedAs
2323
*
2424
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\DefaultLabelToLabelsTransformer::transform
25+
*
2526
* @dataProvider data
2627
*/
2728
public function testTransform(array $storedAs, string $submitted, string $restored): void
@@ -34,6 +35,7 @@ public function testTransform(array $storedAs, string $submitted, string $restor
3435
* @param array<string, string> $storedAs
3536
*
3637
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\DefaultLabelToLabelsTransformer::reverseTransform
38+
*
3739
* @dataProvider data
3840
*/
3941
public function testReverseTransform(array $storedAs, string $submitted, string $restored): void

tests/Form/DataTransformer/RegexConstraintTransformerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class RegexConstraintTransformerTest extends TestCase
2424
* @param mixed $submitted
2525
*
2626
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\RegexConstraintTransformer::transform
27+
*
2728
* @dataProvider data
2829
*/
2930
public function testTransform(array $storedAs, $submitted, string $restored): void
@@ -37,6 +38,7 @@ public function testTransform(array $storedAs, $submitted, string $restored): vo
3738
* @param mixed $submitted
3839
*
3940
* @covers \Zikula\Bundle\DynamicFormBundle\Form\DataTransformer\RegexConstraintTransformer::reverseTransform
41+
*
4042
* @dataProvider data
4143
*/
4244
public function testReverseTransform(array $storedAs, $submitted, string $restored): void

tests/Form/Type/DynamicFieldsTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ protected function setUp(): void
4141
/**
4242
* @param string[] $parameters this is for phpstan
4343
*/
44-
public function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
44+
public function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
4545
{
4646
return $id;
4747
}

tests/Form/Type/FormSpecificationTypeTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public function testBasicFormSubmission(): void
9191

9292
/**
9393
* @param string[] $expectedOptions
94+
*
9495
* @covers \Zikula\Bundle\DynamicFormBundle\Entity\AbstractFormSpecification
9596
* @covers \Zikula\Bundle\DynamicFormBundle\Form\Type\ChoiceTypeTransformed
9697
* @covers \Zikula\Bundle\DynamicFormBundle\Form\Type\ChoiceWithOtherType
@@ -104,6 +105,7 @@ public function testBasicFormSubmission(): void
104105
* @covers \Zikula\Bundle\DynamicFormBundle\Form\Type\DynamicOptions\MoneyFormOptionsArrayType
105106
* @covers \Zikula\Bundle\DynamicFormBundle\Form\Type\DynamicOptions\RangeFormOptionsArrayType
106107
* @covers \Zikula\Bundle\DynamicFormBundle\Form\Type\DynamicOptions\RegexibleFormOptionsArrayType
108+
*
107109
* @dataProvider data
108110
*/
109111
public function testProperFormCreation(string $type, array $expectedOptions): void

0 commit comments

Comments
 (0)