Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Merge branch '4.4' into 5.2
Browse files Browse the repository at this point in the history
* 4.4:
  Fixed syntax errors on 4.4
  • Loading branch information
javiereguiluz committed Apr 21, 2021
2 parents a91de90 + 5398a93 commit 6b19707
Show file tree
Hide file tree
Showing 35 changed files with 92 additions and 68 deletions.
8 changes: 6 additions & 2 deletions components/console/helpers/formatterhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ you can write::
$truncatedMessage = $formatter->truncate($message, 7);
$output->writeln($truncatedMessage);

And the output will be::
And the output will be:

.. code-block:: text
This is...
Expand All @@ -93,7 +95,9 @@ from the end of the string::

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

This will result in::
This will result in:

.. code-block:: text
This is a very long message, which should be trun...
Expand Down
4 changes: 2 additions & 2 deletions components/console/helpers/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ You can add a table separator anywhere in the output by passing an instance of
You can optionally display titles at the top and the bottom of the table::

// ...
$table->setHeaderTitle('Books')
$table->setFooterTitle('Page 1/2')
$table->setHeaderTitle('Books');
$table->setFooterTitle('Page 1/2');
$table->render();

.. code-block:: terminal
Expand Down
4 changes: 3 additions & 1 deletion components/dom_crawler.rst
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ You can virtually set and get values on the form::
// where "registration" is its own array
$values = $form->getPhpValues();

To work with multi-dimensional fields::
To work with multi-dimensional fields:

.. code-block:: html

<form>
<input name="multi[]"/>
Expand Down
2 changes: 1 addition & 1 deletion components/event_dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ determine which instance is passed.
$containerBuilder->addCompilerPass(new AddEventAliasesPass([
\AcmeFooActionEvent::class => 'acme.foo.action',
]));
$containerBuilder->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING)
$containerBuilder->addCompilerPass(new RegisterListenersPass(), PassConfig::TYPE_BEFORE_REMOVING);

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

Expand Down
2 changes: 1 addition & 1 deletion components/filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ absolute paths and returns the relative path from the second path to the first o
'/var/lib/symfony/src/Symfony/Component'
);
// returns 'videos/'
$filesystem->makePathRelative('/tmp/videos', '/tmp')
$filesystem->makePathRelative('/tmp/videos', '/tmp');

``mirror``
~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion components/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ represented by a PHP callable instead of a string::
header in the response::

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

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

Expand Down
10 changes: 5 additions & 5 deletions components/intl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ The Intl Component
.. caution::

The replacement layer is limited to the ``en`` locale. If you want to use
other locales, you should `install the intl extension`_. There is no conflict
other locales, you should `install the intl extension`_. There is no conflict
between the two because, even if you use the extension, this package can still
be useful to access the ICU data.

Expand Down Expand Up @@ -211,9 +211,9 @@ Locales
~~~~~~~

A locale is the combination of a language, a region and some parameters that
define the interface preferences of the user. For example, "Chinese" is the
language and ``zh_Hans_MO`` is the locale for "Chinese" (language) + "Simplified"
(script) + "Macau SAR China" (region). The ``Locales`` class provides access to
define the interface preferences of the user. For example, "Chinese" is the
language and ``zh_Hans_MO`` is the locale for "Chinese" (language) + "Simplified"
(script) + "Macau SAR China" (region). The ``Locales`` class provides access to
the name of all locales::

use Symfony\Component\Intl\Locales;
Expand Down Expand Up @@ -323,7 +323,7 @@ translate into any locale with the ``getName()`` method shown earlier::
The reverse lookup is also possible thanks to the ``getCountryCode()`` method,
which returns the code of the country where the given timezone ID belongs to::

$countryCode = Timezones::getCountryCode('America/Vancouver')
$countryCode = Timezones::getCountryCode('America/Vancouver');
// => $countryCode = 'CA' (CA = Canada)

