Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d9de7f6

Browse filesBrowse files
committed
Merge branch '2.8' into 3.4
* 2.8: Use the shorthand notation when applicable
2 parents 22fd27b + 90f42c1 commit d9de7f6
Copy full SHA for d9de7f6
Expand file treeCollapse file tree

38 files changed

+64
-186
lines changed

‎best_practices/business-logic.rst

Copy file name to clipboardExpand all lines: best_practices/business-logic.rst
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,7 @@ The blog application needs a utility that can transform a post title (e.g.
6161
part of the post URL.
6262

6363
Let's create a new ``Slugger`` class inside ``src/AppBundle/Utils/`` and
64-
add the following ``slugify()`` method:
65-
66-
.. code-block:: php
64+
add the following ``slugify()`` method::
6765

6866
// src/AppBundle/Utils/Slugger.php
6967
namespace AppBundle\Utils;
@@ -106,9 +104,7 @@ use the class name.
106104
case, use a snake case id).
107105

108106
Now you can use the custom slugger in any controller class, such as the
109-
``AdminController``:
110-
111-
.. code-block:: php
107+
``AdminController``::
112108

113109
use AppBundle\Utils\Slugger;
114110

@@ -229,9 +225,7 @@ PHP and annotations.
229225
Use annotations to define the mapping information of the Doctrine entities.
230226

231227
Annotations are by far the most convenient and agile way of setting up and
232-
looking for mapping information:
233-
234-
.. code-block:: php
228+
looking for mapping information::
235229

236230
namespace AppBundle\Entity;
237231

@@ -310,9 +304,7 @@ the following command to install the Doctrine fixtures bundle:
310304
$ composer require "doctrine/doctrine-fixtures-bundle"
311305
312306
Then, enable the bundle in ``AppKernel.php``, but only for the ``dev`` and
313-
``test`` environments:
314-
315-
.. code-block:: php
307+
``test`` environments::
316308

317309
use Symfony\Component\HttpKernel\Kernel;
318310

‎best_practices/configuration.rst

Copy file name to clipboardExpand all lines: best_practices/configuration.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ Constants can be used for example in your Twig templates thanks to the
133133
</p>
134134

135135
And Doctrine entities and repositories can now easily access these values,
136-
whereas they cannot access the container parameters:
137-
138-
.. code-block:: php
136+
whereas they cannot access the container parameters::
139137

140138
namespace AppBundle\Repository;
141139

‎best_practices/controllers.rst

Copy file name to clipboardExpand all lines: best_practices/controllers.rst
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ What does the Controller look like
8989
----------------------------------
9090

9191
Considering all this, here is an example of what the controller should look like
92-
for the homepage of our app:
93-
94-
.. code-block:: php
92+
for the homepage of our app::
9593

9694
namespace AppBundle\Controller;
9795

@@ -145,9 +143,7 @@ to automatically query for an entity and pass it as an argument to your controll
145143
Use the ParamConverter trick to automatically query for Doctrine entities
146144
when it's simple and convenient.
147145

148-
For example:
149-
150-
.. code-block:: php
146+
For example::
151147

152148
use AppBundle\Entity\Post;
153149
use Symfony\Component\Routing\Annotation\Route;
@@ -177,9 +173,7 @@ When Things Get More Advanced
177173
The above example works without any configuration because the wildcard name ``{id}`` matches
178174
the name of the property on the entity. If this isn't true, or if you have
179175
even more complex logic, the easiest thing to do is just query for the entity
180-
manually. In our application, we have this situation in ``CommentController``:
181-
182-
.. code-block:: php
176+
manually. In our application, we have this situation in ``CommentController``::
183177

