Skip to content

Add missing imports and remove useless #10817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions components/console/helpers/questionhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions components/console/helpers/table.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing command import here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added. Thanks 👍

{
// ...
Expand Down
2 changes: 2 additions & 0 deletions console/calling_commands.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 5 additions & 0 deletions console/input.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
{
// ...
Expand Down
3 changes: 3 additions & 0 deletions console/lockable_trait.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
4 changes: 4 additions & 0 deletions console/verbosity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
// ...
Expand Down
2 changes: 0 additions & 2 deletions event_dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
1 change: 1 addition & 0 deletions http_cache/validation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion security/ldap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions security/voters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions service_container/definitions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions service_container/factories.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions service_container/parent_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
3 changes: 3 additions & 0 deletions service_container/synthetic_services.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
// ...
Expand Down
1 change: 0 additions & 1 deletion session/proxy_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 2 additions & 0 deletions testing/insulating_clients.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions testing/profiling.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion validation/sequence_provider.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down