Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Fixing syntax error in PHP, XML and Yaml examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyholm authored and javiereguiluz committed Apr 20, 2021
1 parent cb3489a commit baf9154
Show file tree
Hide file tree
Showing 23 changed files with 59 additions and 48 deletions.
2 changes: 1 addition & 1 deletion cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/console/helpers/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ This results in:
$table->setHeaders([
[new TableCell('Main table title', ['colspan' => 3])],
['ISBN', 'Title', 'Author'],
])
]);
// ...

This generates:
Expand Down
4 changes: 2 additions & 2 deletions configuration/using_parameters_in_dic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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%",
Expand Down
30 changes: 19 additions & 11 deletions form/inherit_data_option.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion http_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ each request (which overrides any global authentication):
auth-bearer="the-bearer-token"
auth-ntlm="the-username:the-password"
/>
</framework-http-client>
</framework:http-client>
</framework:config>
</container>
Expand Down
2 changes: 1 addition & 1 deletion messenger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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',
],
],
Expand Down
6 changes: 3 additions & 3 deletions messenger/multiple_buses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ an **event bus**. The event bus could have zero or more subscribers.
<framework:bus name="command.bus">
<framework:middleware id="validation"/>
<framework:middleware id="doctrine_transaction"/>
<framework:bus>
</framework:bus>
<framework:bus name="query.bus">
<framework:middleware id="validation"/>
<framework:bus>
</framework:bus>
<framework:bus name="event.bus" default-middleware="allow_no_handlers">
<framework:middleware id="validation"/>
<framework:bus>
</framework:bus>
</framework:messenger>
</framework:config>
</container>
Expand Down
4 changes: 2 additions & 2 deletions reference/configuration/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ directory instead:
.. code-block:: xml
<?xml version="1.0" charset="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
Expand Down Expand Up @@ -378,7 +378,7 @@ namespace in the ``src/Entity`` directory and gives them an ``App`` alias
.. code-block:: xml
<?xml version="1.0" charset="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:doctrine="http://symfony.com/schema/dic/doctrine"
Expand Down
2 changes: 1 addition & 1 deletion reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ To configure a Redis cache pool with a default lifetime of 1 hour, do the follow
<framework:pool
name="cache.mycache"
adapter="cache.adapter.redis"
default-lifetime=3600
default-lifetime="3600"
/>
</framework:cache>
<!-- ... -->
Expand Down
4 changes: 2 additions & 2 deletions reference/configuration/security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ encoding algorithm. Also, each algorithm defines different config options:
.. code-block:: xml
<!-- config/packages/security.xml -->
<?xml version="1.0" charset="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
Expand Down Expand Up @@ -716,7 +716,7 @@ multiple firewalls, the "context" could actually be shared:
.. code-block:: xml
<!-- config/packages/security.xml -->
<?xml version="1.0" charset="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
Expand Down
8 changes: 4 additions & 4 deletions reference/constraints/IsFalse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ method returns **false**:
'message' => "You've entered an invalid state.",
]));
}
}
public function isStateInvalid()
{
// ...
public function isStateInvalid()
{
// ...
}
}
.. include:: /reference/constraints/_null-values-are-valid.rst.inc
Expand Down
4 changes: 2 additions & 2 deletions security/custom_authentication_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions security/form_login_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Edit the ``security.yaml`` file in order to declare the ``/logout`` path:
.. code-block:: xml
<!-- config/packages/security.xml -->
<?xml version="1.0" charset="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
Expand Down Expand Up @@ -319,7 +319,7 @@ a traditional HTML form that submits to ``/login``:
.. code-block:: xml
<!-- config/packages/security.xml -->
<?xml version="1.0" charset="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<srv:container xmlns="http://symfony.com/schema/dic/security"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:srv="http://symfony.com/schema/dic/services"
Expand Down
6 changes: 3 additions & 3 deletions security/ldap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ use the ``ldap`` user provider.
],
],
],
];
]);
.. caution::

Expand Down Expand Up @@ -414,7 +414,7 @@ Configuration example for form login
],
],
]
];
]);
Configuration example for HTTP Basic
....................................
Expand Down Expand Up @@ -471,7 +471,7 @@ Configuration example for HTTP Basic
'stateless' => true,
],
],
];
]);
Configuration example for form login and query_string
.....................................................
Expand Down
2 changes: 1 addition & 1 deletion security/named_encoders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ to apply to all instances of a specific class:
<!-- ... -->
<encoder class="App\Entity\User"
algorithm="auto"
cost=12
cost="12"
/>
</config>
</srv:container>
Expand Down
2 changes: 1 addition & 1 deletion security/remember_me.rst
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ so ``DoctrineTokenProvider`` can store the tokens:
.. code-block:: xml
# config/packages/doctrine.xml
<!-- config/packages/doctrine.xml -->
<doctrine:dbal schema-filter="~^(?!rememberme_token)~"/>
.. code-block:: php
Expand Down
5 changes: 3 additions & 2 deletions security/user_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ to retrieve them:
.. code-block:: yaml
# config/packages/security.yaml
security:
# ...
providers:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
*/
Expand Down
1 change: 0 additions & 1 deletion service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,6 @@ for classes under the same namespace:
<services>
<prototype namespace="App\Domain"
resource="../src/App/Domain/*"/>
</prototype>
<!-- ... -->
</services>
Expand Down
4 changes: 2 additions & 2 deletions service_container/alias_private.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions service_container/autowiring.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion service_container/tags.rst
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ array element. For example, to retrieve the ``handler_two`` handler::
https://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<!-- ... --!>
<!-- ... -->
<service id="App\HandlerCollection">
<!-- use getIndex() instead of getDefaultIndexName() -->
Expand Down
7 changes: 5 additions & 2 deletions templates.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::
Expand Down
3 changes: 1 addition & 2 deletions workflow/dumping-workflows.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -169,7 +169,6 @@ Below is the configuration for the pull request state machine with styling added
<framework:bg_color>DeepSkyBlue</framework:bg_color>
</framework:metadata>
</framework:place>
</framework:place>
<framework:transition name="submit">
<framework:from>start</framework:from>
Expand Down

0 comments on commit baf9154

Please sign in to comment.