Skip to content

Commit 16c7385

Browse files
authored
Merge branch '4.1' into messenger-envelope
2 parents dd8b368 + 58a78aa commit 16c7385

File tree

77 files changed

+1463
-2178
lines changed

Some content is hidden

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

77 files changed

+1463
-2178
lines changed

best_practices/configuration.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,4 @@ just one or two words to describe the purpose of the parameter:
183183
Next: :doc:`/best_practices/business-logic`
184184

185185
.. _`feature toggles`: https://en.wikipedia.org/wiki/Feature_toggle
186-
.. _`constant() function`: http://twig.sensiolabs.org/doc/functions/constant.html
186+
.. _`constant() function`: https://twig.symfony.com/doc/2.x/functions/constant.html

best_practices/templates.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ to define one single method to transform Markdown content into HTML::
7474
}
7575

7676
Next, create a new Twig extension and define a filter called ``md2html`` using
77-
the ``TwigFilter`` class. Inject the newly defined ``Markdown`` class in the
77+
the ``Twig\TwigFilter`` class. Inject the newly defined ``Markdown`` class in the
7878
constructor of the Twig extension::
7979

8080
namespace App\Twig;
@@ -118,5 +118,5 @@ be used as a Twig extension.
118118

119119
Next: :doc:`/best_practices/forms`
120120

121-
.. _`Twig`: http://twig.sensiolabs.org/
121+
.. _`Twig`: https://twig.symfony.com/
122122
.. _`Parsedown`: http://parsedown.org/

components/cache/adapters/redis_adapter.rst

+6
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ array of ``key => value`` pairs representing option names and their respective v
9696

