Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
opt
/
php-8.1.16-202303091609
/
share
/
test
/
mongodb
/
scripts
/
//opt/php-8.1.16-202303091609/share/test/mongodb/scripts/create-psalm-callmap.php
<?php $filter = function (string $name): bool { $namespaces = ['MongoDB\BSON\\', 'MongoDB\Driver\\']; foreach ($namespaces as $namespace) { if (str_starts_with($name, $namespace)) { return true; } } return false; }; $classes = array_filter(get_declared_classes(), $filter); $interfaces = array_filter(get_declared_interfaces(), $filter); $members = array_merge($classes, $interfaces); sort($members); $skippedMethods = ['__set_state', '__wakeup', '__serialize', '__unserialize']; $callmap = []; foreach ($members as $member) { $reflectionClass = new ReflectionClass($member); foreach ($reflectionClass->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { if ($method->getDeclaringClass() != $reflectionClass && $method->getName() != '__toString') { continue; } if (in_array($method->getName(), $skippedMethods, true)) { continue; } $methodKey = $reflectionClass->getName() . '::' . $method->getName(); $returnType = $method->hasReturnType() ? (string) $method->getReturnType() : $method->hasTentativeReturnType() ? (string) $method->getTentativeReturnType() : 'void'; $callmapEntry = [$returnType]; foreach ($method->getParameters() as $parameter) { $parameterKey = $parameter->getName(); if ($parameter->isOptional()) { $parameterKey .= '='; } $callmapEntry[$parameterKey] = (string) $parameter->getType(); } $callmap[$methodKey] = $callmapEntry; } } var_export($callmap);