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

Skip to content

Commit 6ae444f

Browse files
committed
Merge branch '5.2' into 5.x
* 5.2: Fixed syntax errors on 4.4
2 parents 4fa5ab4 + 6b19707 commit 6ae444f

35 files changed

+88
-64
lines changed

components/console/helpers/formatterhelper.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,9 @@ you can write::
7878
$truncatedMessage = $formatter->truncate($message, 7);
7979
$output->writeln($truncatedMessage);
8080

81-
And the output will be::
81+
And the output will be:
82+
83+
.. code-block:: text
8284
8385
This is...
8486
@@ -93,7 +95,9 @@ from the end of the string::
9395

9496
$truncatedMessage = $formatter->truncate($message, -5);
9597

96-
This will result in::
98+
This will result in:
99+
100+
.. code-block:: text
97101
98102
This is a very long message, which should be trun...
99103

components/console/helpers/table.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ You can add a table separator anywhere in the output by passing an instance of
7272
You can optionally display titles at the top and the bottom of the table::
7373

7474
// ...
75-
$table->setHeaderTitle('Books')
76-
$table->setFooterTitle('Page 1/2')
75+
$table->setHeaderTitle('Books');
76+
$table->setFooterTitle('Page 1/2');
7777
$table->render();
7878

7979
.. code-block:: terminal

components/dom_crawler.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,9 @@ You can virtually set and get values on the form::
524524
// where "registration" is its own array
525525
$values = $form->getPhpValues();
526526

527-
To work with multi-dimensional fields::
527+
To work with multi-dimensional fields:
528+
529+
.. code-block:: html
528530

529531
<form>
530532
<input name="multi[]"/>

components/event_dispatcher.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ determine which instance is passed.
238238
$containerBuilder->addCompilerPass(new AddEventAliasesPass([
239239
\AcmeFooActionEvent::class => 'acme.foo.action',
240240
]));
241-
$containerBuilder->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING)
241+
$containerBuilder->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING);
242242

243243
$containerBuilder->register('event_dispatcher', EventDispatcher::class);
244244

components/filesystem.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ absolute paths and returns the relative path from the second path to the first o
252252
'/var/lib/symfony/src/Symfony/Component'
253253
);
254254
// returns 'videos/'
255-
$filesystem->makePathRelative('/tmp/videos', '/tmp')
255+
$filesystem->makePathRelative('/tmp/videos', '/tmp');
256256

257257
``mirror``
258258
~~~~~~~~~~

components/http_foundation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ represented by a PHP callable instead of a string::
585585
header in the response::
586586

587587
// disables FastCGI buffering in nginx only for this response
588-
$response->headers->set('X-Accel-Buffering', 'no')
588+
$response->headers->set('X-Accel-Buffering', 'no');
589589

590590
.. _component-http-foundation-serving-files:
591591

components/intl.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ translate into any locale with the ``getName()`` method shown earlier::
328328
The reverse lookup is also possible thanks to the ``getCountryCode()`` method,
329329
which returns the code of the country where the given timezone ID belongs to::
330330

331-
$countryCode = Timezones::getCountryCode('America/Vancouver')
331+
$countryCode = Timezones::getCountryCode('America/Vancouver');
332332
// => $countryCode = 'CA' (CA = Canada)
333333

334334
The `UTC/GMT time offsets`_ of all timezones are provided by ``getRawOffset()``

components/lock.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ method can be safely called repeatedly, even if the lock is already acquired.
5858

5959
Unlike other implementations, the Lock Component distinguishes lock
6060
instances even when they are created for the same resource. It means that for
61-
a given scope and resource one lock instance can be acquired multiple times.
61+
a given scope and resource one lock instance can be acquired multiple times.
6262
If a lock has to be used by several services, they should share the same ``Lock``
6363
instance returned by the ``LockFactory::createLock`` method.
6464

@@ -230,7 +230,7 @@ Lock will be released automatically as soon as one process finishes::
230230
sleep(30);
231231
} else {
232232
// Child process
233-
echo 'The lock will be released now.'
233+
echo 'The lock will be released now.';
234234
exit(0);
235235
}
236236
// ...

components/options_resolver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ the closure::
507507

508508
$resolver->setDefault('host', function (Options $options, $previousValue) {
509509
if ('ssl' === $options['encryption']) {
510-
return 'secure.example.org'
510+
return 'secure.example.org';
511511
}
512512

513513
// Take default value configured in the base class

components/security/authorization.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ expressions have access to a number of
207207

208208
$expression = new Expression(
209209
'"ROLE_ADMIN" in role_names or (not is_anonymous() and user.isSuperAdmin())'
210-
)
210+
);
211211

212212
$vote = $expressionVoter->vote($token, $object, [$expression]);
213213

components/serializer.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,9 @@ For example, take an object normalized as following::
10151015

10161016
['foo' => [1, 2], 'bar' => true];
10171017

1018-
The ``XmlEncoder`` will encode this object like that::
1018+
The ``XmlEncoder`` will encode this object like that:
1019+
1020+
.. code-block:: xml
10191021
10201022
<?xml version="1.0" encoding="UTF-8" ?>
10211023
<response>

components/validator/resources.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ implement the PSR-6 interface :class:`Psr\\Cache\\CacheItemPoolInterface`)::
157157