9797
// associative array of configuration options
9898
array(
99+
'lazy' => false,
99100
'persistent' => 0,
100101
'persistent_id' => null,
101102
'timeout' => 30,
@@ -113,6 +114,11 @@ Available Options
113114
If none is specified, it will return ``\Redis`` if the ``redis`` extension is
114115
available, and ``\Predis\Client`` otherwise.
115116

117+
``lazy`` (type: ``bool``, default: ``false``)
118+
Enables or disables lazy connections to the backend. It's ``false`` by
119+
default when using this as a stand-alone component and ``true`` by default
120+
when using it inside a Symfony application.
121+
116122
``persistent`` (type: ``int``, default: ``0``)
117123
Enables or disables use of persistent connections. A value of ``0`` disables persistent
118124
connections, and a value of ``1`` enables them.

components/form.rst

+9-6
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
178178
use Symfony\Bridge\Twig\Extension\FormExtension;
179179
use Symfony\Component\Form\FormRenderer;
180180
use Symfony\Bridge\Twig\Form\TwigRendererEngine;
181+
use Twig\Environment;
182+
use Twig\Loader\FilesystemLoader;
183+
use Twig\RuntimeLoader\FactoryRuntimeLoader;
181184

182185
// the Twig file that holds all the default markup for rendering forms
183186
// this file comes with TwigBridge
@@ -191,12 +194,12 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
191194
// the path to your other templates
192195
$viewsDirectory = realpath(__DIR__.'/../views');
193196

194-
$twig = new Twig_Environment(new Twig_Loader_Filesystem(array(
197+
$twig = new Environment(new FilesystemLoader(array(
195198
$viewsDirectory,
196199
$vendorTwigBridgeDirectory.'/Resources/views/Form',
197200
)));
198201
$formEngine = new TwigRendererEngine(array($defaultFormTheme), $twig);
199-
$twig->addRuntimeLoader(new \Twig_FactoryRuntimeLoader(array(
202+
$twig->addRuntimeLoader(new FactoryRuntimeLoader(array(
200203
FormRenderer::class => function () use ($formEngine, $csrfManager) {
201204
return new FormRenderer($formEngine, $csrfManager);
202205
},
@@ -213,7 +216,7 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
213216
->getFormFactory();
214217

215218
.. versionadded:: 1.30
216-
The ``Twig_FactoryRuntimeLoader`` was introduced in Twig 1.30.
219+
The ``Twig\\RuntimeLoader\\FactoryRuntimeLoader`` was introduced in Twig 1.30.
217220

218221
The exact details of your `Twig Configuration`_ will vary, but the goal is
219222
always to add the :class:`Symfony\\Bridge\\Twig\\Extension\\FormExtension`
@@ -253,7 +256,7 @@ installed:
253256
$ composer require symfony/translation symfony/config
254257
255258
Next, add the :class:`Symfony\\Bridge\\Twig\\Extension\\TranslationExtension`
256-
to your ``Twig_Environment`` instance::
259+
to your ``Twig\\Environment`` instance::
257260

258261
use Symfony\Component\Form\Forms;
259262
use Symfony\Component\Translation\Translator;
@@ -754,5 +757,5 @@ Learn more
754757
/form/*
755758

756759
.. _Packagist: https://packagist.org/packages/symfony/form
757-
.. _Twig: http://twig.sensiolabs.org
758-
.. _`Twig Configuration`: http://twig.sensiolabs.org/doc/intro.html
760+
.. _Twig: https://twig.symfony.com
761+
.. _`Twig Configuration`: https://twig.symfony.com/doc/2.x/intro.html

components/messenger.rst

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ The Messenger Component
1111
The component is greatly inspired by Matthias Noback's series of `blog posts
1212
about command buses`_ and the `SimpleBus project`_.
1313

14+
.. seealso::
15+
16+
This article explains how to use the Messenger features as an independent
17+
component in any PHP application. Read the :doc:`/messenger` article to
18+
learn about how to use it in Symfony applications.
19+
1420
Installation
1521
------------
1622

contributing/code/bc.rst

+134-1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,41 @@ covered by our backward compatibility promise:
143143
| Access a private property (via Reflection) | No |
144144
+-----------------------------------------------+-----------------------------+
145145

146+
Using our Traits
147+
~~~~~~~~~~~~~~~~
148+
149+
All traits provided by Symfony may be used in your classes.
150+
151+
.. caution::
152+
153+
The exception to this rule are traits tagged with ``@internal``. Such
154+
traits should not be used.
155+
156+
To be on the safe side, check the following table to know which use cases are
157+
covered by our backward compatibility promise:
158+
159+
+-----------------------------------------------+-----------------------------+
160+
| Use Case | Backward Compatibility |
161+
+===============================================+=============================+
162+
| **If you...** | **Then we guarantee BC...** |
163+
+-----------------------------------------------+-----------------------------+
164+
| Use a trait | Yes |
165+
+-----------------------------------------------+-----------------------------+
166+
| **If you use the trait and...** | **Then we guarantee BC...** |
167+
+-----------------------------------------------+-----------------------------+
168+
| Use it to implement an interface | Yes |
169+
+-----------------------------------------------+-----------------------------+
170+
| Use it to implement an abstract method | Yes |
171+
+-----------------------------------------------+-----------------------------+
172+
| Use it to extend a parent class | Yes |
173+
+-----------------------------------------------+-----------------------------+
174+
| Use it to define an abstract class | Yes |
175+
+-----------------------------------------------+-----------------------------+
176+
| Use a public, protected or private property | Yes |
177+
+-----------------------------------------------+-----------------------------+
178+
| Use a public, protected or private method | Yes |
179+
+-----------------------------------------------+-----------------------------+
180+
146181
Working on Symfony Code
147182
-----------------------
148183

@@ -178,6 +213,9 @@ Change argument type No
178213
Add return type No
179214
Remove return type No [9]_
180215
Change return type No
216+
**Static Methods**
217+
Turn non static into static No
218+
Turn static into non static No
181219
**Constants**
182220
Add constant Yes
183221
Remove constant No
@@ -209,21 +247,28 @@ Move to parent class Yes
209247
Add protected property Yes
210248
Remove protected property No [7]_
211249
Reduce visibility No [7]_
250+
Make public No [7]_
212251
Move to parent class Yes
213252
**Private Properties**
214253
Add private property Yes
254+
Make public or protected Yes
215255
Remove private property Yes
216256
**Constructors**
217257
Add constructor without mandatory arguments Yes [1]_
218258
Remove constructor No
219259
Reduce visibility of a public constructor No
220260
Reduce visibility of a protected constructor No [7]_
221261
Move to parent class Yes
262+
**Destructors**
263+
Add destructor Yes
264+
Remove destructor No
265+
Move to parent class Yes
222266
**Public Methods**
223267
Add public method Yes
224268
Remove public method No
225269
Change name No
226270
Reduce visibility No
271+
Make final No [6]_
227272
Move to parent class Yes
228273
Add argument without a default value No
229274
Add argument with a default value No [7]_ [8]_
@@ -241,6 +286,8 @@ Add protected method Yes
241286
Remove protected method No [7]_
242287
Change name No [7]_
243288
Reduce visibility No [7]_
289+
Make final No [6]_
290+
Make public No [7]_ [8]_
244291
Move to parent class Yes
245292
Add argument without a default value No [7]_
246293
Add argument with a default value No [7]_ [8]_
@@ -257,6 +304,7 @@ Change return type No [7]_ [8]_
257304
Add private method Yes
258305
Remove private method Yes
259306
Change name Yes
307+
Make public or protected Yes
260308
Add argument without a default value Yes
261309
Add argument with a default value Yes
262310
Remove argument Yes
@@ -268,7 +316,7 @@ Change argument type Yes
268316
Add return type Yes
269317
Remove return type Yes
270318
Change return type Yes
271-
**Static Methods**
319+
**Static Methods and Properties**
272320
Turn non static into static No [7]_ [8]_
273321
Turn static into non static No
274322
**Constants**
@@ -277,6 +325,91 @@ Remove constant No
277325
Change value of a constant Yes [1]_ [5]_
278326
================================================== ==============
279327

328+
Changing Traits
329+
~~~~~~~~~~~~~~~
330+
331+
This table tells you which changes you are allowed to do when working on
332+
Symfony's traits:
333+
334+
================================================== ==============
335+
Type of Change Change Allowed
336+
================================================== ==============
337+
Remove entirely No
338+
Change name or namespace No
339+
Use another trait Yes
340+
**Public Properties**
341+
Add public property Yes
342+
Remove public property No
343+
Reduce visibility No
344+
Move to a used trait Yes
345+
**Protected Properties**
346+
Add protected property Yes
347+
Remove protected property No
348+
Reduce visibility No
349+
Make public No
350+
Move to a used trait Yes
351+
**Private Properties**
352+
Add private property Yes
353+
Remove private property No
354+
Make public or protected Yes
355+
Move to a used trait Yes
356+
**Constructors and destructors**
357+
Have constructor or destructor No
358+
**Public Methods**
359+
Add public method Yes
360+
Remove public method No
361+
Change name No
362+
Reduce visibility No
363+
Make final No [6]_
364+
Move to used trait Yes
365+
Add argument without a default value No
366+
Add argument with a default value No
367+
Remove argument No
368+
Add default value to an argument No
369+
Remove default value of an argument No
370+
Add type hint to an argument No
371+
Remove type hint of an argument No
372+
Change argument type No
373+
Change return type No
374+
**Protected Methods**
375+
Add protected method Yes
376+
Remove protected method No
377+
Change name No
378+
Reduce visibility No
379+
Make final No [6]_
380+
Make public No [8]_
381+
Move to used trait Yes
382+
Add argument without a default value No
383+
Add argument with a default value No
384+
Remove argument No
385+
Add default value to an argument No
386+
Remove default value of an argument No
387+
Add type hint to an argument No
388+
Remove type hint of an argument No
389+
Change argument type No
390+
Change return type No
391+
**Private Methods**
392+
Add private method Yes
393+
Remove private method No
394+
Change name No
395+
Make public or protected Yes
396+
Move to used trait Yes
397+
Add argument without a default value No
398+
Add argument with a default value No
399+
Remove argument No
400+
Add default value to an argument No
401+
Remove default value of an argument No
402+
Add type hint to an argument No
403+
Remove type hint of an argument No
404+
Change argument type No
405+
Add return type No
406+
Remove return type No
407+
Change return type No
408+
**Static Methods and Properties**
409+
Turn non static into static No
410+
Turn static into non static No
411+
================================================== ==============
412+
280413
.. [1] Should be avoided. When done, this change must be documented in the
281414
UPGRADE file.
282415

contributing/documentation/standards.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ In addition, documentation follows these rules:
174174
* himself or herself, use themselves
175175

176176
.. _`the Sphinx documentation`: http://sphinx-doc.org/rest.html#source-code
177-
.. _`Twig Coding Standards`: http://twig.sensiolabs.org/doc/coding_standards.html
177+
.. _`Twig Coding Standards`: https://twig.symfony.com/doc/2.x/coding_standards.html
178178
.. _`reserved by the IANA`: http://tools.ietf.org/html/rfc2606#section-3
179179
.. _`American English`: https://en.wikipedia.org/wiki/American_English
180180
.. _`American English Oxford Dictionary`: http://en.oxforddictionaries.com/definition/american_english/

0 commit comments

Comments
 (0)