Skip to content

Commit

Permalink
minor #32648 Remove hack to access class scope inside closures (carus…
Browse files Browse the repository at this point in the history
…ogabriel)

This PR was merged into the 4.4 branch.

Discussion
----------

Remove hack to access class scope inside closures

This is possible since 5.4.

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| BC breaks?    | no     <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tests pass?   | yes    <!-- please add some, will be required by reviewers -->
| Fixed tickets | -   <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | - <!-- required for new features -->

<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.

Additionally (see https://symfony.com/roadmap):
 - Bug fixes must be submitted against the lowest maintained branch where they apply
   (lowest branches are regularly merged to upper ones so they get the fixes too).
 - Features and deprecations must be submitted against branch 4.4.
 - Legacy code removals go to the master branch.
-->

Commits
-------

f84c71b Remove hack to access class scope inside closures
  • Loading branch information
Tobion committed Jul 22, 2019
2 parents 7dfc97b + f84c71b commit e726161
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
8 changes: 3 additions & 5 deletions src/Symfony/Component/Console/Helper/ProgressIndicator.php
Expand Up @@ -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];
Expand Down
Expand Up @@ -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
Expand Down

0 comments on commit e726161

Please sign in to comment.