10000 use .. instead of .. code-block:: php by OskarStark · Pull Request #11125 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

use .. instead of .. code-block:: php #11125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions best_practices/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,7 @@ For controlling access on a controller-by-controller basis, use the ``@Security`
annotation whenever possible. Placing it above each action makes it consistent and readable.

In our application, you need the ``ROLE_ADMIN`` in order to create a new post.
Using ``@Security``, this looks like:

.. code-block:: php
Using ``@Security``, this looks like::

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Symfony\Component\Routing\Annotation\Route;
Expand Down
4 changes: 1 addition & 3 deletions bundles/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,7 @@ In your extension, you can load this and dynamically set its arguments::
Using the Config component is fully optional. The ``load()`` method gets an
array of configuration values. You can simply parse these arrays yourself
(e.g. by overriding configurations and using :phpfunction:`isset` to check
for the existence of a value). Be aware that it'll be very hard to support XML.

.. code-block:: php
for the existence of a value). Be aware that it'll be very hard to support XML::

public function load(array $configs, ContainerBuilder $container)
{
Expand Down
8 changes: 2 additions & 6 deletions components/property_access.rst
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,7 @@ can use setters, the magic ``__set()`` method or properties to set values::
var_dump($person->getChildren()); // [Person()];

You can also use ``__call()`` to set values but you need to enable the feature,
see `Enable other Features`_.

.. code-block:: php
see `Enable other Features`_::

// ...
class Person
Expand Down Expand Up @@ -335,9 +333,7 @@ Writing to Array Properties
~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``PropertyAccessor`` class allows to update the content of arrays stored in
properties through *adder* and *remover* methods.

.. code-block:: php
properties through *adder* and *remover* methods::

// ...
class Person
Expand Down
32 changes: 8 additions & 24 deletions components/property_info.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ Usage

To use this component, create a new
:class:`Symfony\\Component\\PropertyInfo\\PropertyInfoExtractor` instance and
provide it with a set of information extractors.

.. code-block:: php
provide it with a set of information extractors::

use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;
Expand Down Expand Up @@ -146,9 +144,7 @@ List Information

Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyListExtractorInterface`
provide the list of properties that are available on a class as an array
containing each property name as a string.

.. code-block:: php
containing each property name as a string::

$properties = $propertyInfo->getProperties($class);
/*
Expand All @@ -168,9 +164,7 @@ Type Information

Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyTypeExtractorInterface`
provide :ref:`extensive data type information <components-property-info-type>`
for a property.

.. code-block:: php
for a property::

$types = $propertyInfo->getTypes($class, $property);

Expand Down Expand Up @@ -199,9 +193,7 @@ Description Information

Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyDescriptionExtractorInterface`
provide long and short descriptions from a properties annotations as
strings.

.. code-block:: php
strings::

$title = $propertyInfo->getShortDescription($class, $property);
/*
Expand All @@ -225,9 +217,7 @@ Access Information
~~~~~~~~~~~~~~~~~~

Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyAccessExtractorInterface`
provide whether properties are readable or writable as booleans.

.. code-block:: php
provide whether properties are readable or writable as booleans::

$propertyInfo->isReadable($class, $property);
// Example Result: bool(true)
Expand Down Expand Up @@ -422,9 +412,7 @@ Using `phpDocumentor Reflection`_ to parse property and method annotations,
the :class:`Symfony\\Component\\PropertyInfo\\Extractor\\PhpDocExtractor`
provides type and description information. This extractor is automatically
registered with the ``property_info`` in the Symfony Framework *if* the dependent
library is present.

.. code-block:: php
library is present::

use Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor;

Expand All @@ -447,9 +435,7 @@ Using :ref:`groups metadata <serializer-using-serialization-groups-annotations>`
from the :doc:`Serializer component </components/serializer>`,
the :class:`Symfony\\Component\\PropertyInfo\\Extractor\\SerializerExtractor`
provides list information. This extractor is *not* registered automatically
with the ``property_info`` service in the Symfony Framework.

.. code-block:: php
with the ``property_info`` service in the Symfony Framework::

use Doctrine\Common\Annotations\AnnotationReader;
use Symfony\Component\PropertyInfo\Extractor\SerializerExtractor;
Expand All @@ -475,9 +461,7 @@ DoctrineExtractor
Using entity mapping data from `Doctrine ORM`_, the
:class:`Symfony\\Bridge\\Doctrine\\PropertyInfo\\DoctrineExtractor`
provides list and type information. This extractor is not registered automatically
with the ``property_info`` service in the Symfony Framework.

.. code-block:: php
with the ``property_info`` service in the Symfony Framework::

use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\Setup;
Expand Down
4 changes: 1 addition & 3 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -883,9 +883,7 @@ If you want to deserialize such a structure, you need to add the
:class:`Symfony\\Component\\Serializer\\Normalizer\\ArrayDenormalizer`
to the set of normalizers. By appending ``[]`` to the type parameter of the
:method:`Symfony\\Component\\Serializer\\Serializer::deserialize` method,
you indicate that you're expecting an array instead of a single object.

.. code-block:: php
you indicate that you're expecting an array instead of a single object::

use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Normalizer\ArrayDenormalizer;
Expand Down
12 changes: 3 additions & 9 deletions components/var_dumper/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,7 @@ output produced by the different casters.
in Symfony 3.1.

If ``DUMP_STRING_LENGTH`` is set, then the length of a string is displayed
next to its content:

.. code-block:: php
next to its content::

use Symfony\Component\VarDumper\Dumper\AbstractDumper;
use Symfony\Component\VarDumper\Dumper\CliDumper;
Expand All @@ -259,9 +257,7 @@ next to its content:
// ]

If ``DUMP_LIGHT_ARRAY`` is set, then arrays are dumped in a shortened format
similar to PHP's short array notation:

.. code-block:: php
similar to PHP's short array notation::

use Symfony\Component\VarDumper\Dumper\AbstractDumper;
use Symfony\Component\VarDumper\Dumper\CliDumper;
Expand All @@ -283,9 +279,7 @@ similar to PHP's short array notation:
// ]

If you would like to use both options, then you can just combine them by
using a the logical OR operator ``|``:

.. code-block:: php
using a the logical OR operator ``|``::

use Symfony\Component\VarDumper\Dumper\AbstractDumper;
use Symfony\Component\VarDumper\Dumper\CliDumper;
Expand Down
4 changes: 1 addition & 3 deletions contributing/code/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ Symfony Coding Standards in Detail
----------------------------------

If you want to learn about the Symfony coding standards in detail, here's a
short example containing most features described below:

.. code-block:: php
short example containing most features described below::

/*
* This file is part of the Symfony package.
Expand Down
4 changes: 1 addition & 3 deletions deployment/proxies.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ Solution: setTrustedProxies()
-----------------------------

To fix this, you need to tell Symfony which reverse proxy IP addresses to trust
and what headers your reverse proxy uses to send information:

.. code-block:: php
and what headers your reverse proxy uses to send information::

// web/app.php

10000 Expand Down
4 changes: 1 addition & 3 deletions form/data_mappers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ one of the values is changed.

The red, green and blue form fields have to be mapped to the constructor
arguments and the ``Color`` instance has to be mapped to red, green and blue
form fields. Recognize a familiar pattern? It's time for a data mapper!

.. code-block:: php
form fields. Recognize a familiar pattern? It's time for a data mapper::

// src/App/Form/DataMapper/ColorMapper.php
namespace App\Form\DataMapper;
Expand Down
4 changes: 1 addition & 3 deletions form/without_class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ but here's a short example::

If you are using validation groups, you need to either reference the
``Default`` group when creating the form, or set the correct group on
the constraint you are adding.

.. code-block:: php
the constraint you are adding::

new NotBlank(['groups' => ['create', 'update']]);

Expand Down
4 changes: 1 addition & 3 deletions security/user_checkers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ User checkers are classes that must implement the
defines two methods called ``checkPreAuth()`` and ``checkPostAuth()`` to
perform checks before and after user authentication. If one or more conditions
are not met, an exception should be thrown which extends the
:class:`Symfony\\Component\\Security\\Core\\Exception\\AccountStatusException`.

.. code-block:: php
:class:`Symfony\\Component\\Security\\Core\\Exception\\AccountStatusException`::

namespace AppBundle\Security;

Expand Down
4 changes: 1 addition & 3 deletions service_container/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -509,9 +509,7 @@ first constructor argument to the ``App\HandlerCollection`` service:
->addArgument(new TaggedIteratorArgument('app.handler'));

After compilation the ``HandlerCollection`` service is able to iterate over your
application handlers.

.. code-block:: php
application handlers::

// src/AppBundle/HandlerCollection.php
namespace AppBundle;
Expand Down
0