diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 8c6456216d4..6ad8048aa49 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -25,6 +25,7 @@ Suppose you want to confirm an action before actually executing it. Add the following to your command:: // ... + use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ConfirmationQuestion; diff --git a/components/console/helpers/table.rst b/components/console/helpers/table.rst index c8dc72e863a..ec532ab4560 100644 --- a/components/console/helpers/table.rst +++ b/components/console/helpers/table.rst @@ -20,7 +20,10 @@ When building a console application it may be useful to display tabular data: To display a table, use :class:`Symfony\\Component\\Console\\Helper\\Table`, set the headers, set the rows and then render the table:: + use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\Table; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; // ... class SomeCommand extends Command diff --git a/console.rst b/console.rst index e809b09f980..477d301593b 100644 --- a/console.rst +++ b/console.rst @@ -66,6 +66,10 @@ constructor. If your command defines its own constructor, set the properties first and then call to the parent constructor, to make those properties available in the ``configure()`` method:: + // ... + use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputArgument; + class CreateUserCommand extends Command { // ... diff --git a/console/calling_commands.rst b/console/calling_commands.rst index 78759b70947..e8add467783 100644 --- a/console/calling_commands.rst +++ b/console/calling_commands.rst @@ -11,6 +11,8 @@ generating Doctrine2 proxies, dumping Assetic assets, ...). Calling a command from another one is straightforward:: use Symfony\Component\Console\Input\ArrayInput; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; // ... protected function execute(InputInterface $input, OutputInterface $output) diff --git a/console/input.rst b/console/input.rst index 39ec37b3ad7..fdc9e4e9239 100644 --- a/console/input.rst +++ b/console/input.rst @@ -14,6 +14,7 @@ or required. For example, to add an optional ``last_name`` argument to the comma and make the ``name`` argument required:: // ... + use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; class GreetCommand extends Command @@ -33,6 +34,10 @@ and make the ``name`` argument required:: You now have access to a ``last_name`` argument in your command:: // ... + use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; + class GreetCommand extends Command { // ... diff --git a/console/lockable_trait.rst b/console/lockable_trait.rst index ba3bea637cf..9e5255afb9c 100644 --- a/console/lockable_trait.rst +++ b/console/lockable_trait.rst @@ -14,7 +14,10 @@ In addition, the Console component provides a PHP trait called ``LockableTrait`` that adds two convenient methods to lock and release commands:: // ... + use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Command\LockableTrait; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; class UpdateContentsCommand extends Command { diff --git a/console/verbosity.rst b/console/verbosity.rst index 2a23e659f0a..be42fac5e81 100644 --- a/console/verbosity.rst +++ b/console/verbosity.rst @@ -41,6 +41,10 @@ It is possible to print a message in a command for only a specific verbosity level. For example:: // ... + use Symfony\Component\Console\Command\Command; + use Symfony\Component\Console\Input\InputInterface; + use Symfony\Component\Console\Output\OutputInterface; + class CreateUserCommand extends Command { // ... diff --git a/event_dispatcher.rst b/event_dispatcher.rst index 38fb2e6626b..af7a8f8c26f 100644 --- a/event_dispatcher.rst +++ b/event_dispatcher.rst @@ -200,8 +200,6 @@ or a "sub request":: namespace AppBundle\EventListener; use Symfony\Component\HttpKernel\Event\GetResponseEvent; - use Symfony\Component\HttpKernel\HttpKernel; - use Symfony\Component\HttpKernel\HttpKernelInterface; class RequestListener { diff --git a/http_cache/validation.rst b/http_cache/validation.rst index 7bd35877356..15e76ec4212 100644 --- a/http_cache/validation.rst +++ b/http_cache/validation.rst @@ -62,6 +62,7 @@ To see a simple implementation, generate the ETag as the md5 of the content:: // src/AppBundle/Controller/DefaultController.php namespace AppBundle\Controller; + use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Request; class DefaultController extends Controller diff --git a/security/ldap.rst b/security/ldap.rst index 1a15a8d011b..b22645914fc 100644 --- a/security/ldap.rst +++ b/security/ldap.rst @@ -100,7 +100,6 @@ An LDAP client can be simply configured using the built-in // app/config/services.php use Symfony\Component\Ldap\Ldap; use Symfony\Component\Ldap\Adapter\ExtLdap\Adapter; - use Symfony\Component\DependencyInjection\Definition; $container->register(Ldap::class) ->addArgument(new Reference(Adapter::class); diff --git a/security/voters.rst b/security/voters.rst index bec6d9d12b3..8ee1a1441da 100644 --- a/security/voters.rst +++ b/security/voters.rst @@ -36,6 +36,9 @@ A custom voter needs to implement or extend :class:`Symfony\\Component\\Security\\Core\\Authorization\\Voter\\Voter`, which makes creating a voter even easier:: + use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; + use Symfony\Component\Security\Core\Authorization\Voter\VoterInterface; + abstract class Voter implements VoterInterface { abstract protected function supports($attribute, $subject); diff --git a/service_container/definitions.rst b/service_container/definitions.rst index b47ea9e143e..94c747d5cf4 100644 --- a/service_container/definitions.rst +++ b/service_container/definitions.rst @@ -21,6 +21,8 @@ Getting and Setting Service Definitions There are some helpful methods for working with the service definitions:: + use Symfony\Component\DependencyInjection\Definition; + // finds out if there is an "app.mailer" definition $container->hasDefinition('app.mailer'); // finds out if there is an "app.mailer" definition or alias diff --git a/service_container/factories.rst b/service_container/factories.rst index f1317b85da3..ecff68e9229 100644 --- a/service_container/factories.rst +++ b/service_container/factories.rst @@ -142,6 +142,7 @@ Configuration of the service container then looks like this: use AppBundle\Email\NewsletterManager; use AppBundle\Email\NewsletterManagerFactory; + use Symfony\Component\DependencyInjection\Reference; // ... $container->register(NewsletterManagerFactory::class); diff --git a/service_container/parent_services.rst b/service_container/parent_services.rst index 37449db8f4d..fa8894d263f 100644 --- a/service_container/parent_services.rst +++ b/service_container/parent_services.rst @@ -12,6 +12,9 @@ you may have multiple repository classes which need the // src/AppBundle/Repository/BaseDoctrineRepository.php namespace AppBundle\Repository; + use Doctrine\Common\Persistence\ObjectManager; + use Psr\Log\LoggerInterface; + // ... abstract class BaseDoctrineRepository { diff --git a/service_container/synthetic_services.rst b/service_container/synthetic_services.rst index ee550947af1..7a2b56e74ed 100644 --- a/service_container/synthetic_services.rst +++ b/service_container/synthetic_services.rst @@ -11,6 +11,9 @@ For instance, the ``kernel`` service in Symfony is injected into the container from within the ``Kernel`` class:: // ... + use Symfony\Component\HttpKernel\KernelInterface; + use Symfony\Component\HttpKernel\TerminableInterface; + abstract class Kernel implements KernelInterface, TerminableInterface { // ... diff --git a/session/proxy_examples.rst b/session/proxy_examples.rst index a357d699abe..4016c359c84 100644 --- a/session/proxy_examples.rst +++ b/session/proxy_examples.rst @@ -108,7 +108,6 @@ can intercept the session before it is written:: // src/AppBundle/Session/ReadOnlySessionProxy.php namespace AppBundle\Session; - use AppBundle\Entity\User; use Symfony\Component\HttpFoundation\Session\Storage\Proxy\SessionHandlerProxy; use Symfony\Component\Security\Core\Security; diff --git a/testing/insulating_clients.rst b/testing/insulating_clients.rst index 65a46007f38..f49906d9b09 100644 --- a/testing/insulating_clients.rst +++ b/testing/insulating_clients.rst @@ -8,6 +8,7 @@ If you need to simulate an interaction between different clients (think of a chat for instance), create several clients:: // ... + use Symfony\Component\HttpFoundation\Response; $harry = static::createClient(); $sally = static::createClient(); @@ -23,6 +24,7 @@ a third-party library that has some kind of global state. In such a case, you can insulate your clients:: // ... + use Symfony\Component\HttpFoundation\Response; $harry = static::createClient(); $sally = static::createClient(); diff --git a/testing/profiling.rst b/testing/profiling.rst index d818f75ff55..77e90e8939e 100644 --- a/testing/profiling.rst +++ b/testing/profiling.rst @@ -15,6 +15,8 @@ spent in the framework, etc. But before writing assertions, enable the profiler and check that the profiler is indeed available (it is enabled by default in the ``test`` environment):: + use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; + class LuckyControllerTest extends WebTestCase { public function testNumberAction() diff --git a/validation/sequence_provider.rst b/validation/sequence_provider.rst index 02c649a8410..a529c43128b 100644 --- a/validation/sequence_provider.rst +++ b/validation/sequence_provider.rst @@ -142,8 +142,9 @@ that group are valid, the second group, ``Strict``, will be validated. You can also define a group sequence in the ``validation_groups`` form option:: - use Symfony\Component\Validator\Constraints\GroupSequence; use Symfony\Component\Form\AbstractType; + use Symfony\Component\OptionsResolver\OptionsResolver; + use Symfony\Component\Validator\Constraints\GroupSequence; // ... class MyType extends AbstractType