158158
$validator = Validation::createValidatorBuilder()
159159
// ... add loaders
160-
->setMappingCache(new SomePsr6Cache());
160+
->setMappingCache(new SomePsr6Cache())
161161
->getValidator();
162162

163163
.. note::

components/workflow.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ are trying to use it with::
6868
use Symfony\Component\Workflow\Registry;
6969
use Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy;
7070

71-
$blogPostWorkflow = ...
72-
$newsletterWorkflow = ...
71+
$blogPostWorkflow = ...;
72+
$newsletterWorkflow = ...;
7373

7474
$registry = new Registry();
7575
$registry->addWorkflow($blogPostWorkflow, new InstanceOfSupportStrategy(BlogPost::class));

configuration/override_dir_structure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ option in your ``composer.json`` file like this:
238238
"config": {
239239
"bin-dir": "bin",
240240
"vendor-dir": "/some/dir/vendor"
241-
},
241+
}
242242
}
243243
244244
.. tip::

configuration/using_parameters_in_dic.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ Now, examine the results to see this closely:
8585
// true/false (depends on 2nd parameter of Kernel),
8686
// as expected, because %kernel.debug% inside configuration
8787
// gets evaluated before being passed to the extension
88-
)
89-
];
88+
]
89+
);
9090
9191
$container->loadFromExtension('my_bundle');
9292
// passes the string "%kernel.debug%".

contributing/code/conventions.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,19 @@ after the use declarations, like in this example from `ServiceRouterLoader`_::
183183

184184
.. _`ServiceRouterLoader`: https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Routing/Loader/DependencyInjection/ServiceRouterLoader.php
185185

186-
The deprecation must be added to the ``CHANGELOG.md`` file of the impacted component::
186+
The deprecation must be added to the ``CHANGELOG.md`` file of the impacted component:
187+
188+
.. code-block:: markdown
187189
188190
4.4
189191
---
190192
191193
* Deprecate the `Deprecated` class, use `Replacement` instead
192194
193195
It must also be added to the ``UPGRADE.md`` file of the targeted minor version
194-
(``UPGRADE-4.4.md`` in our example)::
196+
(``UPGRADE-4.4.md`` in our example):
197+
198+
.. code-block:: markdown
195199
196200
DependencyInjection
197201
-------------------

