Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79e1d8d

Browse files
committed
Merge branch '6.1' into 6.2
* 6.1: prevent the installation of unstable phpdocumentor/type-resolver releases chore: fix typo 'do' verb [Twig Bridge] Add PHPdoc information to some email methods Amend MoneyType twig to include a space. Convert previously defined date attribute to the expected class [WebProfilerBundle] Remove redundant code from logger template
2 parents 8eab68d + c110fb8 commit 79e1d8d

File tree

14 files changed

+44
-22
lines changed

14 files changed

+44
-22
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
"egulias/email-validator": "~3.0.0",
158158
"masterminds/html5": "<2.6",
159159
"phpdocumentor/reflection-docblock": "<5.2",
160-
"phpdocumentor/type-resolver": "<1.5.1",
160+
"phpdocumentor/type-resolver": "<1.5.1|>=1.7.0",
161161
"phpunit/phpunit": "<5.4.3"
162162
},
163163
"config": {

src/Symfony/Bridge/Twig/Mime/WrappedTemplatedEmail.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public function toName(): string
3737
return $this->message->getTo()[0]->getName();
3838
}
3939

40+
/**
41+
* @param string $image A Twig path to the image file. It's recommended to define
42+
* some Twig namespace for email images (e.g. '@email/images/logo.png').
43+
* @param string|null $contentType The media type (i.e. MIME type) of the image file (e.g. 'image/png').
44+
* Some email clients require this to display embedded images.
45+
*/
4046
public function image(string $image, string $contentType = null): string
4147
{
4248
$file = $this->twig->getLoader()->getSourceContext($image);
@@ -46,6 +52,13 @@ public function image(string $image, string $contentType = null): string
4652
return 'cid:'.$image;
4753
}
4854

