From ab4f29b303d73cdfa9721ecae485342c37c57bfb Mon Sep 17 00:00:00 2001 From: Oskar Stark Date: Sun, 10 Mar 2019 17:04:30 +0100 Subject: [PATCH] use .. instead of .. code-block: php --- best_practices/security.rst | 4 +--- bundles/configuration.rst | 4 +--- components/property_access.rst | 8 ++------ components/property_info.rst | 32 ++++++++---------------------- components/serializer.rst | 4 +--- components/var_dumper/advanced.rst | 12 +++-------- contributing/code/standards.rst | 4 +--- deployment/proxies.rst | 4 +--- form/data_mappers.rst | 4 +--- form/without_class.rst | 4 +--- security/user_checkers.rst | 4 +--- service_container/tags.rst | 4 +--- 12 files changed, 22 insertions(+), 66 deletions(-) diff --git a/best_practices/security.rst b/best_practices/security.rst index 293a4c78b0b..7eb094ef791 100644 --- a/best_practices/security.rst +++ b/best_practices/security.rst @@ -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; diff --git a/bundles/configuration.rst b/bundles/configuration.rst index b7535d55c96..9d4db53ec08 100644 --- a/bundles/configuration.rst +++ b/bundles/configuration.rst @@ -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) { diff --git a/components/property_access.rst b/components/property_access.rst index 1181f8ff3a7..2e23043e562 100644 --- a/components/property_access.rst +++ b/components/property_access.rst @@ -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 @@ -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 diff --git a/components/property_info.rst b/components/property_info.rst index b75033d06c1..5bd198a0bbc 100644 --- a/components/property_info.rst +++ b/components/property_info.rst @@ -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; @@ -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); /* @@ -168,9 +164,7 @@ Type Information Extractors that implement :class:`Symfony\\Component\\PropertyInfo\\PropertyTypeExtractorInterface` provide :ref:`extensive data type information ` -for a property. - -.. code-block:: php +for a property:: $types = $propertyInfo->getTypes($class, $property); @@ -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); /* @@ -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) @@ -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; @@ -447,9 +435,7 @@ Using :ref:`groups metadata ` from the :doc:`Serializer component `, 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; @@ -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; diff --git a/components/serializer.rst b/components/serializer.rst index 1c26ec80819..ee7175dfd40 100644 --- a/components/serializer.rst +++ b/components/serializer.rst @@ -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; diff --git a/components/var_dumper/advanced.rst b/components/var_dumper/advanced.rst index 3846845abbf..3f2d7aeafe7 100644 --- a/components/var_dumper/advanced.rst +++ b/components/var_dumper/advanced.rst @@ -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; @@ -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; @@ -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; diff --git a/contributing/code/standards.rst b/contributing/code/standards.rst index 50e194ba725..36278555c5d 100644 --- a/contributing/code/standards.rst +++ b/contributing/code/standards.rst @@ -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. diff --git a/deployment/proxies.rst b/deployment/proxies.rst index 9c4f7c4c9de..76a7debbf2b 100644 --- a/deployment/proxies.rst +++ b/deployment/proxies.rst @@ -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 diff --git a/form/data_mappers.rst b/form/data_mappers.rst index 23bb8939fa8..d851bad2364 100644 --- a/form/data_mappers.rst +++ b/form/data_mappers.rst @@ -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; diff --git a/form/without_class.rst b/form/without_class.rst index 5934d12ac58..48fcb86e157 100644 --- a/form/without_class.rst +++ b/form/without_class.rst @@ -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']]); diff --git a/security/user_checkers.rst b/security/user_checkers.rst index 8bdca4a144e..2cfb017e620 100644 --- a/security/user_checkers.rst +++ b/security/user_checkers.rst @@ -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; diff --git a/service_container/tags.rst b/service_container/tags.rst index ca1e0abc503..c5209f45ef1 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -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;