Skip to content

Commit fbc7a8a

Browse files
committed
Merge branch '2.8'
2 parents b1ba29d + 8d66137 commit fbc7a8a

34 files changed

+295
-293
lines changed

Diff for: _theme/_templates/layout.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
<div id="sidebar" class="col-sm-3">
4545
<div id="sidebar-content">
4646
<div id="demo-warning">
47-
<h4>This is a demo</h4>
48-
<p>This is a demo provided by platform.sh.<br>
49-
<a href="http://symfony.com/doc/current/{{ pagename }}">Visit on symfony.com</a>.</p>
47+
<h4>Pull request build</h4>
48+
<p>Each pull request of the Symfony Documentation is automatically deployed and hosted on <a href="https://platform.sh">Platform.sh</a>.<br>
49+
Visit the page on <a href="https://symfony.com/doc/current/{{ pagename }}">symfony.com</a>.</p>
5050
</div>
5151

5252
{%- include "globaltoc.html" %}

Diff for: book/http_cache.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ Here is a list of the main options:
230230
``allow_revalidate``
231231
Specifies whether the client can force a cache revalidate by including a
232232
``Cache-Control`` "max-age=0" directive in the request. Set it to ``true`` for
233-
compliance with RFC 2616 (default: false).
233+
compliance with RFC 2616 (default: ``false``).
234234

