8000 Merge branch '3.4' into 4.1 · symfony/symfony-docs@9b1521b · GitHub
[go: up one dir, main page]

Skip to content

Commit 9b1521b

Browse files
committed
Merge branch '3.4' into 4.1
* 3.4: Fixed tiny grammar error in flex.rst [Validator] Range constraint: min and mix can be integer or string update year in license added blank line after .. versionadded:: directive add missing blank line after directive Add missing imports and remove useless
2 parents 60778d4 + bb557d4 commit 9b1521b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+523
-14
lines changed

components/cache/adapters/memcached_adapter.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ Available Options
278278
are valid and fit within the design of the protocol being used.
279279

280280
.. tip::
281+
281282
Reference the `Memcached`_ extension's `predefined constants`_ documentation
282283
for additional information about the available options.
283284

components/cache/adapters/redis_adapter.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ Available Options
139139
connection attempt times out.
140140

141141
.. note::
142+
142143
When using the `Predis`_ library some additional Predis-specific options are available.
143144
Reference the `Predis Connection Parameters`_ documentation for more information.
144145

components/cache/cache_pools.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ when all items are successfully deleted)::
152152
$ php bin/console cache:pool:clear cache.validation cache.app
153153
154154
.. versionadded:: 4.1
155+
155156
The ``cache:pool:delete`` command was introduced in Symfony 4.1.
156157

157158
.. _component-cache-cache-pool-prune:

components/console/helpers/questionhelper.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Suppose you want to confirm an action before actually executing it. Add
2525
the following to your command::
2626

2727
// ...
28+
use Symfony\Component\Console\Command\Command;
2829
use Symfony\Component\Console\Input\InputInterface;
2930
use Symfony\Component\Console\Output\OutputInterface;
3031
use Symfony\Component\Console\Question\ConfirmationQuestion;

components/console/helpers/table.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ When building a console application it may be useful to display tabular data:
2020
To display a table, use :class:`Symfony\\Component\\Console\\Helper\\Table`,
2121
set the headers, set the rows and then render the table::
2222

23+
use Symfony\Component\Console\Command\Command;
2324
use Symfony\Component\Console\Helper\Table;
25+
use Symfony\Component\Console\Input\InputInterface;
26+
use Symfony\Component\Console\Output\OutputInterface;
2427
// ...
2528

2629
class SomeCommand extends Command

components/form.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
224224
->getFormFactory();
225225

226226
.. versionadded:: 1.30
227+
227228
The ``Twig\\RuntimeLoader\\FactoryRuntimeLoader`` was introduced in Twig 1.30.
228229

229230
The exact details of your `Twig Configuration`_ will vary, but the goal is

components/phpunit_bridge.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ namespaces in the ``phpunit.xml`` file, as done for example in the
515515
</listener>
516516
</listeners>
517517
</phpunit>
518-
518+
519519
Under the hood, a PHPUnit listener injects the mocked functions in the tested
520520
classes' namespace. In order to work as expected, the listener has to run before
521521
the tested class ever runs. By default, the mocked functions are created when the

components/process.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ with a non-zero code)::
113113
.. tip::
114114

115115
.. versionadded:: 3.3
116+
116117
The ability to define commands as arrays of arguments was introduced in
117118
Symfony 3.3.
118119

components/property_info.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ to determine if it's accessible. This based on how the :doc:`PropertyAccess </co
241241
works.
242242

243243
.. versionadded:: 4.1
244+
244245
The support of hasser methods in the ``ReflectionExtractor`` class was
245246
introduced in Symfony 4.1.
246247

components/serializer.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ needs three parameters:
165165
#. The encoder used to convert that information into an array
166166

167167
.. versionadded:: 3.3
168+
168169
Support for the ``allow_extra_attributes`` key in the context was introduced
169170
in Symfony 3.3.
170171

@@ -631,6 +632,7 @@ There are several types of normalizers available:
631632
into a list of errors according to the `RFC 7807`_ standard.
632633

633634
.. versionadded:: 4.1
635+
634636
The ``ConstraintViolationListNormalizer`` was introduced in Symfony 4.1.
635637

636638
.. _component-serializer-encoders:
@@ -740,7 +742,6 @@ The ``YamlEncoder``
740742
This encoder requires the :doc:`Yaml Component </components/yaml>` and
741743
transforms from and to Yaml.
742744

743-
744745
.. _component-serializer-handling-circular-references:
745746

746747
Handling Circular References

components/validator.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ If you have lots of validation errors, you can filter them by error code::
6565
}
6666

6767
.. versionadded:: 3.3
68+
6869
The ``findByCodes()`` method was introduced in Symfony 3.3.
6970

