Remove hack to access class scope inside closures

This is possible since 5.4
This commit is contained in:
Gabriel Caruso 2019-07-22 17:15:39 +02:00
parent 7dfc97be9f
commit f84c71b582
No known key found for this signature in database
GPG Key ID: 4B385A6EE6C9678D
2 changed files with 5 additions and 9 deletions

View File

@ -192,11 +192,9 @@ class ProgressIndicator
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];

View File

@ -843,10 +843,8 @@ class HttpCacheTest extends HttpCacheTestCase
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