Skip to content

Commit 48a7018

Browse files
committed
[CS] Remove unused variables passed to closures
1 parent a1312fa commit 48a7018

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/Symfony/Component/Console/Tests/ApplicationTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -780,8 +780,7 @@ public function testRunDispatchesIntegerExitCode()
780780

781781
// We can assume here that some other test asserts that the event is dispatched at all
782782
$dispatcher = new EventDispatcher();
783-
$self = $this;
784-
$dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($self, &$passedRightValue) {
783+
$dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) {
785784
$passedRightValue = (4 === $event->getExitCode());
786785
});
787786

@@ -820,8 +819,7 @@ public function testRunDispatchesExitCodeOneForExceptionCodeZero()
820819

821820
// We can assume here that some other test asserts that the event is dispatched at all
822821
$dispatcher = new EventDispatcher();
823-
$self = $this;
824-
$dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use ($self, &$passedRightValue) {
822+
$dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) {
825823
$passedRightValue = (1 === $event->getExitCode());
826824
});
827825

src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ class AlternatingRowType extends AbstractType
1111
{
1212
public function buildForm(FormBuilderInterface $builder, array $options)
1313
{
14-
$formFactory = $builder->getFormFactory();
15-
16-
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory) {
14+
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
1715
$form = $event->getForm();
1816
$type = 0 === $form->getName() % 2
1917
? 'Symfony\Component\Form\Extension\Core\Type\TextType'

src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,7 @@ public function testUsesCacheToRespondToHeadRequestsWhenFresh()
964964
public function testSendsNoContentWhenFresh()
965965
{
966966
$time = \DateTime::createFromFormat('U', time());
967-
$that = $this;
968-
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($that, $time) {
967+
$this->setNextResponse(200, array(), 'Hello World', function ($request, $response) use ($time) {
969968
$response->headers->set('Cache-Control', 'public, max-age=10');
970969
$response->headers->set('Last-Modified', $time->format(DATE_RFC2822));
971970
});

src/Symfony/Component/OptionsResolver/Tests/LegacyOptionsTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ protected function setUp()
3232

3333
public function testSetLazyOption()
3434
{
35-
$test = $this;
36-
37-
$this->options->set('foo', function (Options $options) use ($test) {
35+
$this->options->set('foo', function (Options $options) {
3836
return 'dynamic';
3937
});
4038

@@ -89,7 +87,7 @@ public function testPreviousValueIsNotEvaluatedIfNoSecondArgument()
8987
});
9088

9189
// defined by subclass, no $previousValue argument defined!
92-
$this->options->overload('foo', function (Options $options) use ($test) {
90+
$this->options->overload('foo', function (Options $options) {
9391
return 'dynamic';
9492
});
9593

0 commit comments

Comments
 (0)