Skip to content

Commit

Permalink
DQA-10274: Fix classMap namespace on SanitiseClass (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaocsilva authored Oct 28, 2024
1 parent 1639139 commit ebfd066
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/TaskRunner/Commands/DrupalSanitiseCommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,14 @@ private function createClassMap(string $directory): array
$classes = [];
$iterator = new \RecursiveDirectoryIterator($directory);
foreach (new \RecursiveIteratorIterator($iterator) as $file) {
if (!$file->isDir() && $file->getExtension() === 'php' && strpos($file->getPathname(), 'src')) {
$filePath = $file->getPathname();
if (!$file->isDir() && $file->getExtension() === 'php' && str_contains($file->getPathname(), 'src')) {
$path = $file->getPathname();
$className = str_replace('.php', '', $file->getFilename());
$ns = dirname(substr($filePath, (strpos($filePath, 'src') + 4)));
$module = basename(strstr($filePath, 'src', true));
$namespace = 'Drupal\\' . $module . '\\' . $ns;
$classes[$namespace . '\\' . $className] = realpath($filePath);
$ns = dirname(substr($path, (strpos($path, 'src') + 4)));
$ns = str_replace('/', '\\', $ns);
$module = basename(strstr($path, 'src', true));
$class = 'Drupal\\' . $module . '\\' . $ns . '\\' . $className;
$classes[$class] = realpath($path);
}
}
return $classes;
Expand Down

0 comments on commit ebfd066

Please sign in to comment.