$value) { $constant = (new PHPDefineConstant())->readObjectFromReflection([$name, $value]); $constant->readMutedProblems($jsonData->constants); $stubs->addConstant($constant); } foreach (get_defined_functions()['internal'] as $function) { $reflectionFunction = new ReflectionFunction($function); $phpFunction = (new PHPFunction())->readObjectFromReflection($reflectionFunction); $phpFunction->readMutedProblems($jsonData->functions); $stubs->addFunction($phpFunction); } foreach (get_declared_classes() as $clazz) { $reflectionClass = new ReflectionClass($clazz); if ($reflectionClass->isInternal()) { if (method_exists($reflectionClass, 'isEnum') && $reflectionClass->isEnum()) { $enum = (new PHPEnum())->readObjectFromReflection($reflectionClass); $enum->readMutedProblems($jsonData->enums); $stubs->addEnum($enum); } else { $class = (new PHPClass())->readObjectFromReflection($reflectionClass); $class->readMutedProblems($jsonData->classes); $stubs->addClass($class); } } } foreach (get_declared_interfaces() as $interface) { $reflectionInterface = new ReflectionClass($interface); if ($reflectionInterface->isInternal()) { $phpInterface = (new PHPInterface())->readObjectFromReflection($reflectionInterface); $phpInterface->readMutedProblems($jsonData->interfaces); $stubs->addInterface($phpInterface); } } } return $stubs; } }