* @author Jordi Boggiano * * @deprecated Since Composer 2.4.0 use the composer/class-map-generator package instead */ class ClassMapGenerator { /** * Generate a class map file * * @param \Traversable|array $dirs Directories or a single path to search in * @param string $file The name of the class map file */ public static function dump(iterable $dirs, string $file): void { $maps = []; foreach ($dirs as $dir) { $maps = array_merge($maps, static::createMap($dir)); } file_put_contents($file, sprintf('|string|array<\SplFileInfo> $path The path to search in or an iterator * @param non-empty-string|null $excluded Regex that matches file paths to be excluded from the classmap * @param ?IOInterface $io IO object * @param null|string $namespace Optional namespace prefix to filter by * @param null|'psr-0'|'psr-4'|'classmap' $autoloadType psr-0|psr-4 Optional autoload standard to use mapping rules * @param array $scannedFiles * @return array A class map array * @throws \RuntimeException When the path is neither an existing file nor directory */ public static function createMap( $path, ?string $excluded = null, ?IOInterface $io = null, ?string $namespace = null, ?string $autoloadType = null, array &$scannedFiles = [], ): array { $generator = new \Composer\ClassMapGenerator\ClassMapGenerator(['php', 'inc', 'hh']); $fileList = new FileList(); $fileList->files = $scannedFiles; $generator->avoidDuplicateScans($fileList); $generator->scanPaths($path, $excluded, $autoloadType ?? 'classmap', $namespace); $classMap = $generator->getClassMap(); $scannedFiles = $fileList->files; if ($io !== null) { foreach ($classMap->getPsrViolations() as $msg) { $io->writeError("$msg"); } foreach ($classMap->getAmbiguousClasses() as $class => $paths) { if (count($paths) > 1) { $io->writeError( 'Warning: Ambiguous class resolution, "'.$class.'"'. ' was found '. (count($paths) + 1) .'x: in "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.' ); } else { $io->writeError( 'Warning: Ambiguous class resolution, "'.$class.'"'. ' was found in both "'.$classMap->getClassPath($class).'" and "'. implode('", "', $paths) .'", the first will be used.' ); } } } return $classMap->getMap(); } } __halt_compiler();----SIGNATURE:----2DmzZGlKDVFpDlv5pLQbSmp/aHY5WxTC+uoUtN7L/yhYoUQogYJONmsWt4s6nE82Al/KudHVZCuKndice2oHrDXJ7hvvaUidryeNYXkHOASU2wwiNLieV0bB+XG4Q2Veu+lztr+mTdoMttzZC9f4uB4izh9+EJkPUJYB780/tnjzPobofBekFUZO+s44WW4ou1PFoUqXd6av4gPYqreWeZCxXs2Jp/HHISbiKUUFZZJ9N7LgZjuUk4cj1/oUrEjk9Amu/Mu8cXYZfHPZFlQyuA3xvhj5zeFDuarVNxdwIFZpJGqd/pgo3upnn/Iv9Ek27IsRlBd9IMsRhDsMf6/3WWsV8Zh7vnCiUAFkv+5njgicVXcN0oMtDcB6QsKo1NY5cS4jSO1dLngdgmDOUebHESMwkh2xgEJL1bDHlvz6Uws7G/xmaaIUAw1hWqGwJIMi0xxVH4oRK+ya7W/RGRy9xnYN9Ul4HtT2huLNy1vy/TByPZ75SkoFLNKlr1UnHABpq4L/XE+mtfx5NfyRz5UBMsF6FkyZOqil8gptOkqt3ZUvj8B2IToVApU52yFy5MmJVcHFVoQdmf+43PTYNlDnkW4xF2lIXdolQ5AiniqfyR7S+yXVHgI9oRHL/XlfqP+Rni5pEqc6SDtQwqYGIOH/x27it6IuvOetJalis3YC/n4=----ATTACHMENT:----NzIyMjcxNjAxNDU0MDEyNCA0Mjc0NDc2NTExMTI5MDA0IDQzMDg0NjUxOTUwNDY2OTM=