Skip to content

Commit ed42b46

Browse files
author
roadiz-ci
committed
feat!: Upgrade Symfony to version 7.3 (#154)
1 parent c263f22 commit ed42b46

9 files changed

Lines changed: 243 additions & 257 deletions

File tree

composer.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
"enshrined/svg-sanitize": "^0.15",
3030
"intervention/image": "^3.11",
3131
"league/flysystem": "^3.0",
32-
"monolog/monolog": "^1.24.0 || ^2.1.1",
33-
"symfony/asset": "6.4.*",
34-
"symfony/console": "6.4.*",
35-
"symfony/event-dispatcher": "6.4.*",
32+
"monolog/monolog": "^3.9",
33+
"symfony/asset": "7.3.*",
34+
"symfony/console": "7.3.*",
35+
"symfony/event-dispatcher": "7.3.*",
3636
"symfony/filesystem": ">=7.1",
37-
"symfony/finder": "6.4.*",
38-
"symfony/http-foundation": "6.4.*",
37+
"symfony/finder": "7.3.*",
38+
"symfony/http-foundation": "7.3.*",
3939
"symfony/http-client-contracts": "^3.5",
40-
"symfony/options-resolver": "6.4.*",
41-
"symfony/serializer": "6.4.*",
40+
"symfony/options-resolver": "7.3.*",
41+
"symfony/serializer": "7.3.*",
4242
"twig/twig": "^3.21"
4343
},
4444
"require-dev": {
@@ -48,9 +48,9 @@
4848
"phpstan/phpstan": "^1.5.3",
4949
"phpstan/phpdoc-parser": "<2",
5050
"phpstan/phpstan-doctrine": "^1.3",
51-
"phpunit/phpunit": "^9.5",
52-
"symfony/http-client": "6.4.*",
53-
"symfony/process": "6.4.*"
51+
"phpunit/phpunit": "^9.6",
52+
"symfony/http-client": "7.3.*",
53+
"symfony/process": "7.3.*"
5454
},
5555
"autoload": {
5656
"psr-4": {

src/Models/SimpleDocument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public function __toString(): string
207207
}
208208

209209
#[\Override]
210-
public function compareTo($other)
210+
public function compareTo($other): int
211211
{
212212
if (!$other instanceof DocumentInterface) {
213213
throw new \InvalidArgumentException('Can only compare to DocumentInterface instances.');
Lines changed: 49 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
1-
{% apply spaceless %}
2-
{% set attributes = {} %}
3-
4-
{% if width %}
5-
{% set attributes = attributes|merge({
6-
'width': width|escape('html_attr'),
7-
}) %}
8-
{% endif %}
9-
{% if height %}
10-
{% set attributes = attributes|merge({
11-
'height': height|escape('html_attr'),
12-
}) %}
13-
{% endif %}
14-
{% if class %}
15-
{% set attributes = attributes|merge({
16-
'class': class|escape('html_attr'),
17-
}) %}
18-
{% endif %}
19-
{% if identifier %}
20-
{% set attributes = attributes|merge({
21-
'id': identifier|escape('html_attr'),
22-
}) %}
23-
{% endif %}
24-
{# Add controls by default #}
25-
{% if controls is same as(true) %}
26-
{% set attributes = attributes|merge({
27-
'controls': true,
28-
}) %}
29-
{% endif %}
30-
{% if autoplay is same as(true) %}
31-
{% set attributes = attributes|merge({
32-
'autoplay': true,
33-
}) %}
34-
{% endif %}
35-
{% if loop is same as(true) %}
36-
{% set attributes = attributes|merge({
37-
'loop': true,
38-
}) %}
39-
{% endif %}
40-
{% set attributesCompiled = {} %}
41-
{% for key, value in attributes %}
42-
{% if value is same as(true) %}
43-
{% set attributesCompiled = attributesCompiled|merge([key]) %}
44-
{% else %}
45-
{% set attributesCompiled = attributesCompiled|merge([key ~ '="' ~ value ~ '"']) %}
46-
{% endif %}
47-
{% endfor %}
48-
<audio{% if attributesCompiled|length %} {{ attributesCompiled|join(' ')|raw }}{% endif %}>
49-
{% for source in sources %}
1+
{%- set attributes = {} -%}
2+
{%- if width -%}
3+
{%- set attributes = attributes|merge({
4+
'width': width|escape('html_attr'),
5+
}) -%}
6+
{%- endif -%}
7+
{%- if height -%}
8+
{%- set attributes = attributes|merge({
9+
'height': height|escape('html_attr'),
10+
}) -%}
11+
{%- endif -%}
12+
{%- if class -%}
13+
{%- set attributes = attributes|merge({
14+
'class': class|escape('html_attr'),
15+
}) -%}
16+
{%- endif -%}
17+
{%- if identifier -%}
18+
{%- set attributes = attributes|merge({
19+
'id': identifier|escape('html_attr'),
20+
}) -%}
21+
{%- endif -%}
22+
{# Add controls by default #}
23+
{%- if controls is same as(true) -%}
24+
{%- set attributes = attributes|merge({
25+
'controls': true,
26+
}) -%}
27+
{%- endif -%}
28+
{%- if autoplay is same as(true) -%}
29+
{%- set attributes = attributes|merge({
30+
'autoplay': true,
31+
}) -%}
32+
{%- endif -%}
33+
{%- if loop is same as(true) -%}
34+
{%- set attributes = attributes|merge({
35+
'loop': true,
36+
}) -%}
37+
{%- endif -%}
38+
{%- set attributesCompiled = {} -%}
39+
{%- for key, value in attributes -%}
40+
{%- if value is same as(true) -%}
41+
{%- set attributesCompiled = attributesCompiled|merge([key]) -%}
42+
{%- else -%}
43+
{%- set attributesCompiled = attributesCompiled|merge([key ~ '="' ~ value ~ '"']) -%}
44+
{%- endif -%}
45+
{%- endfor -%}
46+
<audio{% if attributesCompiled|length %} {{ attributesCompiled|join(' ')|raw }}{%- endif -%}>
47+
{%- for source in sources -%}
5048
<source type="{{ source.mime|escape('html_attr') }}" src="{{ source.url }}">
51-
{% endfor %}
52-
{% block audio_fallback %}<p>Your browser does not support native audio.</p>{% endblock %}
49+
{%- endfor -%}
50+
{%- block audio_fallback -%}<p>Your browser does not support native audio.</p>{%- endblock -%}
5351
</audio>
54-
{% endapply %}
Lines changed: 83 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,86 @@
1-
{% apply spaceless %}
2-
{% set attributes = {
3-
'alt' : alt|escape('html_attr'),
4-
} %}
1+
{%- set attributes = {
2+
'alt' : alt|escape('html_attr'),
3+
} -%}
54

6-
{% if alt is empty %}
7-
{% set attributes = attributes|merge({'aria-hidden' : 'true'}) %}
8-
{% endif %}
9-
{% if lazyload %}
10-
{% set attributes = attributes|merge({'data-src' : url}) %}
11-
{% set attributes = attributes|merge({'src' : fallback}) %}
12-
{% if srcset %}
13-
{% set attributes = attributes|merge({'data-srcset' : srcset}) %}
14-
{% endif %}
15-
{% if sizes %}
16-
{% set attributes = attributes|merge({'sizes' : sizes}) %}
17-
{% endif %}
18-
{% if class %}
19-
{% set originalClass = class %}
20-
{% set class = class ~ ' ' ~ lazyload_class %}
21-
{% else %}
22-
{% set originalClass = '' %}
23-
{% set class = lazyload_class %}
24-
{% endif %}
25-
{% else %}
26-
{% set originalClass = class %}
27-
{% set attributes = attributes|merge({'src' : url}) %}
28-
{% if srcset %}
29-
{% set attributes = attributes|merge({'srcset' : srcset}) %}
30-
{% endif %}
31-
{% if sizes %}
32-
{% set attributes = attributes|merge({'sizes' : sizes}) %}
33-
{% endif %}
34-
{% endif %}
5+
{%- if alt is empty -%}
6+
{%- set attributes = attributes|merge({'aria-hidden' : 'true'}) -%}
7+
{%- endif -%}
8+
{%- if lazyload -%}
9+
{%- set attributes = attributes|merge({'data-src' : url}) -%}
10+
{%- set attributes = attributes|merge({'src' : fallback}) -%}
11+
{%- if srcset -%}
12+
{%- set attributes = attributes|merge({'data-srcset' : srcset}) -%}
13+
{%- endif -%}
14+
{%- if sizes -%}
15+
{%- set attributes = attributes|merge({'sizes' : sizes}) -%}
16+
{%- endif -%}
17+
{%- if class -%}
18+
{%- set originalClass = class -%}
19+
{%- set class = class ~ ' ' ~ lazyload_class -%}
20+
{%- else -%}
21+
{%- set originalClass = '' -%}
22+
{%- set class = lazyload_class -%}
23+
{%- endif -%}
24+
{%- else -%}
25+
{%- set originalClass = class -%}
26+
{%- set attributes = attributes|merge({'src' : url}) -%}
27+
{%- if srcset -%}
28+
{%- set attributes = attributes|merge({'srcset' : srcset}) -%}
29+
{%- endif -%}
30+
{%- if sizes -%}
31+
{%- set attributes = attributes|merge({'sizes' : sizes}) -%}
32+
{%- endif -%}
33+
{%- endif -%}
3534

36-
{% if loading %}
37-
{% set attributes = attributes|merge({'loading' : loading|escape('html_attr')}) %}
38-
{% endif %}
39-
{% if averageColor %}
40-
{% set attributes = attributes|merge({
41-
'data-average-color': averageColor|escape('html_attr')
42-
}) %}
43-
{% endif %}
44-
{% if ratio %}
45-
{% set attributes = attributes|merge({
46-
'data-ratio': ratio|escape('html_attr')
47-
}) %}
48-
{% endif %}
49-
{% if width and not sizes %}
50-
{% set attributes = attributes|merge({'width' : width|escape('html_attr')}) %}
51-
{% endif %}
52-
{% if height and not sizes %}
53-
{% set attributes = attributes|merge({'height' : height|escape('html_attr')}) %}
54-
{% endif %}
55-
{% if width and ratio and not height and not sizes %}
56-
{% set attributes = attributes|merge({'height' : (width / ratio)|round|escape('html_attr')}) %}
57-
{% endif %}
58-
{% if height and ratio and not width and not sizes %}
59-
{% set attributes = attributes|merge({'width' : (height * ratio)|round|escape('html_attr')}) %}
60-
{% endif %}
61-
{% if class %}
62-
{% set attributes = attributes|merge({'class' : class|escape('html_attr')}) %}
63-
{% endif %}
64-
{% if identifier %}
65-
{% set attributes = attributes|merge({'id' : identifier|escape('html_attr')}) %}
66-
{% endif %}
35+
{%- if loading -%}
36+
{%- set attributes = attributes|merge({'loading' : loading|escape('html_attr')}) -%}
37+
{%- endif -%}
38+
{%- if averageColor -%}
39+
{%- set attributes = attributes|merge({
40+
'data-average-color': averageColor|escape('html_attr')
41+
}) -%}
42+
{%- endif -%}
43+
{%- if ratio -%}
44+
{%- set attributes = attributes|merge({
45+
'data-ratio': ratio|escape('html_attr')
46+
}) -%}
47+
{%- endif -%}
48+
{%- if width and not sizes -%}
49+
{%- set attributes = attributes|merge({'width' : width|escape('html_attr')}) -%}
50+
{%- endif -%}
51+
{%- if height and not sizes -%}
52+
{%- set attributes = attributes|merge({'height' : height|escape('html_attr')}) -%}
53+
{%- endif -%}
54+
{%- if width and ratio and not height and not sizes -%}
55+
{%- set attributes = attributes|merge({'height' : (width / ratio)|round|escape('html_attr')}) -%}
56+
{%- endif -%}
57+
{%- if height and ratio and not width and not sizes -%}
58+
{%- set attributes = attributes|merge({'width' : (height * ratio)|round|escape('html_attr')}) -%}
59+
{%- endif -%}
60+
{%- if class -%}
61+
{%- set attributes = attributes|merge({'class' : class|escape('html_attr')}) -%}
62+
{%- endif -%}
63+
{%- if identifier -%}
64+
{%- set attributes = attributes|merge({'id' : identifier|escape('html_attr')}) -%}
65+
{%- endif -%}
6766

68-
{% set attributesCompiled = {} %}
69-
{% for key, value in attributes %}
70-
{% if value is same as(true) %}
71-
{% set attributesCompiled = attributesCompiled|merge([key]) %}
72-
{% else %}
73-
{% set attributesCompiled = attributesCompiled|merge([key ~ '="' ~ value ~ '"']) %}
74-
{% endif %}
75-
{% endfor %}
76-
77-
<img {{ attributesCompiled|join(' ')|raw }} />
78-
{% if lazyload and not avoidNoScript %}
79-
{% block noscript %}
80-
<noscript{% block noscript_attributes %}{% endblock %}>
81-
{% include 'documents/image.html.twig' with {
82-
'lazyload': false,
83-
'class': originalClass,
84-
'avoidNoScript': true
85-
} %}
86-
</noscript>
87-
{% endblock %}
88-
{% endif %}
89-
{% endapply %}
67+
{%- set attributesCompiled = {} -%}
68+
{%- for key, value in attributes -%}
69+
{%- if value is same as(true) -%}
70+
{%- set attributesCompiled = attributesCompiled|merge([key]) -%}
71+
{%- else -%}
72+
{%- set attributesCompiled = attributesCompiled|merge([key ~ '="' ~ value ~ '"']) -%}
73+
{%- endif -%}
74+
{%- endfor -%}
75+
<img {{ attributesCompiled|join(' ')|raw }} />
76+
{%- if lazyload and not avoidNoScript -%}
77+
{%- block noscript -%}
78+
<noscript{% block noscript_attributes %}{%- endblock -%}>
79+
{%- include 'documents/image.html.twig' with {
80+
'lazyload': false,
81+
'class': originalClass,
82+
'avoidNoScript': true
83+
} -%}
84+
</noscript>
85+
{%- endblock -%}
86+
{%- endif -%}
Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1-
{% apply spaceless %}
2-
{% set attributes = {
3-
'type': "application/pdf"|escape('html_attr'),
4-
'data': url,
5-
} %}
6-
{% if width %}
7-
{% set attributes = attributes|merge({
8-
'width': width|escape('html_attr'),
9-
}) %}
10-
{% endif %}
11-
{% if height %}
12-
{% set attributes = attributes|merge({
13-
'height': height|escape('html_attr'),
14-
}) %}
15-
{% endif %}
16-
{% if class %}
17-
{% set attributes = attributes|merge({
18-
'class': class|escape('html_attr'),
19-
}) %}
20-
{% endif %}
21-
{% if identifier %}
22-
{% set attributes = attributes|merge({
23-
'id': identifier|escape('html_attr'),
24-
}) %}
25-
{% endif %}
26-
{% set attributesCompiled = {} %}
27-
{% for key, value in attributes %}
28-
{% if value is same as(true) %}
29-
{% set attributesCompiled = attributesCompiled|merge([key]) %}
30-
{% else %}
31-
{% set attributesCompiled = attributesCompiled|merge([key ~ '="' ~ value ~ '"']) %}
32-
{% endif %}
33-
{% endfor %}
34-
<object {{ attributesCompiled|join(' ')|raw }}>
1+
{%- set attributes = {
2+
'type': "application/pdf"|escape('html_attr'),
3+
'data': url,
4+
} -%}
5+
{%- if width -%}
6+
{%- set attributes = attributes|merge({
7+
'width': width|escape('html_attr'),
8+
}) -%}
9+
{%- endif -%}
10+
{%- if height -%}
11+
{%- set attributes = attributes|merge({
12+
'height': height|escape('html_attr'),
13+
}) -%}
14+
{%- endif -%}
15+
{%- if class -%}
16+
{%- set attributes = attributes|merge({
17+
'class': class|escape('html_attr'),
18+
}) -%}
19+
{%- endif -%}
20+
{%- if identifier -%}
21+
{%- set attributes = attributes|merge({
22+
'id': identifier|escape('html_attr'),
23+
}) -%}
24+
{%- endif -%}
25+
{%- set attributesCompiled = {} -%}
26+
{%- for key, value in attributes -%}
27+
{%- if value is same as(true) -%}
28+
{%- set attributesCompiled = attributesCompiled|merge([key]) -%}
29+
{%- else -%}
30+
{%- set attributesCompiled = attributesCompiled|merge([key ~ '="' ~ value ~ '"']) -%}
31+
{%- endif -%}
32+
{%- endfor -%}
33+
<object {{ attributesCompiled|join(' ')|raw -}}>
3534
{%- block pdf_fallback -%}<p>Your browser does not support PDF native viewer.</p>{%- endblock -%}
3635
</object>
37-
{% endapply %}

0 commit comments

Comments
 (0)