The `UTC/GMT time offsets`_ of all timezones are provided by ``getRawOffset()``
Expand Down
4 changes: 2 additions & 2 deletions components/lock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ method can be safely called repeatedly, even if the lock is already acquired.

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

Expand Down Expand Up @@ -230,7 +230,7 @@ Lock will be released automatically as soon as one process finishes::
sleep(30);
} else {
// Child process
echo 'The lock will be released now.'
echo 'The lock will be released now.';
exit(0);
}
// ...
Expand Down
2 changes: 1 addition & 1 deletion components/options_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ the closure::

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

// Take default value configured in the base class
Expand Down
2 changes: 1 addition & 1 deletion components/security/authorization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ expressions have access to a number of

$expression = new Expression(
'"ROLE_ADMIN" in role_names or (not is_anonymous() and user.isSuperAdmin())'
)
);

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

Expand Down
4 changes: 3 additions & 1 deletion components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,9 @@ For example, take an object normalized as following::

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

The ``XmlEncoder`` will encode this object like that::
The ``XmlEncoder`` will encode this object like that:

.. code-block:: xml
<?xml version="1.0" encoding="UTF-8" ?>
<response>
Expand Down
2 changes: 1 addition & 1 deletion components/validator/resources.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ implement the PSR-6 interface :class:`Psr\\Cache\\CacheItemPoolInterface`)::

$validator = Validation::createValidatorBuilder()
// ... add loaders
->setMappingCache(new SomePsr6Cache());
->setMappingCache(new SomePsr6Cache())
->getValidator();

.. note::
Expand Down
4 changes: 2 additions & 2 deletions components/workflow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ are trying to use it with::
use Symfony\Component\Workflow\Registry;
use Symfony\Component\Workflow\SupportStrategy\InstanceOfSupportStrategy;

$blogPostWorkflow = ...
$newsletterWorkflow = ...
$blogPostWorkflow = ...;
$newsletterWorkflow = ...;

$registry = new Registry();
$registry->addWorkflow($blogPostWorkflow, new InstanceOfSupportStrategy(BlogPost::class));
Expand Down
2 changes: 1 addition & 1 deletion configuration/override_dir_structure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ option in your ``composer.json`` file like this:
"config": {
"bin-dir": "bin",
"vendor-dir": "/some/dir/vendor"
},
}
}
.. tip::
Expand Down
4 changes: 2 additions & 2 deletions configuration/using_parameters_in_dic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ Now, examine the results to see this closely:
// true/false (depends on 2nd parameter of Kernel),
// as expected, because %kernel.debug% inside configuration
// gets evaluated before being passed to the extension
)
];
]
);
$container->loadFromExtension('my_bundle');
// passes the string "%kernel.debug%".
Expand Down
8 changes: 6 additions & 2 deletions contributing/code/conventions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,19 @@ after the use declarations, like in this example from `ServiceRouterLoader`_::

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

The deprecation must be added to the ``CHANGELOG.md`` file of the impacted component::
The deprecation must be added to the ``CHANGELOG.md`` file of the impacted component:

.. code-block:: markdown
4.4
---
* Deprecate the `Deprecated` class, use `Replacement` instead
It must also be added to the ``UPGRADE.md`` file of the targeted minor version
(``UPGRADE-4.4.md`` in our example)::
(``UPGRADE-4.4.md`` in our example):