controller/soap_web_service.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ In this case, the SOAP service will allow the client to call a method called
3939
public function hello($name)
4040
{
4141

42-
$message = new \Swift_Message('Hello Service')
42+
$message = (new \Swift_Message('Hello Service'))
4343
->setTo('[email protected]')
4444
->setBody($name.' says hi!');
4545

create_framework/front_controller.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ the ``setContent()`` directly from the front controller script::
185185

186186
// ...
187187

188-
And the ``hello.php`` script can now be converted to a template::
188+
And the ``hello.php`` script can now be converted to a template:
189+
190+
.. code-block:: html+php
189191

190192
<!-- example.com/src/pages/hello.php -->
191193
<?php $name = $request->get('name', 'World') ?>

create_framework/routing.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@ framework just a little to make templates even more readable::
3030
$response->send();
3131

3232
As we now extract the request query parameters, simplify the ``hello.php``
33-
template as follows::
33+
template as follows:
34+
35+
.. code-block:: html+php
3436

3537
<!-- example.com/src/pages/hello.php -->
3638
Hello <?= htmlspecialchars(isset($name) ? $name : 'World', ENT_QUOTES, 'UTF-8') ?>
@@ -161,7 +163,9 @@ There are a few new things in the code:
161163

162164
* ``500`` errors are now managed correctly;
163165

164-
* Request attributes are extracted to keep our templates simple::
166+
* Request attributes are extracted to keep our templates simple:
167+
168+
.. code-block:: html+php
165169

166170
// example.com/src/pages/hello.php
167171
Hello <?= htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>

doctrine/custom_dql_functions.rst

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -131,16 +131,14 @@ In Symfony, you can register your custom DQL functions as follows:
131131
use App\DQL\DatetimeFunction;
132132
133133
$container->loadFromExtension('doctrine', [
134-
'doctrine' => [
135-
'orm' => [
136-
// ...
137-
'entity_managers' => [
138-
'example_manager' => [
139-
// place your functions here
140-
'dql' => [
141-
'datetime_functions' => [
142-
'test_datetime' => DatetimeFunction::class,
143-
],
134+
'orm' => [
135+
// ...
136+
'entity_managers' => [
137+
'example_manager' => [
138+
// place your functions here
139+
'dql' => [
140+
'datetime_functions' => [
141+
'test_datetime' => DatetimeFunction::class,
144142
],
145143
],
146144
],

form/create_form_type_extension.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,14 +191,10 @@ Specifically, you need to override the ``file_widget`` block:
191191
{% extends 'form_div_layout.html.twig' %}
192192

193193
{% block file_widget %}
194-
{% spaceless %}
195-
196194
{{ block('form_widget') }}
197195
{% if image_url is not null %}
198196
<img src="{{ asset(image_url) }}"/>
199197
{% endif %}
200-
201-
{% endspaceless %}
202198
{% endblock %}
203199

204200
Be sure to :ref:`configure this form theme template <forms-theming-global>` so that

form/data_transformers.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ to and from the issue number and the ``Issue`` object::
208208
{
209209
// no issue number? It's optional, so that's ok
210210
if (!$issueNumber) {
211-
return;
211+
return null;
212212
}
213213

214214
$issue = $this->entityManager

form/type_guesser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
101101
$annotations = $this->readPhpDocAnnotations($class, $property);
102102

103103
if (!isset($annotations['var'])) {
104-
return; // guess nothing if the @var annotation is not available
104+
return null; // guess nothing if the @var annotation is not available
105105
}
106106

107107
// otherwise, base the type on the @var annotation

form/validation_group_service_resolver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Then in your form, inject the resolver and set it as the ``validation_groups``::
3939
namespace App\Form;
4040

4141
use App\Validator\ValidationGroupResolver;
42-
use Symfony\Component\Form\AbstractType
42+
use Symfony\Component\Form\AbstractType;
4343
use Symfony\Component\OptionsResolver\OptionsResolver;
4444

4545
class MyClassType extends AbstractType

forms.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ argument of ``createForm()``::
655655
{
656656
$task = new Task();
657657
// use some PHP logic to decide if this form field is required or not
658-
$dueDateIsRequired = ...
658+
$dueDateIsRequired = ...;
659659

660660
$form = $this->createForm(TaskType::class, $task, [
661661
'require_due_date' => $dueDateIsRequired,

http_client.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ To abort a request (e.g. because it didn't complete in due time, or you want to
979979
fetch only the first bytes of the response, etc.), you can either use the
980980
``cancel()`` method of ``ResponseInterface``::
981981

982-
$response->cancel()
982+
$response->cancel();
983983

984984
Or throw an exception from a progress callback::
985985

introduction/from_flat_php_to_symfony.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ and uses Twig:
580580

581581
.. code-block:: html+twig
582582

583-
<!-- templates/blog/list.html.twig -->
583+
{# templates/blog/list.html.twig #}
584584
{% extends 'base.html.twig' %}
585585

586586
{% block title %}List of Posts{% endblock %}

mercure.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ You can instead make use of the `MockHub`::
623623

624624
$controller = new MessageController($hub);
625625

626-
...
626+
// ...
627627
}
628628
}
629629

@@ -646,13 +646,14 @@ During functional testing you can instead decorate the Hub::
646646
}
647647

648648
HubStub decorates the default hub service so no updates are actually
649-
sent. Here is the HubStub implementation::
649+
sent. Here is the HubStub implementation:
650+
651+
.. code-block:: yaml
650652
651653
# config/services_test.yaml
652654
App\Tests\Functional\Fixtures\HubStub:
653655
decorates: mercure.hub.default
654656
655-
656657
Debugging
657658
---------
658659

migration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,11 @@ somewhat like this::
316316

317317
class LegacyBridge
318318
{
319-
public static function prepareLegacyScript(Request $request, Response $response, string $publicDirectory): string
319+
public static function prepareLegacyScript(Request $request, Response $response, string $publicDirectory): ?string
320320
{
321321
// If Symfony successfully handled the route, you do not have to do anything.
322322
if (false === $response->isNotFound()) {
323-
return;
323+
return null;
324324
}
325325

326326
// Figure out how to map to the needed script file

reference/configuration/framework.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,9 @@ Since every developer uses a different IDE, the recommended way to enable this
462462
feature is to configure it on a system level. This can be done by setting the
463463
``xdebug.file_link_format`` option in your ``php.ini`` configuration file. The
464464
format to use is the same as for the ``framework.ide`` option, but without the
465-
need to escape the percent signs (``%``) by doubling them::
465+
need to escape the percent signs (``%``) by doubling them:
466+
467+
.. code-block:: ini
466468
467469
// example for PhpStorm
468470
xdebug.file_link_format="phpstorm://open?file=%f&line=%l"
@@ -485,7 +487,9 @@ need to escape the percent signs (``%``) by doubling them::
485487
When running your app in a container or in a virtual machine, you can tell
486488
Symfony to map files from the guest to the host by changing their prefix.
487489
This map should be specified at the end of the URL template, using ``&`` and
488-
``>`` as guest-to-host separators::
490+
``>`` as guest-to-host separators:
491+
492+
.. code-block:: text
489493
490494
// /path/to/guest/.../file will be opened
491495
// as /path/to/host/.../file on the host

0 commit comments

Comments
 (0)