Skip to content

Commit

Permalink
🚨 lint templates
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed Jul 5, 2024
1 parent 3b1d60c commit 7ac7539
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 14 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ jobs:
uses: actions/checkout@v4
- name: Fix CS
uses: docker://oskarstark/php-cs-fixer-ga
twig-cs-fixer:
runs-on: ubuntu-22.04
name: Twig-CS-Fixer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Require the vendor
run: composer require --dev --no-update vincentlanglet/twig-cs-fixer ^2.11
- name: Update
run: composer update --no-interaction --no-progress
- name: Run
run: vendor/bin/twig-cs-fixer lint templates
validate-markdown:
runs-on: ubuntu-22.04
steps:
Expand Down
1 change: 1 addition & 0 deletions src/Metadata/CacheWarmer.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function warmUp(string $cacheDir, string $buildDir = null): array
$this->metadataReader->getUploadableFields($class);
$files[] = $class;
}

// TODO it could be nice if we return $files, to allow to exploit preloading...
return [];
}
Expand Down
10 changes: 2 additions & 8 deletions src/Metadata/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ final class ClassMetadata extends BaseClassMetadata

public function serialize(): string
{
return \serialize([
$this->fields,
parent::serialize(),
]);
return \serialize([$this->fields, parent::serialize()]);
}

public function unserialize($str): void
{
[
$this->fields,
$parentStr
] = \unserialize($str);
[$this->fields, $parentStr] = \unserialize($str);

parent::unserialize($parentStr);
}
Expand Down
2 changes: 1 addition & 1 deletion templates/Collector/mapping_collector.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</div>
{% endset %}

{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { 'link': true }) }}
{{ include('@WebProfiler/Profiler/toolbar_item.html.twig', {link: true}) }}
{% endblock %}

{% block menu %}
Expand Down
1 change: 0 additions & 1 deletion templates/Form/fields.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@
{%- endif -%}
</div>
{%- endblock -%}

2 changes: 2 additions & 0 deletions tests/DummyFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ class DummyFile
{
/**
* @ORM\Id
*
* @ORM\Column(type="integer")
*
* @ORM\GeneratedValue(strategy="AUTO")
*
* @var int
Expand Down
1 change: 1 addition & 0 deletions tests/DummyImageFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

/**
* @ORM\Entity
*
* @Vich\Uploadable
*/
class DummyImageFile
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/App/templates/default/edit.html.twig
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends 'base.html.twig' %}

{% block body %}
{{ form(form, {'action': path('upload_edit', {'formType': formType, 'imageId': imageId}), 'method': 'POST'}) }}
{{ form(form, {action: path('upload_edit', {formType: formType, imageId: imageId}), method: 'POST'}) }}

{{ vich_uploader_asset(image) }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html.twig' %}

{% block body %}
{{ form(form, {'action': path('upload_edit_with_property_path', {'formType': formType, 'imageId': imageId}), 'method': 'POST'}) }}
{{ form(form, {action: path('upload_edit_with_property_path', {formType: formType, imageId: imageId}), method: 'POST'}) }}
{% endblock %}
2 changes: 1 addition & 1 deletion tests/Fixtures/App/templates/default/upload.html.twig
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html.twig' %}

{% block body %}
{{ form(form, {'action': path('upload_send', {'formType': formType}), 'method': 'POST'}) }}
{{ form(form, {action: path('upload_send', {formType: formType}), method: 'POST'}) }}
{% endblock %}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends 'base.html.twig' %}

{% block body %}
{{ form(form, {'action': path('upload_send_with_property_path', {'formType': formType}), 'method': 'POST'}) }}
{{ form(form, {action: path('upload_send_with_property_path', {formType: formType}), method: 'POST'}) }}
{% endblock %}

0 comments on commit 7ac7539

Please sign in to comment.