From baf915466a2eea9fa855df0bf342b2373c1badf4 Mon Sep 17 00:00:00 2001 From: Nyholm Date: Fri, 16 Apr 2021 20:00:07 +0200 Subject: [PATCH] Fixing syntax error in PHP, XML and Yaml examples --- cache.rst | 2 +- components/console/helpers/table.rst | 2 +- configuration/using_parameters_in_dic.rst | 4 +-- form/inherit_data_option.rst | 30 +++++++++++++-------- http_client.rst | 2 +- messenger.rst | 2 +- messenger/multiple_buses.rst | 6 ++--- reference/configuration/doctrine.rst | 4 +-- reference/configuration/framework.rst | 2 +- reference/configuration/security.rst | 4 +-- reference/constraints/IsFalse.rst | 8 +++--- security/custom_authentication_provider.rst | 4 +-- security/form_login_setup.rst | 4 +-- security/ldap.rst | 6 ++--- security/named_encoders.rst | 2 +- security/remember_me.rst | 2 +- security/user_provider.rst | 5 ++-- service_container.rst | 1 - service_container/alias_private.rst | 4 +-- service_container/autowiring.rst | 1 + service_container/tags.rst | 2 +- templates.rst | 7 +++-- workflow/dumping-workflows.rst | 3 +-- 23 files changed, 59 insertions(+), 48 deletions(-) diff --git a/cache.rst b/cache.rst index 42a22ca55e3..12125402e0d 100644 --- a/cache.rst +++ b/cache.rst @@ -373,7 +373,7 @@ with either :class:`Symfony\\Contracts\\Cache\\CacheInterface` or $services->set('app.cace.adapter.redis') ->parent('cache.adapter.redis') - ->tag('cache.pool', ['namespace' => 'my_custom_namespace']) + ->tag('cache.pool', ['namespace' => 'my_custom_namespace']); }; Custom Provider Options diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index 0e8df0d1031..45336c1175e 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -305,7 +305,7 @@ This results in: $table->setHeaders([ [new TableCell('Main table title', ['colspan' => 3])], ['ISBN', 'Title', 'Author'], - ]) + ]); // ... This generates: diff --git a/configuration/using_parameters_in_dic.rst b/configuration/using_parameters_in_dic.rst index c81fcf7fa14..329061a137f 100644 --- a/configuration/using_parameters_in_dic.rst +++ b/configuration/using_parameters_in_dic.rst @@ -77,8 +77,8 @@ Now, examine the results to see this closely: $container->loadFromExtension('my_bundle', [ 'logging' => true, // true, as expected - ) - ]; + ] + ); $container->loadFromExtension('my_bundle', [ 'logging' => "%kernel.debug%", diff --git a/form/inherit_data_option.rst b/form/inherit_data_option.rst index f4161a21111..083e415aac4 100644 --- a/form/inherit_data_option.rst +++ b/form/inherit_data_option.rst @@ -129,15 +129,20 @@ Finally, make this work by adding the location form to your two original forms:: namespace App\Form\Type; use App\Entity\Company; + use Symfony\Component\Form\AbstractType; + // ... - public function buildForm(FormBuilderInterface $builder, array $options): void + class CompanyType extends AbstractType { - // ... + public function buildForm(FormBuilderInterface $builder, array $options): void + { + // ... - $builder->add('foo', LocationType::class, [ - 'data_class' => Company::class, - ]); + $builder->add('foo', LocationType::class, [ + 'data_class' => Company::class, + ]); + } } .. code-block:: php @@ -146,15 +151,18 @@ Finally, make this work by adding the location form to your two original forms:: namespace App\Form\Type; use App\Entity\Customer; - // ... + use Symfony\Component\Form\AbstractType; - public function buildForm(FormBuilderInterface $builder, array $options): void + class CustomerType extends AbstractType { - // ... + public function buildForm(FormBuilderInterface $builder, array $options): void + { + // ... - $builder->add('bar', LocationType::class, [ - 'data_class' => Customer::class, - ]); + $builder->add('bar', LocationType::class, [ + 'data_class' => Customer::class, + ]); + } } That's it! You have extracted duplicated field definitions to a separate diff --git a/http_client.rst b/http_client.rst index a71d4ab604b..da1595dbac7 100644 --- a/http_client.rst +++ b/http_client.rst @@ -428,7 +428,7 @@ each request (which overrides any global authentication): auth-bearer="the-bearer-token" auth-ntlm="the-username:the-password" /> - + diff --git a/messenger.rst b/messenger.rst index 70944b9a2d0..526017c0093 100644 --- a/messenger.rst +++ b/messenger.rst @@ -1219,7 +1219,7 @@ this globally (or for each transport) to a service that implements ], 'transports' => [ 'async_priority_normal' => [ - 'dsn' => // ... + 'dsn' => ..., 'serializer' => 'messenger.transport.symfony_serializer', ], ], diff --git a/messenger/multiple_buses.rst b/messenger/multiple_buses.rst index c79aeb7b2b7..240e9cdc6cc 100644 --- a/messenger/multiple_buses.rst +++ b/messenger/multiple_buses.rst @@ -56,13 +56,13 @@ an **event bus**. The event bus could have zero or more subscribers. - + - + - + diff --git a/reference/configuration/doctrine.rst b/reference/configuration/doctrine.rst index cf49aaaa2b9..3d2435e73a0 100644 --- a/reference/configuration/doctrine.rst +++ b/reference/configuration/doctrine.rst @@ -327,7 +327,7 @@ directory instead: .. code-block:: xml - + + diff --git a/reference/configuration/security.rst b/reference/configuration/security.rst index 399794e2402..34416786207 100644 --- a/reference/configuration/security.rst +++ b/reference/configuration/security.rst @@ -167,7 +167,7 @@ encoding algorithm. Also, each algorithm defines different config options: .. code-block:: xml - + - + "You've entered an invalid state.", ])); } - } - public function isStateInvalid() - { - // ... + public function isStateInvalid() + { + // ... + } } .. include:: /reference/constraints/_null-values-are-valid.rst.inc diff --git a/security/custom_authentication_provider.rst b/security/custom_authentication_provider.rst index 920c8315f05..f7f377af617 100644 --- a/security/custom_authentication_provider.rst +++ b/security/custom_authentication_provider.rst @@ -422,7 +422,7 @@ to service ids that may not exist yet: ``App\Security\Authentication\Provider\Ws .. code-block:: php - // config/services.php + // config/services.php namespace Symfony\Component\DependencyInjection\Loader\Configurator; use App\Security\Authentication\Provider\WsseProvider; @@ -563,7 +563,7 @@ in order to put it to use:: // src/DependencyInjection/Security/Factory/WsseFactory.php namespace App\DependencyInjection\Security\Factory; - + use App\Security\Authentication\Provider\WsseProvider; class WsseFactory implements SecurityFactoryInterface diff --git a/security/form_login_setup.rst b/security/form_login_setup.rst index d78a415ff34..3e6a20d8140 100644 --- a/security/form_login_setup.rst +++ b/security/form_login_setup.rst @@ -107,7 +107,7 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path: .. code-block:: xml - + - + true, ], ], - ]; + ]); Configuration example for form login and query_string ..................................................... diff --git a/security/named_encoders.rst b/security/named_encoders.rst index 22bc333dec4..a5a82bc7021 100644 --- a/security/named_encoders.rst +++ b/security/named_encoders.rst @@ -33,7 +33,7 @@ to apply to all instances of a specific class: diff --git a/security/remember_me.rst b/security/remember_me.rst index a2fa1bcda96..631a6528e43 100644 --- a/security/remember_me.rst +++ b/security/remember_me.rst @@ -263,7 +263,7 @@ so ``DoctrineTokenProvider`` can store the tokens: .. code-block:: xml - # config/packages/doctrine.xml + .. code-block:: php diff --git a/security/user_provider.rst b/security/user_provider.rst index 07227868afe..bd5b9fb27b0 100644 --- a/security/user_provider.rst +++ b/security/user_provider.rst @@ -44,6 +44,7 @@ to retrieve them: .. code-block:: yaml # config/packages/security.yaml + security: # ... providers: @@ -138,7 +139,7 @@ interface only requires one method: ``loadUserByUsername($username)``:: public function loadUserByUsername($usernameOrEmail) { $entityManager = $this->getEntityManager(); - + return $entityManager->createQuery( 'SELECT u FROM App\Entity\User u @@ -413,7 +414,7 @@ command will generate a nice skeleton to get you started:: { return User::class === $class || is_subclass_of($class, User::class); } - + /** * Upgrades the encoded password of a user, typically for using a better hash algorithm. */ diff --git a/service_container.rst b/service_container.rst index fec082a377c..21aa508b897 100644 --- a/service_container.rst +++ b/service_container.rst @@ -1033,7 +1033,6 @@ for classes under the same namespace: - diff --git a/service_container/alias_private.rst b/service_container/alias_private.rst index f202ce8d277..9dd7ac41c4e 100644 --- a/service_container/alias_private.rst +++ b/service_container/alias_private.rst @@ -269,7 +269,7 @@ The following example shows how to inject an anonymous service into another serv $services = $configurator->services(); $services->set(Foo::class) - ->args([inline(AnonymousBar::class)]) + ->args([inline(AnonymousBar::class)]); }; .. note:: @@ -320,7 +320,7 @@ Using an anonymous service as a factory looks like this: $services = $configurator->services(); $services->set(Foo::class) - ->factory([inline(AnonymousBar::class), 'constructFoo']) + ->factory([inline(AnonymousBar::class), 'constructFoo']); }; Deprecating Services diff --git a/service_container/autowiring.rst b/service_container/autowiring.rst index 04058c6b9ac..bb08f8b6516 100644 --- a/service_container/autowiring.rst +++ b/service_container/autowiring.rst @@ -526,6 +526,7 @@ the injection:: // want to use a named autowiring alias, wire it manually: // ->arg('$transformer', ref(UppercaseTransformer::class)) // ... + ; }; Thanks to the ``App\Util\TransformerInterface`` alias, any argument type-hinted diff --git a/service_container/tags.rst b/service_container/tags.rst index 76d4cb9792e..20a58e379e4 100644 --- a/service_container/tags.rst +++ b/service_container/tags.rst @@ -847,7 +847,7 @@ array element. For example, to retrieve the ``handler_two`` handler:: https://symfony.com/schema/dic/services/services-1.0.xsd"> - + diff --git a/templates.rst b/templates.rst index 09314868c2d..5a72407d582 100644 --- a/templates.rst +++ b/templates.rst @@ -553,9 +553,12 @@ also provides a method to check for template existence. First, get the loader:: // in a service using autowiring use Twig\Environment; - public function __construct(Environment $twig) + class YourService { - $loader = $twig->getLoader(); + public function __construct(Environment $twig) + { + $loader = $twig->getLoader(); + } } Then, pass the path of the Twig template to the ``exists()`` method of the loader:: diff --git a/workflow/dumping-workflows.rst b/workflow/dumping-workflows.rst index 1611082c6f4..8a537e71415 100644 --- a/workflow/dumping-workflows.rst +++ b/workflow/dumping-workflows.rst @@ -63,7 +63,7 @@ You can use ``metadata`` with the following keys to style the workflow: * ``bg_color``: a color; * ``description``: a string that describes the state. - + * for transitions: * ``label``: a string that replaces the name of the transition; @@ -169,7 +169,6 @@ Below is the configuration for the pull request state machine with styling added DeepSkyBlue - start