You are here

public function ClosureTest::getEntities in Coder 8.2

Same name and namespace in other branches
  1. 8.3 tests/DrupalPractice/good/good.php \ClosureTest::getEntities()
  2. 8.3.x tests/DrupalPractice/good/good.php \ClosureTest::getEntities()

Use $this in a closure, which should be a defined variable.

File

coder_sniffer/DrupalPractice/Test/good/good.php, line 134

Class

ClosureTest
Testing closures.

Code

public function getEntities($limit) {

  // Create an array of dummy entities.
  $entities = array_map(function () {
    return $this
      ->prophesize(EntityInterface::class)
      ->reveal();
  }, range(1, $limit));
  return $entities;
}