184178
/**
185179
* @Route("/comment/{postSlug}/new", name="comment_new")
@@ -198,9 +192,7 @@ manually. In our application, we have this situation in ``CommentController``:
198192
}
199193

200194
You can also use the ``@ParamConverter`` configuration, which is infinitely
201-
flexible:
202-
203-
.. code-block:: php
195+
flexible::
204196

205197
use AppBundle\Entity\Post;
206198
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;

‎best_practices/forms.rst

Copy file name to clipboardExpand all lines: best_practices/forms.rst
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ makes them easier to re-use later.
8888
The Symfony Form component allows you to add buttons as fields on your form.
8989
This is a nice way to simplify the template that renders your form. But if you
9090
add the buttons directly in your form class, this would effectively limit the
91-
scope of that form:
92-
93-
.. code-block:: php
91+
scope of that form::
9492

9593
class PostType extends AbstractType
9694
{
@@ -173,9 +171,7 @@ can control *how* the form renders at a global level using form theming.
173171
Handling Form Submits
174172
---------------------
175173

176-
Handling a form submit usually follows a similar template:
177-
178-
.. code-block:: php
174+
Handling a form submit usually follows a similar template::
179175

180176
public function newAction(Request $request)
181177
{

‎best_practices/security.rst

Copy file name to clipboardExpand all lines: best_practices/security.rst
+7-21Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ Using Expressions for Complex Security Restrictions
137137
If your security logic is a little bit more complex, you can use an :doc:`expression </components/expression_language>`
138138
inside ``@Security``. In the following example, a user can only access the
139139
controller if their email matches the value returned by the ``getAuthorEmail()``
140-
method on the ``Post`` object:
141-
142-
.. code-block:: php
140+
method on the ``Post`` object::
143141

144142
use AppBundle\Entity\Post;
145143
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -170,9 +168,7 @@ need to repeat the expression code using Twig syntax:
170168
{% endif %}
171169

172170
The easiest solution - if your logic is simple enough - is to add a new method
173-
to the ``Post`` entity that checks if a given user is its author:
174-
175-
.. code-block:: php
171+
to the ``Post`` entity that checks if a given user is its author::
176172

177173
// src/AppBundle/Entity/Post.php
178174
// ...
@@ -192,9 +188,7 @@ to the ``Post`` entity that checks if a given user is its author:
192188
}
193189
}
194190

195-
Now you can reuse this method both in the template and in the security expression:
196-
197-
.. code-block:: php
191+
Now you can reuse this method both in the template and in the security expression::
198192

199193
use AppBundle\Entity\Post;
200194
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
@@ -225,9 +219,7 @@ Checking Permissions without @Security
225219
The above example with ``@Security`` only works because we're using the
226220
:ref:`ParamConverter <best-practices-paramconverter>`, which gives the expression
227221
access to the ``post`` variable. If you don't use this, or have some other
228-
more advanced use-case, you can always do the same security check in PHP:
229-
230-
.. code-block:: php
222+
more advanced use-case, you can always do the same security check in PHP::
231223

232224
/**
233225
* @Route("/{id}/edit", name="admin_post_edit")
@@ -266,9 +258,7 @@ of magnitude easier than :doc:`ACLs </security/acl>` and will give
266258
you the flexibility you need in almost all cases.
267259

268260
First, create a voter class. The following example shows a voter that implements
269-
the same ``getAuthorEmail()`` logic you used above:
270-
271-
.. code-block:: php
261+
the same ``getAuthorEmail()`` logic you used above::
272262

273263
namespace AppBundle\Security;
274264

@@ -342,9 +332,7 @@ your application will :ref:`autoconfigure <services-autoconfigure>` your securit
342332
voter and inject an ``AccessDecisionManagerInterface`` instance into it thanks to
343333
:doc:`autowiring </service_container/autowiring>`.
344334

345-
Now, you can use the voter with the ``@Security`` annotation:
346-
347-
.. code-block:: php
335+
Now, you can use the voter with the ``@Security`` annotation::
348336

349337
/**
350338
* @Route("/{id}/edit", name="admin_post_edit")
@@ -356,9 +344,7 @@ Now, you can use the voter with the ``@Security`` annotation:
356344
}
357345

358346
You can also use this directly with the ``security.authorization_checker`` service or
359-
via the even easier shortcut in a controller:
360-
361-
.. code-block:: php
347+
via the even easier shortcut in a controller::
362348

363349
/**
364350
* @Route("/{id}/edit", name="admin_post_edit")

‎best_practices/templates.rst

Copy file name to clipboardExpand all lines: best_practices/templates.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ Markdown content into HTML::
105105

106106
Next, create a new Twig extension and define a new filter called ``md2html``
107107
using the ``Twig_SimpleFilter`` class. Inject the newly defined ``Markdown``
108-
class in the constructor of the Twig extension:
109-
110-
.. code-block:: php
108+
class in the constructor of the Twig extension::
111109

112110
namespace AppBundle\Twig;
113111

‎best_practices/tests.rst

Copy file name to clipboardExpand all lines: best_practices/tests.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,7 @@ generator service:
8080
generator.
8181

8282
Consider the following functional test that uses the ``router`` service to
83-
generate the URL of the tested page:
84-
85-
.. code-block:: php
83+
generate the URL of the tested page::
8684

8785
public function testBlogArchives()
8886
{

‎components/config/definition.rst

Copy file name to clipboardExpand all lines: components/config/definition.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,9 +461,7 @@ Documenting the Option
461461

462462
All options can be documented using the
463463
:method:`Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::info`
464-
method.
465-
466-
.. code-block:: php
464+
method::
467465

468466
$rootNode
469467
->children()

‎components/dom_crawler.rst

Copy file name to clipboardExpand all lines: components/dom_crawler.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ The crawler supports multiple ways of adding the content::
253253

254254
As the Crawler's implementation is based on the DOM extension, it is also able
255255
to interact with native :phpclass:`DOMDocument`, :phpclass:`DOMNodeList`
256-
and :phpclass:`DOMNode` objects:
257-
258-
.. code-block:: php
256+
and :phpclass:`DOMNode` objects::
259257

260258
$domDocument = new \DOMDocument();
261259
$domDocument->loadXml('<root><node /><node /></root>');

‎components/expression_language/extending.rst

Copy file name to clipboardExpand all lines: components/expression_language/extending.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ This interface requires one method:
6565
:method:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunctionProviderInterface::getFunctions`,
6666
which returns an array of expression functions (instances of
6767
:class:`Symfony\\Component\\ExpressionLanguage\\ExpressionFunction`) to
68-
register.
69-
70-
.. code-block:: php
68+
register::
7169

7270
use Symfony\Component\ExpressionLanguage\ExpressionFunction;
7371
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;

‎components/filesystem/lock_handler.rst

Copy file name to clipboardExpand all lines: components/filesystem/lock_handler.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ Usage
2424
The lock handler only works if you're using just one server. If you have
2525
several hosts, you must not use this helper.
2626

27-
A lock can be used, for example, to allow only one instance of a command to run.
28-
29-
.. code-block:: php
27+
A lock can be used, for example, to allow only one instance of a command to run::
3028

3129
use Symfony\Component\Filesystem\LockHandler;
3230

‎components/process.rst

Copy file name to clipboardExpand all lines: components/process.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,7 @@ Process Pid
391391
-----------
392392

393393
You can access the `pid`_ of a running process with the
394-
:method:`Symfony\\Component\\Process\\Process::getPid` method.
395-
396-
.. code-block:: php
394+
:method:`Symfony\\Component\\Process\\Process::getPid` method::
397395

398396
use Symfony\Component\Process\Process;
399397

‎components/templating.rst

Copy file name to clipboardExpand all lines: components/templating.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,7 @@ takes a list of engines and acts just like a normal templating engine. The
187187
only difference is that it delegates the calls to one of the other engines. To
188188
choose which one to use for the template, the
189189
:method:`EngineInterface::supports() <Symfony\\Component\\Templating\\EngineInterface::supports>`
190-
method is used.
191-
192-
.. code-block:: php
190+
method is used::
193191

194192
use Acme\Templating\CustomEngine;
195193
use Symfony\Component\Templating\PhpEngine;

‎components/translation.rst

Copy file name to clipboardExpand all lines: components/translation.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ catalogs*).
2929
Configuration
3030
~~~~~~~~~~~~~
3131

32-
The constructor of the ``Translator`` class needs one argument: The locale.
33-
34-
.. code-block:: php
32+
The constructor of the ``Translator`` class needs one argument: The locale::
3533

3634
use Symfony\Component\Translation\Translator;
3735

‎components/yaml.rst

Copy file name to clipboardExpand all lines: components/yaml.rst
+4-12Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ Reading YAML Contents
9696
~~~~~~~~~~~~~~~~~~~~~
9797

9898
The :method:`Symfony\\Component\\Yaml\\Yaml::parse` method parses a YAML
99-
string and converts it to a PHP array:
100-
101-
.. code-block:: php
99+
string and converts it to a PHP array::
102100

103101
use Symfony\Component\Yaml\Yaml;
104102

@@ -108,9 +106,7 @@ string and converts it to a PHP array:
108106
If an error occurs during parsing, the parser throws a
109107
:class:`Symfony\\Component\\Yaml\\Exception\\ParseException` exception
110108
indicating the error type and the line in the original YAML string where the
111-
error occurred:
112-
113-
.. code-block:: php
109+
error occurred::
114110

115111
use Symfony\Component\Yaml\Exception\ParseException;
116112

@@ -141,9 +137,7 @@ Writing YAML Files
141137
~~~~~~~~~~~~~~~~~~
142138

143139
The :method:`Symfony\\Component\\Yaml\\Yaml::dump` method dumps any PHP
144-
array to its YAML representation:
145-
146-
.. code-block:: php
140+
array to its YAML representation::
147141

148142
use Symfony\Component\Yaml\Yaml;
149143

@@ -175,9 +169,7 @@ representation:
175169
176170
The second argument of the :method:`Symfony\\Component\\Yaml\\Yaml::dump`
177171
method customizes the level at which the output switches from the expanded
178-
representation to the inline one:
179-
180-
.. code-block:: php
172+
representation to the inline one::
181173

182174
echo Yaml::dump($array, 1);
183175

‎components/yaml/yaml_format.rst

Copy file name to clipboardExpand all lines: components/yaml/yaml_format.rst
+3-9Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,7 @@ Sequences use a dash followed by a space:
177177
- Perl
178178
- Python
179179
180-
The previous YAML file is equivalent to the following PHP code:
181-
182-
.. code-block:: php
180+
The previous YAML file is equivalent to the following PHP code::
183181

184182
array('PHP', 'Perl', 'Python');
185183

@@ -191,9 +189,7 @@ Mappings use a colon followed by a space (``:`` ) to mark each key/value pair:
191189
MySQL: 5.1
192190
Apache: 2.2.20
193191
194-
which is equivalent to this PHP code:
195-
196-
.. code-block:: php
192+
which is equivalent to this PHP code::
197193

198194
array('PHP' => 5.2, 'MySQL' => 5.1, 'Apache' => '2.2.20');
199195

@@ -220,9 +216,7 @@ YAML uses indentation with one or more spaces to describe nested collections:
220216
PHP: 5.2
221217
Propel: 1.3
222218
223-
The above YAML is equivalent to the following PHP code:
224-
225-
.. code-block:: php
219+
The above YAML is equivalent to the following PHP code::
226220

227221
array(
228222
'symfony 1.0' => array(

‎configuration/environments.rst

Copy file name to clipboardExpand all lines: configuration/environments.rst
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ are used:
3131
* for the ``test`` environment: ``app/config/config_test.yml``
3232

3333
This works via a simple standard that's used by default inside the ``AppKernel``
34-
class:
35-
36-
.. code-block:: php
34+
class::
3735

3836
// app/AppKernel.php
3937

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.