From f84c71b58236a92667c99d0864ec50b29434608a Mon Sep 17 00:00:00 2001 From: Gabriel Caruso Date: Mon, 22 Jul 2019 17:15:39 +0200 Subject: [PATCH] Remove hack to access class scope inside closures This is possible since 5.4 --- .../Component/Console/Helper/ProgressIndicator.php | 8 +++----- .../HttpKernel/Tests/HttpCache/HttpCacheTest.php | 6 ++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Console/Helper/ProgressIndicator.php b/src/Symfony/Component/Console/Helper/ProgressIndicator.php index 301be27ea431..9a0163739178 100644 --- a/src/Symfony/Component/Console/Helper/ProgressIndicator.php +++ b/src/Symfony/Component/Console/Helper/ProgressIndicator.php @@ -192,11 +192,9 @@ private function display() return; } - $self = $this; - - $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) { - if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) { - return $formatter($self); + $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) { + if ($formatter = self::getPlaceholderFormatterDefinition($matches[1])) { + return $formatter($this); } return $matches[0]; diff --git a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php index 309e8aaaec77..c5016184ccb1 100644 --- a/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTest.php @@ -843,10 +843,8 @@ public function testValidatesCachedResponsesWithLastModifiedAndNoFreshnessInform public function testValidatesCachedResponsesUseSameHttpMethod() { - $test = $this; - - $this->setNextResponse(200, [], 'Hello World', function ($request, $response) use ($test) { - $test->assertSame('OPTIONS', $request->getMethod()); + $this->setNextResponse(200, [], 'Hello World', function ($request, $response) { + $this->assertSame('OPTIONS', $request->getMethod()); }); // build initial request