Skip to content

Commit

Permalink
DevKit updates for 4.x branch (#8166)
Browse files Browse the repository at this point in the history
Co-authored-by: Vincent Langlet <[email protected]>
  • Loading branch information
SonataCI and VincentLanglet authored Apr 3, 2024
1 parent fb06e46 commit 247131e
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
'no_useless_return' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true, 'remove_inheritdoc' => true],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'nullable_type_declaration_for_default_null_value' => true,
'ordered_class_elements' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['class', 'function', 'const']],
'phpdoc_order' => ['order' => ['var', 'param', 'throws', 'return', 'phpstan-var', 'psalm-var', 'phpstan-param', 'psalm-param', 'phpstan-return', 'psalm-return']],
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Frontend assets are all located under `assets` directory, with the following str
* `assets/images` for the images
* `assets/vendor` for the third party assets that can't be loaded via [NPM](https://www.npmjs.com/)

This `assets` directory contains only the source code, and it is not directly accesible for the
This `assets` directory contains only the source code, and it is not directly accessible for the
website, because is not placed under the `src/Resources/public`.

If you take a look at the `src/Resources/public` you will see a lot of minified assets, this is done with
Expand Down
1 change: 1 addition & 0 deletions src/Action/SetObjectFieldValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ public function __invoke(Request $request): JsonResponse
return new JsonResponse(implode("\n", $messages), Response::HTTP_BAD_REQUEST);
}

\assert(\is_object($object));
$admin->update($object);

// render the widget
Expand Down
8 changes: 4 additions & 4 deletions tests/Form/AdminLayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public function testLabelWithoutTranslation(): void
TextType::class,
null,
[
'translation_domain' => false,
]
'translation_domain' => false,
]
);
$html = $this->renderLabel($form->createView());

Expand All @@ -65,8 +65,8 @@ public function testLabelWithCustomTranslationDomain(): void
TextType::class,
null,
[
'translation_domain' => 'custom_domain',
]
'translation_domain' => 'custom_domain',
]
);
$html = $this->renderLabel($form->createView());

Expand Down
3 changes: 2 additions & 1 deletion tests/Form/FormMapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ public function testWithFieldsCascadeTranslationDomain(): void
->method('getDefaultOptions')
->willReturn([]);

$this->formMapper->with('foobar', [
$this->formMapper
->with('foobar', [
'translation_domain' => 'Foobar',
])
->add('foo', TextType::class)
Expand Down
35 changes: 20 additions & 15 deletions tests/Twig/Extension/RenderElementExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ class="x-editable"
</span>
</td>
EOT
,
,
FieldDescriptionInterface::TYPE_BOOLEAN,
true,
['editable' => true],
Expand Down Expand Up @@ -1314,7 +1314,7 @@ class="x-editable"
FieldDescriptionInterface::TYPE_URL,
'http://foo/bar?a=b&c=123456789',
['route' => ['name' => 'sonata_admin_foo'],
'hide_protocol' => true, ],
'hide_protocol' => true, ],
],
[
'<td class="sonata-ba-list-field sonata-ba-list-field-url" objectId="12345">
Expand All @@ -1335,7 +1335,7 @@ class="x-editable"
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_param',
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
],
],
[
Expand All @@ -1345,9 +1345,11 @@ class="x-editable"
FieldDescriptionInterface::TYPE_URL,
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_param',
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
'route' => [
'name' => 'sonata_admin_foo_param',
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
],
],
],
[
Expand All @@ -1357,9 +1359,11 @@ class="x-editable"
FieldDescriptionInterface::TYPE_URL,
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_object',
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId', ],
'route' => [
'name' => 'sonata_admin_foo_object',
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId',
],
],
],
[
Expand All @@ -1369,10 +1373,12 @@ class="x-editable"
FieldDescriptionInterface::TYPE_URL,
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_object',
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId', ],
'route' => [
'name' => 'sonata_admin_foo_object',
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId',
],
],
],
[
Expand Down Expand Up @@ -1794,8 +1800,7 @@ public function provideRenderViewElementCases(): iterable
'<th>Data</th> <td><a href="https://example.com">https://example.com</a></td>',
FieldDescriptionInterface::TYPE_URL,
'https://example.com',
['safe' => false,
'hide_protocol' => false, ],
['safe' => false, 'hide_protocol' => false],
],
[
'<th>Data</th> <td><a href="http://example.com">Foo</a></td>',
Expand Down
22 changes: 11 additions & 11 deletions tests/Twig/RenderElementRuntimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ class="x-editable"
</span>
</td>
EOT
,
,
FieldDescriptionInterface::TYPE_BOOLEAN,
true,
['editable' => true],
Expand Down Expand Up @@ -1279,7 +1279,7 @@ class="x-editable"
FieldDescriptionInterface::TYPE_URL,
'http://foo/bar?a=b&c=123456789',
['route' => ['name' => 'sonata_admin_foo'],
'hide_protocol' => true, ],
'hide_protocol' => true, ],
],
[
'<td class="sonata-ba-list-field sonata-ba-list-field-url" objectId="12345">
Expand All @@ -1300,7 +1300,7 @@ class="x-editable"
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_param',
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
],
],
[
Expand All @@ -1311,8 +1311,8 @@ class="x-editable"
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_param',
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'], ],
],
],
[
Expand All @@ -1323,8 +1323,8 @@ class="x-editable"
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_object',
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId', ],
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId', ],
],
],
[
Expand All @@ -1335,9 +1335,9 @@ class="x-editable"
'Foo',
[
'route' => ['name' => 'sonata_admin_foo_object',
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId', ],
'absolute' => true,
'parameters' => ['param1' => 'abcd', 'param2' => 'efgh', 'param3' => 'ijkl'],
'identifier_parameter_name' => 'barId', ],
],
],
[
Expand Down Expand Up @@ -1734,7 +1734,7 @@ public function provideRenderViewElementCases(): iterable
FieldDescriptionInterface::TYPE_URL,
'https://example.com',
['safe' => false,
'hide_protocol' => false, ],
'hide_protocol' => false, ],
];
yield [
'<th>Data</th> <td><a href="http://example.com">Foo</a></td>',
Expand Down

0 comments on commit 247131e

Please sign in to comment.