diff --git a/best_practices/forms.rst b/best_practices/forms.rst
index 7a44b11ce20..0e556216eeb 100644
--- a/best_practices/forms.rst
+++ b/best_practices/forms.rst
@@ -143,7 +143,7 @@ view layer:
{{ form_widget(form) }}
+ class="btn btn-default pull-right"/>
{{ form_end(form) }}
Validation
diff --git a/bundles/configuration.rst b/bundles/configuration.rst
index 915544c0fa2..d594dbec292 100644
--- a/bundles/configuration.rst
+++ b/bundles/configuration.rst
@@ -81,11 +81,11 @@ allow users to configure it with some configuration that looks like this:
xsi:schemaLocation="http://symfony.com/schema/dic/services
https://symfony.com/schema/dic/services/services-1.0.xsd">
-
-
-
+
+
+
-
+
.. code-block:: php
diff --git a/components/cache/adapters/pdo_doctrine_dbal_adapter.rst b/components/cache/adapters/pdo_doctrine_dbal_adapter.rst
index bbbf9507e82..20d9d5a836a 100644
--- a/components/cache/adapters/pdo_doctrine_dbal_adapter.rst
+++ b/components/cache/adapters/pdo_doctrine_dbal_adapter.rst
@@ -9,7 +9,7 @@ PDO & Doctrine DBAL Cache Adapter
.. versionadded:: 3.2
- The PDO & Doctrine DBAL adapter was introduced in Symfony 3.2.
+ The PDO & Doctrine DBAL adapter was introduced in Symfony 3.2.
This adapter stores the cache items in an SQL database. It requires a `PDO`_,
`Doctrine DBAL Connection`_, or `Data Source Name (DSN)`_ as its first parameter, and
diff --git a/components/cache/adapters/proxy_adapter.rst b/components/cache/adapters/proxy_adapter.rst
index 86b24ead50f..f553798b0f8 100644
--- a/components/cache/adapters/proxy_adapter.rst
+++ b/components/cache/adapters/proxy_adapter.rst
@@ -15,8 +15,9 @@ and optionally a namespace and default cache lifetime as its second and third pa
use Psr\Cache\CacheItemPoolInterface;
use Symfony\Component\Cache\Adapter\ProxyAdapter;
- $psr6CachePool = \\ create your own cache pool instance that implements the PSR-6
- \\ interface `CacheItemPoolInterface`
+ \\ create your own cache pool instance that implements the PSR-6
+ \\ interface `CacheItemPoolInterface`
+ $psr6CachePool = ...
$cache = new ProxyAdapter(
diff --git a/components/console/console_arguments.rst b/components/console/console_arguments.rst
index d49b34701d7..8799cb0cc7f 100644
--- a/components/console/console_arguments.rst
+++ b/components/console/console_arguments.rst
@@ -39,7 +39,7 @@ Have a look at the following command that has three options::
protected function execute(InputInterface $input, OutputInterface $output)
{
- // ...
+ // ...
}
}
diff --git a/components/console/single_command_tool.rst b/components/console/single_command_tool.rst
index d9661eb5b9a..b4afd126a9f 100644
--- a/components/console/single_command_tool.rst
+++ b/components/console/single_command_tool.rst
@@ -8,26 +8,26 @@ When building a command line tool, you may not need to provide several commands.
In such case, having to pass the command name each time is tedious. Fortunately,
it is possible to remove this need by declaring a single command application::
- #!/usr/bin/env php
- register('echo')
- ->addArgument('foo', InputArgument::OPTIONAL, 'The directory')
- ->addOption('bar', null, InputOption::VALUE_REQUIRED)
- ->setCode(function(InputInterface $input, OutputInterface $output) {
- // output arguments and options
- })
- ->getApplication()
- ->setDefaultCommand('echo', true) // Single command application
- ->run();
+ #!/usr/bin/env php
+ register('echo')
+ ->addArgument('foo', InputArgument::OPTIONAL, 'The directory')
+ ->addOption('bar', null, InputOption::VALUE_REQUIRED)
+ ->setCode(function(InputInterface $input, OutputInterface $output) {
+ // output arguments and options
+ })
+ ->getApplication()
+ ->setDefaultCommand('echo', true) // Single command application
+ ->run();
The method :method:`Symfony\\Component\\Console\\Application::setDefaultCommand`
accepts a boolean as second parameter. If true, the command ``echo`` will then
@@ -35,17 +35,17 @@ always be used, without having to pass its name.
Of course, you can still register a command as usual::
- #!/usr/bin/env php
- add($command);
+ $application->add($command);
- $application->setDefaultCommand($command->getName(), true);
- $application->run();
+ $application->setDefaultCommand($command->getName(), true);
+ $application->run();
diff --git a/components/dependency_injection/compilation.rst b/components/dependency_injection/compilation.rst
index ca2761d2293..38496476f55 100644
--- a/components/dependency_injection/compilation.rst
+++ b/components/dependency_injection/compilation.rst
@@ -325,7 +325,7 @@ compilation::
{
public function process(ContainerBuilder $container)
{
- // ... do something during the compilation
+ // ... do something during the compilation
}
// ...
@@ -379,7 +379,7 @@ class implementing the ``CompilerPassInterface``::
{
public function process(ContainerBuilder $container)
{
- // ... do something during the compilation
+ // ... do something during the compilation
}
}
diff --git a/components/dom_crawler.rst b/components/dom_crawler.rst
index 8da88c65c6a..c50347c6b63 100644
--- a/components/dom_crawler.rst
+++ b/components/dom_crawler.rst
@@ -234,7 +234,7 @@ context of the crawler::
// DO THIS: specify the parent tag too
$subCrawler = $parentCrawler->filterXPath('parent/sub-tag/sub-child-tag');
$subCrawler = $parentCrawler->filterXPath('node()/sub-tag/sub-child-tag');
- });
+ });
Adding the Content
~~~~~~~~~~~~~~~~~~
@@ -338,30 +338,30 @@ This behavior is best illustrated with examples::
$crawler->filterXPath('//span[contains(@id, "article-")]')->evaluate('substring-after(@id, "-")');
/* array:3 [
- 0 => "100"
- 1 => "101"
- 2 => "102"
- ]
+ 0 => "100",
+ 1 => "101",
+ 2 => "102",
+ ]
*/
$crawler->evaluate('substring-after(//span[contains(@id, "article-")]/@id, "-")');
/* array:1 [
- 0 => "100"
- ]
+ 0 => "100",
+ ]
*/
$crawler->filterXPath('//span[@class="article"]')->evaluate('count(@id)');
/* array:3 [
- 0 => 1.0
- 1 => 1.0
- 2 => 1.0
- ]
+ 0 => 1.0,
+ 1 => 1.0,
+ 2 => 1.0,
+ ]
*/
$crawler->evaluate('count(//span[@class="article"])');
/* array:1 [
- 0 => 3.0
- ]
+ 0 => 3.0,
+ ]
*/
$crawler->evaluate('//span[1]');
diff --git a/components/filesystem/lock_handler.rst b/components/filesystem/lock_handler.rst
index 96913e17c93..1b963136b0b 100644
--- a/components/filesystem/lock_handler.rst
+++ b/components/filesystem/lock_handler.rst
@@ -82,7 +82,7 @@ PHP code will wait indefinitely until the lock is released by another process.
use Symfony\Component\Filesystem\LockHandler;
- if (!(new LockHandler('hello.lock'))->lock()) {
+ if (!(new LockHandler('hello.lock'))->lock()) {
// the resource "hello" is already locked by another process
return 0;
diff --git a/components/serializer.rst b/components/serializer.rst
index 8838882f7d3..8a1b5b18bcc 100644
--- a/components/serializer.rst
+++ b/components/serializer.rst
@@ -856,11 +856,11 @@ because it is deeper than the configured maximum depth of 2::
$result = [
'foo' => 'level1',
'child' => [
- 'foo' => 'level2',
- 'child' => [
- 'child' => null,
- ],
+ 'foo' => 'level2',
+ 'child' => [
+ 'child' => null,
],
+ ],
];
*/
@@ -1031,7 +1031,7 @@ parameter of the ``ObjectNormalizer``::
$obj = $serializer->denormalize(
['inner' => ['foo' => 'foo', 'bar' => 'bar'], 'date' => '1988/01/21'],
- 'Acme\ObjectOuter'
+ 'Acme\ObjectOuter'
);
dump($obj->getInner()->foo); // 'foo'
diff --git a/components/web_link.rst b/components/web_link.rst
index 1bbfd0a8e79..997c88976b3 100644
--- a/components/web_link.rst
+++ b/components/web_link.rst
@@ -22,16 +22,16 @@ Usage
The following example shows the component in action::
- use Fig\Link\GenericLinkProvider;
- use Fig\Link\Link;
- use Symfony\Component\WebLink\HttpHeaderSerializer;
+ use Fig\Link\GenericLinkProvider;
+ use Fig\Link\Link;
+ use Symfony\Component\WebLink\HttpHeaderSerializer;
- $linkProvider = (new GenericLinkProvider())
- ->withLink(new Link('preload', '/bootstrap.min.css'));
+ $linkProvider = (new GenericLinkProvider())
+ ->withLink(new Link('preload', '/bootstrap.min.css'));
- header('Link: '.(new HttpHeaderSerializer())->serialize($linkProvider->getLinks()));
+ header('Link: '.(new HttpHeaderSerializer())->serialize($linkProvider->getLinks()));
- echo 'Hello';
+ echo 'Hello';
Read the full :doc:`WebLink documentation ` to learn about all the
features of the component and its integration with the Symfony framework.
diff --git a/configuration/environments.rst b/configuration/environments.rst
index 34bbe0f0a94..36092905376 100644
--- a/configuration/environments.rst
+++ b/configuration/environments.rst
@@ -214,9 +214,9 @@ this code and changing the environment string.
.. code-block:: yaml
doctrine:
- dbal:
- logging: '%kernel.debug%'
- # ...
+ dbal:
+ logging: '%kernel.debug%'
+ # ...
.. code-block:: xml
diff --git a/configuration/external_parameters.rst b/configuration/external_parameters.rst
index a74378fd9f9..57d8e93022d 100644
--- a/configuration/external_parameters.rst
+++ b/configuration/external_parameters.rst
@@ -87,7 +87,7 @@ will be used whenever the corresponding environment variable is *not* found:
%env(DATABASE_HOST)%
localhost
-
+
.. code-block:: php
diff --git a/console/commands_as_services.rst b/console/commands_as_services.rst
index ee330f50fe1..03eef9ac0c9 100644
--- a/console/commands_as_services.rst
+++ b/console/commands_as_services.rst
@@ -112,7 +112,7 @@ Or set the ``command`` attribute on the ``console.command`` tag in your service
-
+
diff --git a/create_framework/routing.rst b/create_framework/routing.rst
index f4d3a5db57e..dd491825f4a 100644
--- a/create_framework/routing.rst
+++ b/create_framework/routing.rst
@@ -95,25 +95,25 @@ The ``match()`` method takes a request path and returns an array of attributes
print_r($matcher->match('/bye'));
/* Gives:
- array (
- '_route' => 'bye',
- );
+ [
+ '_route' => 'bye',
+ ];
*/
print_r($matcher->match('/hello/Fabien'));
/* Gives:
- array (
- 'name' => 'Fabien',
- '_route' => 'hello',
- );
+ [
+ 'name' => 'Fabien',
+ '_route' => 'hello',
+ ];
*/
print_r($matcher->match('/hello'));
/* Gives:
- array (
- 'name' => 'World',
- '_route' => 'hello',
- );
+ [
+ 'name' => 'World',
+ '_route' => 'hello',
+ ];
*/
.. note::
@@ -165,23 +165,23 @@ There are a few new things in the code:
* Request attributes are extracted to keep our templates simple::
-
- Hello = htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>
+ // example.com/src/pages/hello.php
+ Hello = htmlspecialchars($name, ENT_QUOTES, 'UTF-8') ?>
* Route configuration has been moved to its own file::
- // example.com/src/app.php
- use Symfony\Component\Routing;
+ // example.com/src/app.php
+ use Symfony\Component\Routing;
- $routes = new Routing\RouteCollection();
- $routes->add('hello', new Routing\Route('/hello/{name}', ['name' => 'World']));
- $routes->add('bye', new Routing\Route('/bye'));
+ $routes = new Routing\RouteCollection();
+ $routes->add('hello', new Routing\Route('/hello/{name}', ['name' => 'World']));
+ $routes->add('bye', new Routing\Route('/bye'));
- return $routes;
+ return $routes;
- We now have a clear separation between the configuration (everything
- specific to our application in ``app.php``) and the framework (the generic
- code that powers our application in ``front.php``).
+We now have a clear separation between the configuration (everything
+specific to our application in ``app.php``) and the framework (the generic
+code that powers our application in ``front.php``).
With less than 30 lines of code, we have a new framework, more powerful and
more flexible than the previous one. Enjoy!
diff --git a/doctrine/dbal.rst b/doctrine/dbal.rst
index 1e614da08b7..59e98d46ca1 100644
--- a/doctrine/dbal.rst
+++ b/doctrine/dbal.rst
@@ -164,8 +164,8 @@ mapping type:
# app/config/config.yml
doctrine:
dbal:
- mapping_types:
- enum: string
+ mapping_types:
+ enum: string
.. code-block:: xml
@@ -180,7 +180,7 @@ mapping type:
- string
+ string
@@ -190,9 +190,9 @@ mapping type:
// app/config/config.php
$container->loadFromExtension('doctrine', [
'dbal' => [
- 'mapping_types' => [
- 'enum' => 'string',
- ],
+ 'mapping_types' => [
+ 'enum' => 'string',
+ ],
],
]);
diff --git a/email/dev_environment.rst b/email/dev_environment.rst
index af09c61eaa9..8224eab88c8 100644
--- a/email/dev_environment.rst
+++ b/email/dev_environment.rst
@@ -145,10 +145,10 @@ by adding the ``delivery_whitelist`` option:
swiftmailer:
delivery_addresses: ['dev@example.com']
delivery_whitelist:
- # all email addresses matching these regexes will be delivered
- # like normal, as well as being sent to dev@example.com
- - '/@specialdomain\.com$/'
- - '/^admin@mydomain\.com$/'
+ # all email addresses matching these regexes will be delivered
+ # like normal, as well as being sent to dev@example.com
+ - '/@specialdomain\.com$/'
+ - '/^admin@mydomain\.com$/'
.. code-block:: xml
diff --git a/email/spool.rst b/email/spool.rst
index 744240382fc..9709fc4c371 100644
--- a/email/spool.rst
+++ b/email/spool.rst
@@ -51,7 +51,7 @@ swiftmailer with the memory option, use the following configuration:
// app/config/config.php
$container->loadFromExtension('swiftmailer', [
- // ...
+ // ...
'spool' => ['type' => 'memory'],
]);
@@ -101,7 +101,7 @@ In order to use the spool with files, use the following configuration:
// app/config/config.php
$container->loadFromExtension('swiftmailer', [
- // ...
+ // ...
'spool' => [
'type' => 'file',
diff --git a/quick_tour/the_view.rst b/quick_tour/the_view.rst
index e0cd5528a1d..f32ebac9694 100644
--- a/quick_tour/the_view.rst
+++ b/quick_tour/the_view.rst
@@ -68,14 +68,14 @@ on its type:
{# 1. Simple variables #}
{# $this->render('template.html.twig', [
- 'name' => 'Fabien',
- ]) #}
+ 'name' => 'Fabien',
+ ]) #}
{{ name }}
{# 2. Arrays #}
{# $this->render('template.html.twig', [
- 'user' => ['name' => 'Fabien']
- ]) #}
+ 'user' => ['name' => 'Fabien'],
+ ]) #}
{{ user.name }}
{# alternative syntax for arrays #}
@@ -83,8 +83,8 @@ on its type:
{# 3. Objects #}
{# $this->render('template.html.twig', [
- 'user' => new User('Fabien')
- ]) #}
+ 'user' => new User('Fabien'),
+ ]) #}
{{ user.name }}
{{ user.getName }}
diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst
index 479ba0a3365..b648ea96183 100644
--- a/reference/configuration/doctrine.rst
+++ b/reference/configuration/doctrine.rst
@@ -194,7 +194,7 @@ can be placed directly under ``doctrine.orm`` config level.
orm:
# ...
query_cache_driver:
- # ...
+ # ...
metadata_cache_driver:
# ...
result_cache_driver:
diff --git a/reference/constraints/Collection.rst b/reference/constraints/Collection.rst
index a5bfe840860..5c25f89b3ce 100644
--- a/reference/constraints/Collection.rst
+++ b/reference/constraints/Collection.rst
@@ -80,10 +80,10 @@ following:
* allowMissingFields = true
* )
*/
- protected $profileData = [
- 'personal_email' => '...',
- 'short_bio' => '...',
- ];
+ protected $profileData = [
+ 'personal_email' => '...',
+ 'short_bio' => '...',
+ ];
}
.. code-block:: yaml
diff --git a/reference/constraints/Range.rst b/reference/constraints/Range.rst
index 39bf8148ca7..25cdb46f294 100644
--- a/reference/constraints/Range.rst
+++ b/reference/constraints/Range.rst
@@ -44,7 +44,7 @@ you might add the following:
* maxMessage = "You cannot be taller than {{ limit }}cm to enter"
* )
*/
- protected $height;
+ protected $height;
}
.. code-block:: yaml
diff --git a/reference/constraints/Url.rst b/reference/constraints/Url.rst
index 5dbee2ecca2..7992ba93a4d 100644
--- a/reference/constraints/Url.rst
+++ b/reference/constraints/Url.rst
@@ -379,7 +379,7 @@ DNS check failed.
public static function loadValidatorMetadata(ClassMetadata $metadata)
{
$metadata->addPropertyConstraint('bioUrl', new Assert\Url([
- 'dnsMessage' => 'The host "{{ value }}" could not be resolved.',
+ 'dnsMessage' => 'The host "{{ value }}" could not be resolved.',
]));
}
}
diff --git a/reference/dic_tags.rst b/reference/dic_tags.rst
index 76244012507..2494272e8fb 100644
--- a/reference/dic_tags.rst
+++ b/reference/dic_tags.rst
@@ -262,11 +262,11 @@ services:
+ class="AppBundle\Lock\MysqlLock"/>
+ class="AppBundle\Lock\PostgresqlLock"/>
+ class="AppBundle\Lock\SqliteLock"/>
@@ -313,11 +313,11 @@ the generic ``app.lock`` service can be defined as follows:
+ class="AppBundle\Lock\MysqlLock"/>
+ class="AppBundle\Lock\PostgresqlLock"/>
+ class="AppBundle\Lock\SqliteLock"/>
diff --git a/reference/forms/types/entity.rst b/reference/forms/types/entity.rst
index 02c7e97a857..165190707f8 100644
--- a/reference/forms/types/entity.rst
+++ b/reference/forms/types/entity.rst
@@ -177,8 +177,8 @@ more details, see the main :ref:`choice_label ` doc
// ...
$builder->add('genre', EntityType::class, [
- 'class' => Genre::class,
- 'choice_label' => 'translations[en].name',
+ 'class' => Genre::class,
+ 'choice_label' => 'translations[en].name',
]);
class
diff --git a/reference/forms/types/options/label_attr.rst.inc b/reference/forms/types/options/label_attr.rst.inc
index 48e0dfa9191..026a9a3ef68 100644
--- a/reference/forms/types/options/label_attr.rst.inc
+++ b/reference/forms/types/options/label_attr.rst.inc
@@ -13,7 +13,7 @@ template:
.. code-block:: twig
{{ form_label(form.name, 'Your name', {
- 'label_attr': {'class': 'CUSTOM_LABEL_CLASS'}
+ 'label_attr': {'class': 'CUSTOM_LABEL_CLASS'}
}) }}
.. code-block:: php
diff --git a/reference/forms/types/options/preferred_choices.rst.inc b/reference/forms/types/options/preferred_choices.rst.inc
index 0f2a5064ee0..3d5d8567543 100644
--- a/reference/forms/types/options/preferred_choices.rst.inc
+++ b/reference/forms/types/options/preferred_choices.rst.inc
@@ -61,5 +61,5 @@ when rendering the field:
.. code-block:: php
= $view['form']->widget($form['publishAt'], [
- 'separator' => '====='
+ 'separator' => '=====',
]) ?>
diff --git a/routing.rst b/routing.rst
index dbe514ac433..993970df84c 100644
--- a/routing.rst
+++ b/routing.rst
@@ -402,12 +402,12 @@ With all of this in mind, check out this advanced example:
# app/config/routing.yml
article_show:
- path: /articles/{_locale}/{year}/{slug}.{_format}
- defaults: { _controller: AppBundle:Article:show, _format: html }
- requirements:
- _locale: en|fr
- _format: html|rss
- year: \d+
+ path: /articles/{_locale}/{year}/{slug}.{_format}
+ defaults: { _controller: AppBundle:Article:show, _format: html }
+ requirements:
+ _locale: en|fr
+ _format: html|rss
+ year: \d+
.. code-block:: xml
diff --git a/security.rst b/security.rst
index 982c5cd47eb..130e639efcb 100644
--- a/security.rst
+++ b/security.rst
@@ -261,10 +261,10 @@ user to be logged in to access this URL:
// ...
],
],
- 'access_control' => [
- // require ROLE_ADMIN for /admin*
+ 'access_control' => [
+ // require ROLE_ADMIN for /admin*
['path' => '^/admin', 'roles' => 'ROLE_ADMIN'],
- ],
+ ],
]);
.. note::
@@ -749,10 +749,10 @@ URL pattern. You saw this earlier, where anything matching the regular expressio
// ...
],
],
- 'access_control' => [
- // require ROLE_ADMIN for /admin*
- ['path' => '^/admin', 'role' => 'ROLE_ADMIN'],
- ],
+ 'access_control' => [
+ // require ROLE_ADMIN for /admin*
+ ['path' => '^/admin', 'role' => 'ROLE_ADMIN'],
+ ],
]);
This is great for securing entire sections, but you'll also probably want