getMethodNameLowercase() !== 'map') { return null; } $type = $event->getSource()->getNodeTypeProvider()->getType($event->getCallArgs()[0]->value); if (! $type) { return null; } $types = []; foreach ($type->getChildNodes() as $node) { $inferred = self::type($node); if ($inferred === null) { return null; } $types[] = $inferred; } if (count($types) === 0) { return null; } return Type::combineUnionTypeArray($types, $event->getSource()->getCodebase()); } private static function type(Atomic $node): ?Union { switch (true) { case $node instanceof TLiteralString: return Type::parseString($node->value); case $node instanceof TDependentGetClass: return $node->as_type; case $node instanceof TClassString && $node->as_type: return new Union([$node->as_type]); default: return null; } } }