55+
/**
56+
* @param string $file A Twig path to the file. It's recommended to define
57+
* some Twig namespace for email files (e.g. '@email/files/contract.pdf').
58+
* @param string|null $name A custom file name that overrides the original name of the attached file.
59+
* @param string|null $contentType The media type (i.e. MIME type) of the file (e.g. 'application/pdf').
60+
* Some email clients require this to display attached files.
61+
*/
4962
public function attach(string $file, string $name = null, string $contentType = null): void
5063
{
5164
$file = $this->twig->getLoader()->getSourceContext($file);

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_4_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{%- set prepend = not (money_pattern starts with '{{') -%}
77
{%- set append = not (money_pattern ends with '}}') -%}
88
{%- if prepend or append -%}
9-
<div class="input-group{{ group_class|default('') }}">
9+
<div class="input-group {{ group_class|default('') }}">
1010
{%- if prepend -%}
1111
<div class="input-group-prepend">
1212
<span class="input-group-text">{{ money_pattern|form_encode_currency }}</span>

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_5_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
{%- set prepend = not (money_pattern starts with '{{') -%}
77
{%- set append = not (money_pattern ends with '}}') -%}
88
{%- if prepend or append -%}
9-
<div class="input-group{{ group_class|default('') }}">
9+
<div class="input-group {{ group_class|default('') }}">
1010
{%- if prepend -%}
1111
<span class="input-group-text">{{ money_pattern|form_encode_currency }}</span>
1212
{%- endif -%}

src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_base_layout.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
{% set prepend = not (money_pattern starts with '{{') %}
1212
{% set append = not (money_pattern ends with '}}') %}
1313
{% if prepend or append %}
14-
<div class="input-group{{ group_class|default('') }}">
14+
<div class="input-group {{ group_class|default('') }}">
1515
{% if prepend %}
1616
<span class="input-group-addon">{{ money_pattern|form_encode_currency }}</span>
1717
{% endif %}

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap4LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1165,7 +1165,7 @@ public function testMoney()
11651165

11661166
$this->assertWidgetMatchesXpath($form->createView(), ['id' => 'my&id', 'attr' => ['class' => 'my&class']],
11671167
'/div
1168-
[@class="input-group"]
1168+
[@class="input-group "]
11691169
[
11701170
./div
11711171
[@class="input-group-prepend"]

src/Symfony/Bridge/Twig/Tests/Extension/AbstractBootstrap5LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ public function testMoney()
14651465

14661466
$this->assertWidgetMatchesXpath($form->createView(), ['id' => 'my&id', 'attr' => ['class' => 'my&class']],
14671467
'/div
1468-
[@class="input-group"]
1468+
[@class="input-group "]
14691469
[
14701470
./span
14711471
[@class="input-group-text"]

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap4LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function testMoneyWidgetInIso()
102102
;
103103

104104
$this->assertSame(<<<'HTML'
105-
<div class="input-group"><div class="input-group-prepend">
105+
<div class="input-group "><div class="input-group-prepend">
106106
<span class="input-group-text">&euro; </span>
107107
</div><input type="text" id="name" name="name" required="required" class="form-control" /></div>
108108
HTML

src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap5LayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function testMoneyWidgetInIso()
104104
->createView();
105105

106106
self::assertSame(<<<'HTML'
107-
<div class="input-group"><span class="input-group-text">&euro; </span><input type="text" id="name" name="name" required="required" class="form-control" /></div>
107+
<div class="input-group "><span class="input-group-text">&euro; </span><input type="text" id="name" name="name" required="required" class="form-control" /></div>
108108
HTML
109109
, trim($this->renderWidget($view)));
110110
}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,6 @@
253253
{% if has_trace %}
254254
{% set trace_id = 'trace-' ~ category ~ '-' ~ log_index %}
255255
<span><button type="button" class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ trace_id }}" data-toggle-alt-content="Hide trace">Show trace</button></span>
256-
257-
<div id="{{ trace_id }}" class="context sf-toggle-content sf-toggle-hidden">
258-
{{ profiler_dump(log.context.exception.trace, maxDepth=1) }}
259-
</div>
260256
{% endif %}
261257

262258
{% if has_context %}

src/Symfony/Component/HttpFoundation/Exception/SessionNotFoundException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
namespace Symfony\Component\HttpFoundation\Exception;
1313

1414
/**
15-
* Raised when a session does not exists. This happens in the following cases:
15+
* Raised when a session does not exist. This happens in the following cases:
1616
* - the session is not enabled
1717
* - attempt to read a session outside a request context (ie. cli script).
1818
*

src/Symfony/Component/HttpKernel/Controller/ArgumentResolver/DateTimeValueResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,16 @@ public function resolve(Request $request, ArgumentMetadata $argument): array
4343
}
4444

4545
$value = $request->attributes->get($argument->getName());
46+
$class = \DateTimeInterface::class === $argument->getType() ? \DateTimeImmutable::class : $argument->getType();
4647

4748
if ($value instanceof \DateTimeInterface) {
48-
return [$value];
49+
return [$value instanceof $class ? $value : $class::createFromInterface($value)];
4950
}
5051

5152
if ($argument->isNullable() && !$value) {
5253
return [null];
5354
}
5455

55-
$class = \DateTimeInterface::class === $argument->getType() ? \DateTimeImmutable::class : $argument->getType();
5656
$format = null;
5757

5858
if ($attributes = $argument->getAttributes(MapDateTime::class, ArgumentMetadata::IS_INSTANCEOF)) {

src/Symfony/Component/HttpKernel/Tests/Controller/ArgumentResolver/DateTimeValueResolverTest.php

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
class DateTimeValueResolverTest extends TestCase
2222
{
23-
private $defaultTimezone;
23+
private readonly string $defaultTimezone;
2424

2525
protected function setUp(): void
2626
{
@@ -32,13 +32,20 @@ protected function tearDown(): void
3232
date_default_timezone_set($this->defaultTimezone);
3333
}
3434

35-
public function getTimeZones()
35+
public static function getTimeZones()
3636
{
3737
yield ['UTC'];
3838
yield ['Etc/GMT+9'];
3939
yield ['Etc/GMT-14'];
4040
}
4141

42+
public static function getClasses()
43+
{
44+
yield [\DateTimeInterface::class];
45+
yield [\DateTime::class];
46+
yield [FooDateTime::class];
47+
}
48+
4249
/**
4350
* @group legacy
4451
*/
@@ -137,17 +144,23 @@ public function testNow(string $timezone)
137144
$this->assertSame($timezone, $results[0]->getTimezone()->getName(), 'Default timezone');
138145
}
139146

140-
public function testPreviouslyConvertedAttribute()
147+
/**
148+
* @param class-string<\DateTimeInterface> $class
149+
*
150+
* @dataProvider getClasses
151+
*/
152+
public function testPreviouslyConvertedAttribute(string $class)
141153
{
142154
$resolver = new DateTimeValueResolver();
143155

144-
$argument = new ArgumentMetadata('dummy', \DateTimeImmutable::class, false, false, null, true);
156+
$argument = new ArgumentMetadata('dummy', $class, false, false, null, true);
145157
$request = self::requestWithAttributes(['dummy' => $datetime = new \DateTimeImmutable()]);
146158

147159
$results = $resolver->resolve($request, $argument);
148160

149161
$this->assertCount(1, $results);
150-
$this->assertSame($datetime, $results[0]);
162+
$this->assertEquals($datetime, $results[0], 'The value is the same, but the class can be modified.');
163+
$this->assertInstanceOf($class, $results[0]);
151164
}
152165

153166
public function testCustomClass()
@@ -205,7 +218,7 @@ public function testWithFormat(string $timezone)
205218
$this->assertEquals('2016-09-08 12:34:56', $results[0]->format('Y-m-d H:i:s'));
206219
}
207220

208-
public function provideInvalidDates()
221+
public static function provideInvalidDates()
209222
{
210223
return [
211224
'invalid date' => [

src/Symfony/Component/Serializer/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"conflict": {
4343
"doctrine/annotations": "<1.12",
4444
"phpdocumentor/reflection-docblock": "<3.2.2",
45-
"phpdocumentor/type-resolver": "<1.4.0",
45+
"phpdocumentor/type-resolver": "<1.4.0|>=1.7.0",
4646
"symfony/dependency-injection": "<5.4",
4747
"symfony/property-access": "<5.4",
4848
"symfony/property-info": "<5.4",

0 commit comments

Comments
 (0)