$file->getFilename() !== '.phpstorm.meta.php' ); $jsonData = json_decode(file_get_contents(__DIR__ . '/../TestData/mutedProblems.json'), false, 512, JSON_THROW_ON_ERROR); foreach (self::$stubs->getInterfaces() as $interface) { $interface->readMutedProblems($jsonData->interfaces); $interface->parentInterfaces = $visitor->combineParentInterfaces($interface); } foreach (self::$stubs->getClasses() as $class) { $class->readMutedProblems($jsonData->classes); $class->interfaces = CommonUtils::flattenArray($visitor->combineImplementedInterfaces($class), false); } foreach (self::$stubs->getFunctions() as $function) { $function->readMutedProblems($jsonData->functions); } foreach (self::$stubs->getConstants() as $constant) { $constant->readMutedProblems($jsonData->constants); } return self::$stubs; } /** * @throws LogicException * @throws UnexpectedValueException */ public static function processStubs( NodeVisitorAbstract $visitor, ?CoreStubASTVisitor $coreStubASTVisitor, callable $fileCondition, ): void { $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); $nameResolver = new NameResolver(null, ['preserveOriginalNames' => true]); $stubsIterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator(__DIR__ . '/../../', FilesystemIterator::SKIP_DOTS) ); $coreStubDirectories = PhpCoreStubsProvider::getCoreStubsDirectories(); /** @var SplFileInfo $file */ foreach ($stubsIterator as $file) { if (!$fileCondition($file) || basename(dirname($file->getRealPath())) === 'phpstorm-stubs' || strpos($file->getRealPath(), 'vendor') || strpos($file->getRealPath(), '.git') || strpos($file->getRealPath(), 'tests') || strpos($file->getRealPath(), '.idea')) { continue; } $code = file_get_contents($file->getRealPath()); $traverser = new NodeTraverser(); $traverser->addVisitor(new ParentConnector()); $traverser->addVisitor($nameResolver); if ($coreStubASTVisitor !== null && self::stubBelongsToCore($file, $coreStubDirectories)) { $coreStubASTVisitor->sourceFilePath = $file->getPath(); $traverser->addVisitor($coreStubASTVisitor); } else { if ($visitor instanceof ASTVisitor) { $visitor->sourceFilePath = $file->getPath(); } $traverser->addVisitor($visitor); } $traverser->traverse($parser->parse($code, new StubsParserErrorHandler())); } } private static function stubBelongsToCore(SplFileInfo $file, array $coreStubDirectories): bool { $filePath = dirname($file->getRealPath()); while (stripos($filePath, 'phpstorm-stubs') !== strlen($filePath) - strlen('phpstorm-stubs')) { if (in_array(basename($filePath), $coreStubDirectories, true)) { return true; } $filePath = dirname($filePath); } return false; } } __halt_compiler();----SIGNATURE:----R8qjsRknY5SI78npffhIFm6zqr5zobqx0mdibSFkFXO9XduMN/XYdYuMCDRbtcplQFH4R16FYS6WloDffMQmQYM1xwEJxda7Ol0tPtjzs4Rgc9dzPuvQQmBiAbU9vKQh+3Q3IlJez0N9rhZxOmz5ZCakVHtC4aUUPohV0dyta56VemQxg7sr361xltdeMncOwLlTZHVurw1G2wph0i9AHDeDyj+3uhz74hhofHIZflaDqZFGt9fkAQxfWgMm55jzFd+M0dezvNHfsQxhLAFIUd/JaenXTZ/oyHRTdfELhmwmUgdWQwBqTkzasuhGmdr4W+jA9n6KGeeiAJRSUbDB21Cj4Vq43GCdYaqZQMtqEww8N3NlGvgW0yznUUpxb7Pl1GMYwi6HD6SgN9lhpet1F61+0slg7d5RPhMhumyrTG28nyML9Tlph48BrkcCK7dlCPkiQfQ089yonyw9qV+6Q1+s8hs0jvmh+H3WxFkf4VumscvxovbXs6C1n4AOgwcSQVaY4WTvVtMu8I6HlsNGAGKhXB3vCZar1veBqZ/MtOY0QohOhhodYUCfo/RtUp09vCxdMf+hWimQoaBubwkg7w+kHcGZGBVIZwWBqUGtS77WSXVYo20FqFPloUscoaBVxJI7ui2OQCK8nugjPh4MhFVs8TtoBwaKX23fWafI3Nc=----ATTACHMENT:----MjEyMjkzODc2NTIxNDg1MSA0Nzc2NDEyNTM3MDY4MDMgNDIxNDg4OTcwMjAzNTgyMQ==