.. code-block:: markdown
DependencyInjection
-------------------
Expand Down
2 changes: 1 addition & 1 deletion controller/soap_web_service.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ In this case, the SOAP service will allow the client to call a method called
public function hello($name)
{

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

Expand Down
4 changes: 3 additions & 1 deletion create_framework/front_controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ the ``setContent()`` directly from the front controller script::

// ...

And the ``hello.php`` script can now be converted to a template::
And the ``hello.php`` script can now be converted to a template:

.. code-block:: html+php

<!-- example.com/src/pages/hello.php -->
<?php $name = $request->get('name', 'World') ?>
Expand Down
8 changes: 6 additions & 2 deletions create_framework/routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ framework just a little to make templates even more readable::
$response->send();

As we now extract the request query parameters, simplify the ``hello.php``
template as follows::
template as follows:

.. code-block:: html+php

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

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

* Request attributes are extracted to keep our templates simple::
* Request attributes are extracted to keep our templates simple:

.. code-block:: html+php

// example.com/src/pages/hello.php
Hello <?= htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>
Expand Down
18 changes: 8 additions & 10 deletions doctrine/custom_dql_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,14 @@ In Symfony, you can register your custom DQL functions as follows:
use App\DQL\DatetimeFunction;
$container->loadFromExtension('doctrine', [
'doctrine' => [
'orm' => [
// ...
'entity_managers' => [
'example_manager' => [
// place your functions here
'dql' => [
'datetime_functions' => [
'test_datetime' => DatetimeFunction::class,
],
'orm' => [
// ...
'entity_managers' => [
'example_manager' => [
// place your functions here
'dql' => [
'datetime_functions' => [
'test_datetime' => DatetimeFunction::class,
],
],
],
Expand Down
4 changes: 0 additions & 4 deletions form/create_form_type_extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,10 @@ Specifically, you need to override the ``file_widget`` block:
{% extends 'form_div_layout.html.twig' %}

{% block file_widget %}
{% spaceless %}

{{ block('form_widget') }}
{% if image_url is not null %}
<img src="{{ asset(image_url) }}"/>
{% endif %}

{% endspaceless %}
{% endblock %}

Be sure to :ref:`configure this form theme template <forms-theming-global>` so that
Expand Down
2 changes: 1 addition & 1 deletion form/data_transformers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ to and from the issue number and the ``Issue`` object::
{
// no issue number? It's optional, so that's ok
if (!$issueNumber) {
return;
return null;
}

$issue = $this->entityManager
Expand Down
2 changes: 1 addition & 1 deletion form/type_guesser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ With this knowledge, you can implement the ``guessType()`` method of the
$annotations = $this->readPhpDocAnnotations($class, $property);

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

// otherwise, base the type on the @var annotation
Expand Down
2 changes: 1 addition & 1 deletion form/validation_group_service_resolver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Then in your form, inject the resolver and set it as the ``validation_groups``::
namespace App\Form;

use App\Validator\ValidationGroupResolver;
use Symfony\Component\Form\AbstractType
use Symfony\Component\Form\AbstractType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class MyClassType extends AbstractType
Expand Down
2 changes: 1 addition & 1 deletion forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ argument of ``createForm()``::
{
$task = new Task();
// use some PHP logic to decide if this form field is required or not
$dueDateIsRequired = ...
$dueDateIsRequired = ...;

$form = $this->createForm(TaskType::class, $task, [
'require_due_date' => $dueDateIsRequired,
Expand Down
2 changes: 1 addition & 1 deletion http_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ To abort a request (e.g. because it didn't complete in due time, or you want to
fetch only the first bytes of the response, etc.), you can either use the
``cancel()`` method of ``ResponseInterface``::

$response->cancel()
$response->cancel();

Or throw an exception from a progress callback::

Expand Down
2 changes: 1 addition & 1 deletion introduction/from_flat_php_to_symfony.rst
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ and uses Twig:

.. code-block:: html+twig

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

{% block title %}List of Posts{% endblock %}
Expand Down
7 changes: 4 additions & 3 deletions mercure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ You can instead make use of the `MockHub`::

$controller = new MessageController($hub);

...
// ...
}
}

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

HubStub decorates the default hub service so no updates are actually
sent. Here is the HubStub implementation::
sent. Here is the HubStub implementation:

.. code-block:: yaml
# config/services_test.yaml
App\Tests\Functional\Fixtures\HubStub:
decorates: mercure.hub.default

Debugging
---------

Expand Down
4 changes: 2 additions & 2 deletions migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,11 @@ somewhat like this::

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

// Figure out how to map to the needed script file
Expand Down
Loading

0 comments on commit 6b19707

Please sign in to comment.