function DrupalComponentTest::findPhpClasses
Searches a directory recursively for PHP classes.
Parameters
string $dir: The full path to the directory that should be checked.
Return value
array An array of class paths.
2 calls to DrupalComponentTest::findPhpClasses()
- DrupalComponentTest::testNoCoreInComponent in core/tests/ Drupal/ Tests/ Component/ DrupalComponentTest.php 
- Tests that classes in Component do not use any Core class.
- DrupalComponentTest::testNoCoreInComponentTests in core/tests/ Drupal/ Tests/ Component/ DrupalComponentTest.php 
- Tests that classes in Component Tests do not use any Core class.
File
- 
              core/tests/ Drupal/ Tests/ Component/ DrupalComponentTest.php, line 78 
Class
- DrupalComponentTest
- General tests for \Drupal\Component that can't go anywhere else.
Namespace
Drupal\Tests\ComponentCode
protected function findPhpClasses($dir) : array {
  $classes = [];
  foreach (new \DirectoryIterator($dir) as $file) {
    if ($file->isDir() && !$file->isDot()) {
      $classes = array_merge($classes, $this->findPhpClasses($file->getPathname()));
    }
    elseif ($file->getExtension() == 'php') {
      $classes[] = $file->getPathname();
    }
  }
  return $classes;
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
