embeddedFiles($rootDir) as $path) { $relative = Paths::relativeTo($rootDir, $path); if (in_array($relative, $excludes, true)) { continue; } foreach (file($path) as $idx => $raw) { if (!str_contains($raw, self::TOKEN)) { continue; } $errors[] = "{$relative}:" . ($idx + 1) . ': ' . trim($raw); } } return $errors; } /** * The sources whose bytes reach the binary: Rust code, and the PHP files the Rust code * embeds with `include_str!`. * * @return list */ private function embeddedFiles(string $rootDir): array { $paths = FileFinder::rustFiles($rootDir); foreach (glob("{$rootDir}/crates/*/php", GLOB_ONLYDIR) ?: [] as $phpDir) { $iterator = new \RecursiveIteratorIterator( new \RecursiveDirectoryIterator($phpDir, \FilesystemIterator::SKIP_DOTS), ); foreach ($iterator as $file) { /** @var \SplFileInfo $file */ if ($file->isFile()) { $paths[] = $file->getPathname(); } } } sort($paths); return $paths; } }