Skip to content

Commit c7164fb

Browse files
committed
fix TwigValidator with missing tokens/filters/tests
1 parent 13be7ac commit c7164fb

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"symfony/flex": "^1.3.1",
1919
"symfony/framework-bundle": "^5.2",
2020
"symfony/process": "^5.2",
21+
"symfony/twig-bridge": "^5.4",
2122
"symfony/yaml": "^5.2",
2223
"twig/twig": "^3.3"
2324
},

log.txt

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,12 @@ Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::
1111
Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::rewind() should either be compatible with Iterator::rewind(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/jules/Developer/code-block-checker/src/Issue/IssueCollection.php on line 38
1212

1313
Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/jules/Developer/code-block-checker/src/Issue/IssueCollection.php on line 43
14-
[Twig] Unknown "dump" tag. in file templates.rst at 658
1514
[Twig] A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag? in file templates.rst at 963
1615
[PHP syntax] Syntax error, unexpected T_DOUBLE_ARROW in file form/validation_groups.rst at 35
1716
[PHP syntax] Syntax error, unexpected EOF in file form/validation_groups.rst at 36
18-
[Twig] Unknown "selectedchoice" test. in file form/form_customization.rst at 360
19-
[Twig] Unknown "rootform" test. in file form/form_customization.rst at 380
20-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 109
21-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 129
22-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 143
23-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 150
24-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 167
2517
[Twig] Unexpected token "operator" of value "*". in file form/form_themes.rst at 354
26-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 405
27-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 499
28-
[Twig] Unknown "form_theme" tag. in file form/form_themes.rst at 549
29-
[Twig] Unknown "form_theme" tag. in file form/bootstrap4.rst at 73
30-
[Twig] Unknown "trans" tag. in file translation.rst at 319
31-
[Twig] Unknown "trans" tag. in file translation.rst at 349
32-
[Twig] Unknown "trans" tag. in file translation.rst at 392
33-
[Twig] Unknown "trans_default_domain" tag. in file translation.rst at 408
34-
[Twig] Unknown "trans" tag. in file translation/debug.rst at 16
18+
[Twig] Unknown "transchoice" tag. in file translation.rst at 321
19+
[Twig] Unknown "transchoice" tag. in file translation.rst at 353
3520
[PHP syntax] Syntax error, unexpected T_VARIABLE, expecting ':' in file testing.rst at 517
3621
[PHP syntax] Syntax error, unexpected ',' in file testing.rst at 517
3722
[PHP syntax] Syntax error, unexpected ',' in file testing.rst at 518
@@ -40,7 +25,6 @@ Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::
4025
[PHP syntax] Syntax error, unexpected ')' in file testing.rst at 522
4126
[PHP syntax] Syntax error, unexpected EOF, expecting '{' in file contributing/code/conventions.rst at 188
4227
[PHP syntax] Syntax error, unexpected '}', expecting ';' or '{' in file http_client.rst at 1312
43-
[Twig] Unknown "price" filter. in file templating/twig_extension.rst at 23
4428
[PHP syntax] Syntax error, unexpected ':' in file components/serializer.rst at 471
4529
[PHP syntax] Syntax error, unexpected T_VARIABLE, expecting ')' in file components/cache/adapters/doctrine_adapter.rst at 26
4630
[PHP syntax] Syntax error, unexpected ',' in file components/cache/adapters/doctrine_adapter.rst at 29
@@ -73,14 +57,12 @@ Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::
7357
[XML syntax] Unescaped '<' not allowed in attributes values in file routing.rst at 636
7458
[XML syntax] Unescaped '<' not allowed in attributes values in file routing.rst at 797
7559
[XML syntax] Start tag expected, '<' not found in file messenger.rst at 944
76-
[Twig] Unknown "greet" filter. in file quick_tour/the_architecture.rst at 212
7760
[PHP syntax] Syntax error, unexpected T_OBJECT_OPERATOR in file forms.rst at 674
7861
[PHP syntax] Syntax error, unexpected EOF in file forms.rst at 677
7962
[PHP syntax] Syntax error, unexpected T_OBJECT_OPERATOR in file forms.rst at 690
8063
[PHP syntax] Syntax error, unexpected EOF in file forms.rst at 694
8164
[PHP syntax] Syntax error, unexpected T_OBJECT_OPERATOR in file forms.rst at 902
8265
[PHP syntax] Syntax error, unexpected EOF in file forms.rst at 903
83-
[Twig] Unknown "stopwatch" tag. in file performance.rst at 283
8466
[XML syntax] EntityRef: expecting ';' in file reference/configuration/framework.rst at 139
8567
[PHP syntax] Syntax error, unexpected ']' in file reference/configuration/framework.rst at 2968
8668
[PHP syntax] Syntax error, unexpected T_DOUBLE_ARROW in file reference/forms/types/datetime.rst at 1
@@ -127,11 +109,8 @@ Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::
127109
[PHP syntax] Syntax error, unexpected ')' in file reference/forms/types/form.rst at 13
128110
[PHP syntax] Syntax error, unexpected T_DOUBLE_ARROW in file reference/forms/types/form.rst at 1
129111
[PHP syntax] Syntax error, unexpected ',' in file reference/forms/types/form.rst at 1
130-
[Twig] Unknown "form_theme" tag. in file reference/twig_reference.rst at 540
131-
[Twig] Unknown "trans" tag. in file reference/twig_reference.rst at 556
112+
[Twig] A message inside a trans tag must be a simple text. in file reference/twig_reference.rst at 556
132113
[Twig] Unknown "transchoice" tag. in file reference/twig_reference.rst at 578
133-
[Twig] Unknown "trans_default_domain" tag. in file reference/twig_reference.rst at 597
134-
[Twig] Unknown "stopwatch" tag. in file reference/twig_reference.rst at 611
135114
[PHP syntax] Syntax error, unexpected EOF in file bundles/configuration.rst at 142
136115
[PHP syntax] Syntax error, unexpected EOF in file bundles/configuration.rst at 164
137116
[PHP syntax] Syntax error, unexpected T_PUBLIC in file bundles/extension.rst at 122
@@ -142,5 +121,5 @@ Deprecated: Return type of SymfonyTools\CodeBlockChecker\Issue\IssueCollection::
142121
[PHP syntax] Syntax error, unexpected '}', expecting ';' or '{' in file create_framework/http_kernel_controller_resolver.rst at 125
143122
[PHP syntax] Syntax error, unexpected '}', expecting ';' or '{' in file create_framework/http_kernel_controller_resolver.rst at 130
144123

145-
[ERROR] Build completed with 130 errors
124+
[ERROR] Build completed with 109 errors
146125

src/Twig/DummyExtension.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22

33
namespace SymfonyTools\CodeBlockChecker\Twig;
44

5+
use Symfony\Bridge\Twig\TokenParser\DumpTokenParser;
6+
use Symfony\Bridge\Twig\TokenParser\FormThemeTokenParser;
7+
use Symfony\Bridge\Twig\TokenParser\StopwatchTokenParser;
8+
use Symfony\Bridge\Twig\TokenParser\TransDefaultDomainTokenParser;
9+
use Symfony\Bridge\Twig\TokenParser\TransTokenParser;
510
use Twig\Extension\AbstractExtension;
611
use Twig\TwigFilter;
712
use Twig\TwigFunction;
13+
use Twig\TwigTest;
814

915
/**
1016
* This extension will contain filters and functions that exists in Symfony. This
@@ -91,6 +97,27 @@ public function getFilters()
9197
new TwigFilter('markdown_to_html'),
9298
new TwigFilter('inky_to_html'),
9399
new TwigFilter('serialize'),
100+
new TwigFilter('price'),
101+
new TwigFilter('greet'),
102+
];
103+
}
104+
105+
public function getTests()
106+
{
107+
return [
108+
new TwigTest('rootform'),
109+
new TwigTest('selectedchoice'),
110+
];
111+
}
112+
113+
public function getTokenParsers()
114+
{
115+
return [
116+
new DumpTokenParser(),
117+
new FormThemeTokenParser(),
118+
new StopwatchTokenParser(false),
119+
new TransTokenParser(),
120+
new TransDefaultDomainTokenParser(),
94121
];
95122
}
96123
}

0 commit comments

Comments
 (0)