7071
Retrieving a Validator Instance

components/workflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ are trying to use it with::
7474
$registry = new Registry();
7575
$registry->addWorkflow($blogWorkflow, new InstanceOfSupportStrategy(BlogPost::class));
7676
$registry->addWorkflow($newsletterWorkflow, new InstanceOfSupportStrategy(Newsletter::class));
77-
77+
7878
.. versionadded:: 4.1
7979
The ``addWorkflow()`` method was introduced in Symfony 4.1. In previous
8080
Symfony versions it was called ``add()``.

configuration/external_parameters.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ Environment Variable Processors
138138
-------------------------------
139139

140140
.. versionadded:: 3.4
141+
141142
Environment variable processors were introduced in Symfony 3.4.
142143

143144
The values of environment variables are considered strings by default.

configuration/micro_kernel_trait.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ your ``composer.json`` file to load from there:
125125
}
126126
127127
Then, run ``composer dump-autoload`` to dump your new autoload config.
128-
128+
129129
Now, suppose you want to use Twig and load routes via annotations. Instead of
130130
putting *everything* in ``index.php``, create a new ``src/Kernel.php`` to
131131
hold the kernel. Now it looks like this::

console.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ constructor. If your command defines its own constructor, set the properties
7474
first and then call to the parent constructor, to make those properties
7575
available in the ``configure()`` method::
7676

77+
// ...
78+
use Symfony\Component\Console\Command\Command;
79+
use Symfony\Component\Console\Input\InputArgument;
80+
7781
class CreateUserCommand extends Command
7882
{
7983
// ...

console/calling_commands.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ generating Doctrine2 proxies, dumping web assets, ...).
1111
Calling a command from another one is straightforward::
1212

1313
use Symfony\Component\Console\Input\ArrayInput;
14+
use Symfony\Component\Console\Input\InputInterface;
15+
use Symfony\Component\Console\Output\OutputInterface;
1416
// ...
1517

1618
protected function execute(InputInterface $input, OutputInterface $output)

console/input.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ or required. For example, to add an optional ``last_name`` argument to the comma
1414
and make the ``name`` argument required::
1515

1616
// ...
17+
use Symfony\Component\Console\Command\Command;
1718
use Symfony\Component\Console\Input\InputArgument;
1819

1920
class GreetCommand extends Command
@@ -33,6 +34,10 @@ and make the ``name`` argument required::
3334
You now have access to a ``last_name`` argument in your command::
3435

