* @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:----cmxxoUrcgjxW5Y0V4ER67E3Ftg5nZp+mj9pP8X01M1+l+05cCyHIkL1pUBcDEzyJrq3WYlbn7i8lehp96qTFhfPcQQxjG7FDOQsHrLa0PTxLQL+sqDhDTH9ROgWLsKSM3MYG4a7p0dHY876ptBTwD5IjJ3D4K/lKW3CQiOjukDLrvogIw+81boOnE+ahr18HLRTnstMe/sBdkP1HX2tKx4VM8afuSHdF/VdqUVzmPH8sxB2oPsBM6Mcd0+f/R7F2xBhUUdoqjFnbh+3cLZtq2uz6qM0pdGfOSQLKjo2VypuBhq4EMHTfhdgb1gHYHeB5N8TVEWbGbF04KQmugIDeTtVJZqtJTyqVji4r3iXNYyf/nOPHsW7+lueebA/hLn5J8/uMS9UpcJtB+zjN1RqvhzsrC5wW4vD+eWMcFJphzx8GnmVsAeTmdp59VoXARwLxn/eEae7D7WG5nwqoAA5Lj6fsijdGwGnfDPOj5Qy1lLudML8cocn2iKFtfkwoviWxLqGgpy2Ko0SkNbeIw6LKn4xCsCH0QQDnSggE5Rwrrbg+hN/9bgl5kUWi7CoUcrifqy3yz+ZLUDaV5iB4wYBdKDXZ0h8g90RCDDRuayNW/1ASOlG72xGQNTs/tyiXCI0v2Wd8pjEY8Kr8LdCz1x6oE/a5tq1DxZ7m/tbKdhjyFac=----ATTACHMENT:----MzM4NTAyMzk4NTIzNTc4IDM5MDExMDIyODQxMDIxOCA0MzU3NzAxNjM3MDY1MDU4