Skip to content

Commit 99d4670

Browse files
committed
ordered use statements for php code examples
1 parent 8b0cc9f commit 99d4670

18 files changed

+30
-32
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
@@ -731,9 +731,9 @@ for encoding (array to format) and
731731

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

734-
use Symfony\Component\Serializer\Serializer;
735-
use Symfony\Component\Serializer\Encoder\XmlEncoder;
736734
use Symfony\Component\Serializer\Encoder\JsonEncoder;
735+
use Symfony\Component\Serializer\Encoder\XmlEncoder;
736+
use Symfony\Component\Serializer\Serializer;
737737

738738
$encoders = [new XmlEncoder(), new JsonEncoder()];
739739
$serializer = new Serializer([], $encoders);
@@ -1045,11 +1045,11 @@ maximum depth is reached. This is especially useful when serializing entities
10451045
having unique identifiers::
10461046

10471047
use Doctrine\Common\Annotations\AnnotationReader;
1048-
use Symfony\Component\Serializer\Serializer;
10491048
use Symfony\Component\Serializer\Annotation\MaxDepth;
10501049
use Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory;
10511050
use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
10521051
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
1052+
use Symfony\Component\Serializer\Serializer;
10531053

10541054
class Foo
10551055
{
@@ -1211,8 +1211,8 @@ If the class constructor defines arguments, as usually happens with
12111211
arguments are missing. In those cases, use the ``default_constructor_arguments``
12121212
context option::
12131213

1214-
use Symfony\Component\Serializer\Serializer;
12151214
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
1215+
use Symfony\Component\Serializer\Serializer;
12161216

12171217
class MyObj
12181218
{
@@ -1331,8 +1331,8 @@ this is already set up and you only need to provide the configuration. Otherwise
13311331

13321332
// ...
13331333
use Symfony\Component\Serializer\Encoder\JsonEncoder;
1334-
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
13351334
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata;
1335+
use Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping;
13361336
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
13371337
use Symfony\Component\Serializer\Serializer;
13381338

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();

doctrine/event_listeners_subscribers.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ interface and have an event method for each event it subscribes to::
140140
// src/EventListener/SearchIndexerSubscriber.php
141141
namespace App\EventListener;
142142

143-
use AppBundle\Entity\Product;
143+
use App\Entity\Product;
144144
use Doctrine\Common\EventSubscriber;
145145
// for Doctrine < 2.4: use Doctrine\ORM\Event\LifecycleEventArgs;
146146
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
147-
use App\Entity\Product;
148147
use Doctrine\ORM\Events;
149148

150149
class SearchIndexerSubscriber implements EventSubscriber

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
@@ -694,10 +694,10 @@ Create your Transport Factory
694694
You need to give FrameworkBundle the opportunity to create your transport from a
695695
DSN. You will need a transport factory::
696696

697-
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
698-
use Symfony\Component\Messenger\Transport\TransportInterface;
699697
use Symfony\Component\Messenger\Transport\Receiver\ReceiverInterface;
700698
use Symfony\Component\Messenger\Transport\Sender\SenderInterface;
699+
use Symfony\Component\Messenger\Transport\TransportFactoryInterface;
700+
use Symfony\Component\Messenger\Transport\TransportInterface;
701701

702702
class YourTransportFactory implements TransportFactoryInterface
703703
{

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
{

0 commit comments

Comments
 (0)