wikimedia / composer-merge-plugin

Merge one or more additional composer.json files at Composer runtime
MIT License
923 stars 160 forks source link

#224 issue Remove $that = $this #269

Open Abhishektharu opened 8 months ago

Abhishektharu commented 8 months ago

I removed $that = $this

mcaskill commented 5 months ago

@Abhishektharu

When declared in the context of a class, the current class is automatically bound to it, making $this available inside of the function's scope.

Anonymous functions, PHP.net

For example:

- $that = $this;
-
  $dir = $this->fixtureDir(__FUNCTION__);

  $root = $this->rootFromJson("{$dir}/composer.json");
  $root->setRequires(Argument::type('array'))->will(
-     function ($args) use ($that) {
+     function ($args) {
          $requires = $args[0];
-         $that->assertCount(1, $requires);
-         $that->assertArrayHasKey('monolog/monolog', $requires);
+         $this->assertCount(1, $requires);
+         $this->assertArrayHasKey('monolog/monolog', $requires);
      }
  );