Skip to content

Commit 165e573

Browse files
committed
Merge branch '4.2'
* 4.2: ordered use statements for php code examples
2 parents 8567d82 + 71cb687 commit 165e573

File tree

17 files changed

+29
-30
lines changed

17 files changed

+29
-30
lines changed

components/ldap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ ______________
152152
Use the entry manager's :method:`Symfony\\Component\\Ldap\\Adapter\\ExtLdap\\EntryManager::applyOperations`
153153
method to update multiple attributes at once::
154154

155-
use Symfony\Component\Ldap\Ldap;
156155
use Symfony\Component\Ldap\Entry;
156+
use Symfony\Component\Ldap\Ldap;
157157
// ...
158158

159159
$entry = new Entry('cn=Fabien Potencier,dc=symfony,dc=com', [

components/mercure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ The following example shows the component in action::
3131
define('HUB_URL', 'https://demo.mercure.rocks/hub');
3232
define('JWT', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJtZXJjdXJlIjp7InN1YnNjcmliZSI6WyJmb28iLCJiYXIiXSwicHVibGlzaCI6WyJmb28iXX19.LRLvirgONK13JgacQ_VbcjySbVhkSmHy3IznH3tA9PM');
3333

34+
use Symfony\Component\Mercure\Jwt\StaticJwtProvide;
3435
use Symfony\Component\Mercure\Publisher;
3536
use Symfony\Component\Mercure\Update;
36-
use Symfony\Component\Mercure\Jwt\StaticJwtProvide;
3737

3838
$publisher = new Publisher(HUB_URL, new StaticJwtProvide(JWT));
3939
// Serialize the update, and dispatch it to the hub, that will broadcast it to the clients

components/messenger.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ are configured for you:
8282
Example::
8383

8484
use App\Message\MyMessage;
85-
use Symfony\Component\Messenger\MessageBus;
8685
use Symfony\Component\Messenger\Handler\HandlersLocator;
86+
use Symfony\Component\Messenger\MessageBus;
8787
use Symfony\Component\Messenger\Middleware\HandleMessageMiddleware;
8888

8989
$bus = new MessageBus([
@@ -155,9 +155,9 @@ Instead of dealing directly with the messages in the middleware you receive the
155155
Hence you can inspect the envelope content and its stamps, or add any::
156156

157157
use App\Message\Stamp\AnotherStamp;
158-
use Symfony\Component\Messenger\Stamp\ReceivedStamp;
159158
use Symfony\Component\Messenger\Middleware\MiddlewareInterface;
160159
use Symfony\Component\Messenger\Middleware\StackInterface;
160+
use Symfony\Component\Messenger\Stamp\ReceivedStamp;
161161

162162
class MyOwnMiddleware implements MiddlewareInterface
163163
{
@@ -210,8 +210,8 @@ First, create your sender::
210210
namespace App\MessageSender;
211211

212212
use App\Message\ImportantAction;
213-
use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
214213
use Symfony\Component\Messenger\Envelope;
214+
use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
215215

216216
class ImportantActionToEmailSender implements SenderInterface
217217
{
@@ -264,9 +264,9 @@ First, create your receiver::
264264
namespace App\MessageReceiver;
265265

266266
use App\Message\NewOrder;
267+
use Symfony\Component\Messenger\Envelope;
267268
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
268269
use Symfony\Component\Serializer\SerializerInterface;
269-
use Symfony\Component\Messenger\Envelope;
270270

271271
class NewOrdersFromCsvFileReceiver implements ReceiverInterface
272272
{

components/serializer.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,9 @@ for encoding (array to format) and
747747

748748
You can add new encoders to a Serializer instance by using its second constructor argument::
749749

750-
use Symfony\Component\Serializer\Serializer;
751-
use Symfony\Component\Serializer\Encoder\XmlEncoder;
752750
use Symfony\Component\Serializer\Encoder\JsonEncoder;
751+
use Symfony\Component\Serializer\Encoder\XmlEncoder;
752+
use Symfony\Component\Serializer\Serializer;
753753

754754
$encoders = [new XmlEncoder(), new JsonEncoder()];
755755
$serializer = new Serializer([], $encoders);
@@ -1061,11 +1061,11 @@ maximum depth is reached. This is especially useful when serializing entities
10611061
having unique identifiers::
10621062

10631063
use Doctrine\Common\Annotations\AnnotationReader;
1064-
use Symfony\Component\Serializer\Serializer;
10651064
use Symfony\Component\Serializer\Annotation\MaxDepth;
10661065
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
10671066
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
10681067
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
1068+
use Symfony\Component\Serializer\Serializer;
10691069

10701070
class Foo
10711071
{
@@ -1227,8 +1227,8 @@ If the class constructor defines arguments, as usually happens with
12271227
arguments are missing. In those cases, use the ``default_constructor_arguments``
12281228
context option::
12291229

1230-
use Symfony\Component\Serializer\Serializer;
12311230
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
1231+
use Symfony\Component\Serializer\Serializer;
12321232

12331233
class MyObj
12341234
{
@@ -1347,8 +1347,8 @@ this is already set up and you only need to provide the configuration. Otherwise
13471347

13481348
// ...
13491349
use Symfony\Component\Serializer\Encoder\JsonEncoder;
1350-
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
13511350
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata;
1351+
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
13521352
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
13531353
use Symfony\Component\Serializer\Serializer;
13541354

components/var_dumper.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ Outside a Symfony application, use the :class:`Symfony\\Component\\VarDumper\\Du
152152

153153
require __DIR__.'/vendor/autoload.php';
154154

155-
use Symfony\Component\VarDumper\VarDumper;
156155
use Symfony\Component\VarDumper\Cloner\VarCloner;
157156
use Symfony\Component\VarDumper\Dumper\CliDumper;
158157
use Symfony\Component\VarDumper\Dumper\ContextProvider\CliContextProvider;
159158
use Symfony\Component\VarDumper\Dumper\ContextProvider\SourceContextProvider;
160159
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
161160
use Symfony\Component\VarDumper\Dumper\ServerDumper;
161+
use Symfony\Component\VarDumper\VarDumper;
162162

163163
$cloner = new VarCloner();
164164
$fallbackDumper = \in_array(\PHP_SAPI, ['cli', 'phpdbg']) ? new CliDumper() : new HtmlDumper();

form/form_themes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ based on your form type name (e.g. ``ProductType`` equates to ``product``). If
260260
you're not sure what your form name is, look at the HTML code rendered for your
261261
form. You can also define this value explicitly with the ``block_name`` option::
262262

263-
use Symfony\Component\Form\FormBuilderInterface;
264263
use Symfony\Component\Form\Extension\Core\Type\TextType;
264+
use Symfony\Component\Form\FormBuilderInterface;
265265

266266
public function buildForm(FormBuilderInterface $builder, array $options)
267267
{

mercure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ it will be handled automatically::
249249
namespace App\Controller;
250250

251251
use Symfony\Component\HttpFoundation\Response;
252-
use Symfony\Component\Messenger\MessageBusInterface;
253252
use Symfony\Component\Mercure\Update;
253+
use Symfony\Component\Messenger\MessageBusInterface;
254254

255255
class PublishController
256256
{

messenger.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -698,10 +698,10 @@ Create your Transport Factory
698698
You need to give FrameworkBundle the opportunity to create your transport from a
699699
DSN. You will need a transport factory::
700700

701-
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
702-
use Symfony\Component\Messenger\Transport\TransportInterface;
703701
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
704702
use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
703+
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
704+
use Symfony\Component\Messenger\Transport\TransportInterface;
705705

706706
class YourTransportFactory implements TransportFactoryInterface
707707
{

quick_tour/flex_recipes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ Are you building an API? You can already return JSON easily from any controller:
156156
// src/Controller/DefaultController.php
157157
namespace App\Controller;
158158

159-
use Symfony\Component\Routing\Annotation\Route;
160159
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
160+
use Symfony\Component\Routing\Annotation\Route;
161161

162162
class DefaultController extends AbstractController
163163
{

quick_tour/the_architecture.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ use the logger in a controller, add a new argument type-hinted with ``LoggerInte
2525
namespace App\Controller;
2626

2727
use Psr\Log\LoggerInterface;
28-
use Symfony\Component\Routing\Annotation\Route;
2928
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
29+
use Symfony\Component\Routing\Annotation\Route;
3030

3131
class DefaultController extends AbstractController
3232
{
@@ -110,8 +110,8 @@ Great! You can use this immediately in your controller::
110110

111111
use App\GreetingGenerator;
112112
use Psr\Log\LoggerInterface;
113-
use Symfony\Component\Routing\Annotation\Route;
114113
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
114+
use Symfony\Component\Routing\Annotation\Route;
115115

116116
class DefaultController extends AbstractController
117117
{

reference/configuration/swiftmailer.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,9 @@ alternatives based on the :ref:`service binding <services-binding>` feature:
380380
381381
// config/services.php
382382
use App\Some\Service;
383-
use Symfony\Component\DependencyInjection\Reference;
384383
use Psr\Log\LoggerInterface;
384+
use Symfony\Component\DependencyInjection\Reference;
385+
385386
386387
$container->register(Service::class)
387388
->setPublic(true)

reference/constraints/Choice.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,13 +259,11 @@ you can pass the class name and the method as an array.
259259
namespace App\Entity;
260260
261261
use App\Entity\Genre;
262-
use Symfony\Component\Validator\Mapping\ClassMetadata;
263262
use Symfony\Component\Validator\Constraints as Assert;
263+
use Symfony\Component\Validator\Mapping\ClassMetadata;
264264
265265
class Author
266266
{
267-
protected $genre;
268-
269267
public static function loadValidatorMetadata(ClassMetadata $metadata)
270268
{
271269
$metadata->addPropertyConstraint('genre', new Assert\Choice([

reference/constraints/DivisibleBy.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ The following constraints ensure that:
8585
// src/Entity/Item.php
8686
namespace App\Entity;
8787
88-
use Symfony\Component\Validator\Mapping\ClassMetadata;
8988
use Symfony\Component\Validator\Constraints as Assert;
89+
use Symfony\Component\Validator\Mapping\ClassMetadata;
9090
9191
class Item
9292
{

reference/constraints/Url.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ option to the value of any of the ``CHECK_DNS_TYPE_*`` constants in the
146146
// src/Entity/Author.php
147147
namespace App\Entity;
148148
149-
use Symfony\Component\Validator\Mapping\ClassMetadata;
150149
use Symfony\Component\Validator\Constraints as Assert;
150+
use Symfony\Component\Validator\Mapping\ClassMetadata;
151151
152152
class Author
153153
{

reference/dic_tags.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,8 +1087,8 @@ the service is auto-registered and auto-tagged. But, you can also register it ma
10871087
10881088
.. code-block:: php
10891089
1090-
use App\Twig\AppExtension;
10911090
use App\Twig\AnotherExtension;
1091+
use App\Twig\AppExtension;
10921092
10931093
$container
10941094
->register(AppExtension::class)
@@ -1229,7 +1229,6 @@ the service is auto-registered and auto-tagged. But, you can also register it ma
12291229
.. code-block:: php
12301230
12311231
use App\Twig\AppExtension;
1232-
use App\Twig\AnotherExtension;
12331232
12341233
$container
12351234
->register(AppExtension::class)

security/form_login_setup.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,13 @@ a traditional HTML form that submits to ``/login``:
168168

169169
use App\Entity\User;
170170
use Doctrine\ORM\EntityManagerInterface;
171-
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
171+
172172
use Symfony\Component\HttpFoundation\RedirectResponse;
173173
use Symfony\Component\HttpFoundation\Request;
174174
use Symfony\Component\Routing\RouterInterface;
175175
use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
176176
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
177+
use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException;
177178
use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException;
178179
use Symfony\Component\Security\Core\Security;
179180
use Symfony\Component\Security\Core\User\UserInterface;

security/user_provider.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ interface only requires one method: ``loadUserByUsername($username)``::
128128
// src/Repository/UserRepository.php
129129
namespace App\Repository;
130130

131-
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
132131
use Doctrine\ORM\EntityRepository;
132+
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
133133

134134
class UserRepository extends EntityRepository implements UserLoaderInterface
135135
{
@@ -480,8 +480,8 @@ and want to inject in your ``LoginFormAuthenticator`` a user provider of type
480480
// src/Security/LoginFormAuthenticator.php
481481
namespace App\Security;
482482

483-
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
484483
use Symfony\Component\Security\Core\User\InMemoryUserProvider;
484+
use Symfony\Component\Security\Guard\Authenticator\AbstractFormLoginAuthenticator;
485485

486486
class LoginFormAuthenticator extends AbstractFormLoginAuthenticator
487487
{

0 commit comments

Comments
 (0)