diff --git a/book/testing.rst b/book/testing.rst index 80897b6cef2..d5dcd0c504d 100644 --- a/book/testing.rst +++ b/book/testing.rst @@ -487,52 +487,6 @@ To get the Profiler for the last request, do the following:: For specific details on using the profiler inside a test, see the :doc:`/cookbook/testing/profiling` cookbook entry. -To avoid collecting data in each test you can set the ``collect`` parameter -in the configuration: - -.. configuration-block:: - - .. code-block:: yaml - - # app/config/config_test.yml - - # ... - framework: - profiler: - enabled: true - collect: false - - .. code-block:: xml - - - - - - - - - - - - - .. code-block:: php - - // app/config/config.php - - // ... - $container->loadFromExtension('framework', array( - 'profiler' => array( - 'enabled' => true, - 'collect' => false, - ), - )); - -In this way only tests that call ``enableProfiler()`` will collect data. - Redirecting ~~~~~~~~~~~ diff --git a/components/expression_language/extending.rst b/components/expression_language/extending.rst index e2678236d17..94762110bcd 100644 --- a/components/expression_language/extending.rst +++ b/components/expression_language/extending.rst @@ -35,11 +35,7 @@ This method has 3 arguments: $language = new ExpressionLanguage(); $language->register('lowercase', function ($str) { - if (!is_string($str)) { - return $str; - } - - return sprintf('strtolower(%s)', $str); + is_string(%1$s) ? strtolower(%1$s) : %1$s; }, function ($arguments, $str) { if (!is_string($str)) { return $str; diff --git a/contributing/code/bc.rst b/contributing/code/bc.rst index 0e55eb2d18f..2d2a5f9cc94 100644 --- a/contributing/code/bc.rst +++ b/contributing/code/bc.rst @@ -138,7 +138,7 @@ your overridden method wouldn't match anymore and generate a fatal error. .. note:: As with interfaces, we limit ourselves to changes that can be upgraded - easily. We will document the precise ugprade instructions in the UPGRADE + easily. We will document the precise upgrade instructions in the UPGRADE file in Symfony's root directory. In some cases, only specific properties and methods are tagged with the ``@api`` @@ -307,6 +307,9 @@ Add type hint to an argument Yes Yes Remove type hint of an argument Yes Yes Change argument type Yes Yes Change return type Yes Yes +**Static Methods** +Turn non static into static No No +Turn static into non static No No ================================================== ============== ============== .. [1] Your code may be broken by changes in the Symfony code. Such changes will diff --git a/cookbook/cache/varnish.rst b/cookbook/cache/varnish.rst index da06add99f1..7dd46d9a11f 100644 --- a/cookbook/cache/varnish.rst +++ b/cookbook/cache/varnish.rst @@ -38,6 +38,11 @@ application: set req.http.Surrogate-Capability = "abc=ESI/1.0"; } +.. note:: + + The ``abc`` part of the header isn't important unless you have multiple "surrogates" + that need to advertise their capabilities. See `Surrogate-Capability Header`_ for details. + Then, optimize Varnish so that it only parses the Response contents when there is at least one ESI tag by checking the ``Surrogate-Control`` header that Symfony2 adds automatically: @@ -217,3 +222,4 @@ absolute URLs: .. _`Varnish`: https://www.varnish-cache.org .. _`Edge Architecture`: http://www.w3.org/TR/edge-arch .. _`GZIP and Varnish`: https://www.varnish-cache.org/docs/3.0/phk/gzip.html +.. _`Surrogate-Capability Header`: http://www.w3.org/TR/edge-arch diff --git a/cookbook/form/form_customization.rst b/cookbook/form/form_customization.rst index fb36e4fc01f..afb25f034a7 100644 --- a/cookbook/form/form_customization.rst +++ b/cookbook/form/form_customization.rst @@ -298,6 +298,22 @@ When the ``form.age`` widget is rendered, Symfony will use the ``integer_widget` block from the new template and the ``input`` tag will be wrapped in the ``div`` element specified in the customized block. +Multiple Templates +.................. + +A form can also be customized by applying several templates. To do this, pass the +name of all the templates as an array using the ``with`` keyword: + +.. code-block:: html+jinja + + {% form_theme form with ['::common.html.twig', ':Form:fields.html.twig', + 'AcmeDemoBundle:Form:fields.html.twig'] %} + + {# ... #} + +The templates can be located at different bundles and they can even be stored +at the global ``app/Resources/views/`` directory. + Child Forms ........... diff --git a/cookbook/testing/profiling.rst b/cookbook/testing/profiling.rst index 5dacddb0837..613e997629f 100644 --- a/cookbook/testing/profiling.rst +++ b/cookbook/testing/profiling.rst @@ -73,3 +73,52 @@ finish. It's easy to achieve if you embed the token in the error message:: Read the API for built-in :doc:`data collectors ` to learn more about their interfaces. + +Speeding up Tests by not Collecting Profiler Data +------------------------------------------------- + +To avoid collecting data in each test you can set the ``collect`` parameter +to false: + +.. configuration-block:: + + .. code-block:: yaml + + # app/config/config_test.yml + + # ... + framework: + profiler: + enabled: true + collect: false + + .. code-block:: xml + + + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + + // ... + $container->loadFromExtension('framework', array( + 'profiler' => array( + 'enabled' => true, + 'collect' => false, + ), + )); + +In this way only tests that call ``$client->enableProfiler()`` will collect data.