235235
``stale_while_revalidate``
236236
Specifies the default number of seconds (the granularity is the second as the
@@ -882,8 +882,8 @@ that data from its cache.
882882

883883
If you want to use cache invalidation, have a look at the
884884
`FOSHttpCacheBundle`_. This bundle provides services to help with various
885-
cache invalidation concepts, and also documents the configuration for the
886-
a couple of common caching proxies.
885+
cache invalidation concepts and also documents the configuration for a
886+
couple of common caching proxies.
887887

888888
If one content corresponds to one URL, the ``PURGE`` model works well.
889889
You send a request to the cache proxy with the HTTP method ``PURGE`` (using

Diff for: book/security.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ else, you'll want to encode their passwords. The best algorithm to use is
512512
513513
.. include:: /cookbook/security/_ircmaxwell_password-compat.rst.inc
514514

515-
Of course, your user's passwords now need to be encoded with this exact algorithm.
515+
Of course, your users' passwords now need to be encoded with this exact algorithm.
516516
For hardcoded users, you can use an `online tool`_, which will give you something
517517
like this:
518518

Diff for: book/translation.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ use somewhere in your application::
593593
public $name;
594594
}
595595

596-
Add constraints though any of the supported methods. Set the message option to the
596+
Add constraints through any of the supported methods. Set the message option to the
597597
translation source text. For example, to guarantee that the ``$name`` property is
598598
not empty, add the following:
599599

Diff for: book/validation.rst

+11-11
Original file line numberDiff line numberDiff line change
@@ -734,19 +734,19 @@ user registers and when a user updates their contact information later:
734734
class User implements UserInterface
735735
{
736736
/**
737-
* @Assert\Email(groups={"registration"})
738-
*/
737+
* @Assert\Email(groups={"registration"})
738+
*/
739739
private $email;
740740
741741
/**
742-
* @Assert\NotBlank(groups={"registration"})
743-
* @Assert\Length(min=7, groups={"registration"})
744-
*/
742+
* @Assert\NotBlank(groups={"registration"})
743+
* @Assert\Length(min=7, groups={"registration"})
744+
*/
745745
private $password;
746746
747747
/**
748-
* @Assert\Length(min=2)
749-
*/
748+
* @Assert\Length(min=2)
749+
*/
750750
private $city;
751751
}
752752
@@ -927,13 +927,13 @@ username and the password are different only if all other validation passes
927927
class User implements UserInterface
928928
{
929929
/**
930-
* @Assert\NotBlank
931-
*/
930+
* @Assert\NotBlank
931+
*/
932932
private $username;
933933
934934
/**
935-
* @Assert\NotBlank
936-
*/
935+
* @Assert\NotBlank
936+
*/
937937
private $password;
938938
939939
/**

Diff for: components/dependency_injection/synthetic_services.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ service is injected into the container from within the ``Kernel`` class::
2727
The ``kernel`` service is called a synthetic service. This service has to
2828
be configured in the container, so the container knows the service does
2929
exist during compilation (otherwise, services depending on this ``kernel``
30-
service will get a "service does not exists" error).
30+
service will get a "service does not exist" error).
3131

3232
In order to do so, you have to use
3333
:method:`Definition::setSynthetic() <Symfony\\Component\\DependencyInjection\\Definition::setSynthetic>`::

Diff for: components/http_foundation/introduction.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ represented by a PHP callable instead of a string::
464464
you must call ``ob_flush()`` before ``flush()``.
465465

466466
Additionally, PHP isn't the only layer that can buffer output. Your web
467-
server might also buffer based on its configuration. Even more, if you
468-
use fastcgi, buffering can't be disabled at all.
467+
server might also buffer based on its configuration. What's more, if you
468+
use FastCGI, buffering can't be disabled at all.
469469

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

Diff for: components/routing/introduction.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ your autoloader to load the Routing component::
3939
$routes = new RouteCollection();
4040
$routes->add('route_name', $route);
4141

42-
$context = new RequestContext($_SERVER['REQUEST_URI']);
42+
$context = new RequestContext('/');
4343

4444
$matcher = new UrlMatcher($routes, $context);
4545

@@ -203,7 +203,7 @@ a certain route::
203203
$routes = new RouteCollection();
204204
$routes->add('show_post', new Route('/show/{slug}'));
205205

206-
$context = new RequestContext($_SERVER['REQUEST_URI']);
206+
$context = new RequestContext('/');
207207

208208
$generator = new UrlGenerator($routes, $context);
209209

@@ -323,7 +323,7 @@ automatically in the background if you want to use it. A basic example of the
323323
:class:`Symfony\\Component\\Routing\\Router` class would look like::
324324

325325
$locator = new FileLocator(array(__DIR__));
326-
$requestContext = new RequestContext($_SERVER['REQUEST_URI']);
326+
$requestContext = new RequestContext('/');
327327

328328
$router = new Router(
329329
new YamlFileLoader($locator),

Diff for: contributing/code/standards.rst

+29-10
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ example containing most features described below:
3737
{
3838
const SOME_CONST = 42;
3939
40+
/**
41+
* @var string
42+
*/
4043
private $fooBar;
4144
4245
/**
@@ -48,20 +51,30 @@ example containing most features described below:
4851
}
4952
5053
/**
51-
* @param string $dummy Some argument description
52-
* @param array $options
54+
* Transforms the input given as first argument.
55+
*
56+
* @param bool|string $dummy Some argument description
57+
* @param array $options An options collection to be used within the transformation
5358
*
54-
* @return string|null Transformed input
59+
* @return string|null The transformed input
5560
*
56-
* @throws \RuntimeException
61+
* @throws \RuntimeException When an invalid option is provided
5762
*/
5863
private function transformText($dummy, array $options = array())
5964
{
65+
$defaultOptions = array(
66+
'some_default' => 'values',
67+
'another_default' => 'more values',
68+
);
69+
70+
foreach ($options as $option) {
71+
if (!in_array($option, $defaultOptions)) {
72+
throw new \RuntimeException(sprintf('Unrecognized option "%s"', $option));
73+
}
74+
}
75+
6076
$mergedOptions = array_merge(
61-
array(
62-
'some_default' => 'values',
63-
'another_default' => 'more values',
64-
),
77+
$defaultOptions,
6578
$options
6679
);
6780

@@ -76,10 +89,16 @@ example containing most features described below:
7689

7790
return ucwords($dummy);
7891
}
79-
80-
throw new \RuntimeException(sprintf('Unrecognized dummy option "%s"', $dummy));
8192
}
8293

94+
/**
95+
* Performs some basic check for a given value.
96+
*
97+
* @param mixed $value Some value to check against
98+
* @param bool $theSwitch Some switch to control the method's flow
99+
*
100+
* @return bool|null The resultant check if $theSwitch isn't false, null otherwise
101+
*/
83102
private function reverseBoolean($value = null, $theSwitch = false)
84103
{
85104
if (!$theSwitch) {

Diff for: contributing/code/tests.rst

+13-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ In any case, it's a good practice to run tests locally before submitting a
1616
Before Running the Tests
1717
------------------------
1818

19-
To run the Symfony test suite, `install PHPUnit`_ 4.2 (or later) first. Then,
20-
install the external dependencies used during the tests, such as Doctrine, Twig
21-
and Monolog. To do so, :doc:`install Composer </cookbook/composer>` and execute
22-
the following:
19+
To run the Symfony test suite, install the external dependencies used during the
20+
tests, such as Doctrine, Twig and Monolog. To do so,
21+
:doc:`install Composer </cookbook/composer>` and execute the following:
2322

2423
.. code-block:: bash
2524
26-
$ composer install
25+
$ composer update
2726
2827
.. _running:
2928

@@ -35,7 +34,7 @@ command:
3534

3635
.. code-block:: bash
3736
38-
$ phpunit
37+
$ php ./phpunit symfony
3938
4039
The output should display ``OK``. If not, read the reported errors to figure out
4140
what's going on and if the tests are broken because of the new code.
@@ -48,6 +47,12 @@ what's going on and if the tests are broken because of the new code.
4847

4948
.. code-block:: bash
5049
51-
$ phpunit src/Symfony/Component/Finder/
50+
$ php ./phpunit src/Symfony/Component/Finder/
5251
53-
.. _`install PHPUnit`: https://phpunit.de/manual/current/en/installation.html
52+
.. tip::
53+
54+
On Windows, install the `ConEmu`_ or `ANSICON`_ free applications to see
55+
colored test results.
56+
57+
.. _ConEmu: https://code.google.com/p/conemu-maximus5/
58+
.. _ANSICON: https://github.com/adoxa/ansicon/releases

Diff for: cookbook/cache/varnish.rst

+34-14
Original file line numberDiff line numberDiff line change
@@ -75,23 +75,43 @@ session cookie, if there is one, and get rid of all other cookies so that pages
7575
are cached if there is no active session. Unless you changed the default
7676
configuration of PHP, your session cookie has the name ``PHPSESSID``:
7777

78-
.. code-block:: varnish4
78+
.. configuration-block::
7979

80-
sub vcl_recv {
81-
// Remove all cookies except the session ID.
82-
if (req.http.Cookie) {
83-
set req.http.Cookie = ";" + req.http.Cookie;
84-
set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
85-
set req.http.Cookie = regsuball(req.http.Cookie, ";(PHPSESSID)=", "; \1=");
86-
set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
87-
set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");
88-
89-
if (req.http.Cookie == "") {
90-
// If there are no more cookies, remove the header to get page cached.
91-
remove req.http.Cookie;
80+
.. code-block:: varnish4
81+
82+
sub vcl_recv {
83+
// Remove all cookies except the session ID.
84+
if (req.http.Cookie) {
85+
set req.http.Cookie = ";" + req.http.Cookie;
86+
set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
87+
set req.http.Cookie = regsuball(req.http.Cookie, ";(PHPSESSID)=", "; \1=");
88+
set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
89+
set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");
90+
91+
if (req.http.Cookie == "") {
92+
// If there are no more cookies, remove the header to get page cached.
93+
unset req.http.Cookie;
94+
}
95+
}
96+
}
97+
98+
.. code-block:: varnish3
99+
100+
sub vcl_recv {
101+
// Remove all cookies except the session ID.
102+
if (req.http.Cookie) {
103+
set req.http.Cookie = ";" + req.http.Cookie;
104+
set req.http.Cookie = regsuball(req.http.Cookie, "; +", ";");
105+
set req.http.Cookie = regsuball(req.http.Cookie, ";(PHPSESSID)=", "; \1=");
106+
set req.http.Cookie = regsuball(req.http.Cookie, ";[^ ][^;]*", "");
107+
set req.http.Cookie = regsuball(req.http.Cookie, "^[; ]+|[; ]+$", "");
108+
109+
if (req.http.Cookie == "") {
110+
// If there are no more cookies, remove the header to get page cached.
111+
remove req.http.Cookie;
112+
}
92113
}
93114
}
94-
}
95115
96116
.. tip::
97117

0 commit comments

Comments
 (0)