3536
// ...
37+
use Symfony\Component\Console\Command\Command;
38+
use Symfony\Component\Console\Input\InputInterface;
39+
use Symfony\Component\Console\Output\OutputInterface;
40+
3641
class GreetCommand extends Command
3742
{
3843
// ...

console/lockable_trait.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ In addition, the Console component provides a PHP trait called ``LockableTrait``
1111
that adds two convenient methods to lock and release commands::
1212

1313
// ...
14+
use Symfony\Component\Console\Command\Command;
1415
use Symfony\Component\Console\Command\LockableTrait;
16+
use Symfony\Component\Console\Input\InputInterface;
17+
use Symfony\Component\Console\Output\OutputInterface;
1518

1619
class UpdateContentsCommand extends Command
1720
{

console/request_context.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ will override the defaults.
6666
$container->setParameter('asset.request_context.secure', true);
6767
6868
.. versionadded:: 3.4
69+
6970
The ``asset.request_context.*`` parameters were introduced in Symfony 3.4.
7071

7172
Configuring the Request Context per Command

console/verbosity.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ It is possible to print a message in a command for only a specific verbosity
4141
level. For example::
4242

4343
// ...
44+
use Symfony\Component\Console\Command\Command;
45+
use Symfony\Component\Console\Input\InputInterface;
46+
use Symfony\Component\Console\Output\OutputInterface;
47+
4448
class CreateUserCommand extends Command
4549
{
4650
// ...

contributing/code/license.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Symfony Code License
55

66
Symfony code is released under `the MIT license`_:
77

8-
Copyright (c) 2004-2018 Fabien Potencier
8+
Copyright (c) 2004-2019 Fabien Potencier
99

1010
Permission is hereby granted, free of charge, to any person obtaining a copy
1111
of this software and associated documentation files (the "Software"), to deal

contributing/documentation/format.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ Symfony, you should precede your description of the change with a
178178
.. code-block:: rst
179179
180180
.. versionadded:: 2.7
181+
181182
The ``askHiddenResponse()`` method was introduced in Symfony 2.7.
182183
183184
You can also ask a question and hide the response. This is particularly [...]
@@ -188,6 +189,7 @@ how the behavior has changed:
188189
.. code-block:: rst
189190
190191
.. versionadded:: 2.7
192+
191193
The ``include()`` function is a new Twig feature that's available in
192194
Symfony 2.7. Prior, the ``{% include %}`` tag was used.
193195

debug/debugging.rst

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
.. index::
2+
single: Debugging
3+
4+
How to Optimize your Development Environment for Debugging
5+
==========================================================
6+
7+
When you work on a Symfony project on your local machine, you should use the
8+
``dev`` environment (``app_dev.php`` front controller). This environment
9+
configuration is optimized for two main purposes:
10+
11+
* Give the developer accurate feedback whenever something goes wrong (web
12+
debug toolbar, nice exception pages, profiler, ...);
13+
14+
* Be as similar as possible as the production environment to avoid problems
15+
when deploying the project.
16+
17+
Disabling the Bootstrap File and Class Caching
18+
----------------------------------------------
19+
20+
And to make the production environment as fast as possible, Symfony creates
21+
big PHP files in your cache containing the aggregation of PHP classes your
22+
project needs for every request. However, this behavior can confuse your debugger,
23+
because the same class can be located in two different places: the original class
24+
file and the big file which aggregates lots of classes.
25+
26+
This recipe shows you how you can tweak this caching mechanism to make it friendlier
27+
when you need to debug code that involves Symfony classes.
28+
29+
The ``app_dev.php`` front controller reads as follows by default::
30+
31+
// ...
32+
33+
$loader = require __DIR__.'/../app/autoload.php';
34+
Debug::enable();
35+
36+
$kernel = new AppKernel('dev', true);
37+
$kernel->loadClassCache();
38+
$request = Request::createFromGlobals();
39+
// ...
40+
41+
To make your debugger happier, disable the loading of all PHP class caches
42+
by removing the call to ``loadClassCache()``::
43+
44+
// ...
45+
46+
$loader = require_once __DIR__.'/../app/autoload.php';
47+
Debug::enable();
48+
49+
$kernel = new AppKernel('dev', true);
50+
// $kernel->loadClassCache();
51+
$request = Request::createFromGlobals();
52+
53+
.. tip::
54+
55+
If you disable the PHP caches, don't forget to revert after your debugging
56+
session.
57+
58+
Some IDEs do not like the fact that some classes are stored in different
59+
locations. To avoid problems, you can either tell your IDE to ignore the PHP
60+
cache files, or you can change the extension used by Symfony for these files::
61+
62+
$kernel->loadClassCache('classes', '.php.cache');
63+
64+
.. versionadded:: 3.3
65+
66+
The ``loadClassCache()`` was deprecated in Symfony 3.3 and removed in
67+
Symfony 4.0. No alternative is provided because this feature is useless
68+
when using PHP 7 or higher.
69+
70+
Useful Debugging Commands
71+
-------------------------
72+
73+
When developing a large application, it can be hard to keep track of all the
74+
different services, routes and translations. Luckily, Symfony has some commands
75+
that can help you visualize and find the information.
76+
77+
``about``
78+
Shows information about the current project, such as the Symfony version,
79+
the Kernel and PHP.
80+
81+
``debug:container``
82+
Displays information about the contents of the Symfony container for all public
83+
services. To find only those matching a name, append the name as an argument.
84+
85+
``debug:config``
86+
Shows all configured bundles, their class and their alias.
87+
88+
``debug:form``
89+
Displays information about form types and their options.
90+
91+
``debug:event-dispatcher``
92+
Displays information about all the registered listeners in the event dispatcher.
93+
94+
``debug:router``
95+
Displays information about all configured routes in the application as a
96+
table with the name, method, scheme, host and path for each route.
97+
98+
``debug:translation <locale>``
99+
Shows a table of the translation key, the domain, the translation and the
100+
fallback translation for all known messages, if translations exist for
101+
the given locale.
102+
103+
.. tip::
104+
105+
When in doubt how to use a console command, open the help section by
106+
appending the ``--help`` option.

event_dispatcher.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,6 @@ or a "sub request"::
212212
namespace App\EventListener;
213213

214214
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
215-
use Symfony\Component\HttpKernel\HttpKernel;
216-
use Symfony\Component\HttpKernel\HttpKernelInterface;
217215

218216
class RequestListener
219217
{

http_cache/validation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ To see a simple implementation, generate the ETag as the md5 of the content::
6262
// src/Controller/DefaultController.php
6363
namespace App\Controller;
6464

65+
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
6566
use Symfony\Component\HttpFoundation\Request;
6667

6768
class DefaultController extends AbstractController

0 commit comments

Comments
 (0)
0