void WriteType(SourceTypeSymbol type) { _writer.WriteLine($"<member name=\"{CommentIdResolver.GetId(type)}\">"); var phpdoc = type.Syntax?.PHPDoc; if (phpdoc != null) { WriteSummary(phpdoc.Summary); } _writer.WriteLine("</member>"); foreach (var field in type.GetMembers().OfType <SourceFieldSymbol>()) { if ((phpdoc = field.PhpDocBlock) != null) { var summary = phpdoc.Summary; var value = string.Empty; if (string.IsNullOrEmpty(summary)) { // try @var or @staticvar: var vartag = field.FindPhpDocVarTag(); if (vartag != null) { summary = vartag.Description; if (!string.IsNullOrEmpty(vartag.TypeNames)) { value = string.Format("<value>{0}</value>", XmlEncode(vartag.TypeNames)); } } } if (!string.IsNullOrWhiteSpace(summary)) { _writer.WriteLine($"<member name=\"{CommentIdResolver.GetId(field)}\">"); WriteSummary(summary); _writer.WriteLine(value); _writer.WriteLine("</member>"); } } } }
void WriteRoutine(SourceRoutineSymbol routine) => WriteRoutine(CommentIdResolver.GetId(routine), routine);
void WriteType(SourceTypeSymbol type) { _writer.WriteLine($"<member name=\"{CommentIdResolver.GetId(type)}\">"); var phpdoc = type.Syntax?.PHPDoc; if (phpdoc != null) { WriteSummary(_writer, phpdoc.Summary); } _writer.WriteLine("</member>"); // // fields // foreach (var field in type.GetMembers().OfType <SourceFieldSymbol>()) { if ((phpdoc = field.PHPDocBlock) != null) { var summary = phpdoc.Summary; var value = string.Empty; if (string.IsNullOrEmpty(summary)) { // try @var or @staticvar: var vartag = field.FindPhpDocVarTag(); if (vartag != null) { summary = vartag.Description; if (!string.IsNullOrEmpty(vartag.TypeNames)) { value = string.Format("<value>{0}</value>", XmlEncode(vartag.TypeNames)); } } } if (!string.IsNullOrWhiteSpace(summary)) { _writer.WriteLine($"<member name=\"{CommentIdResolver.GetId(field)}\">"); WriteSummary(_writer, summary); _writer.WriteLine(value); _writer.WriteLine("</member>"); } } } // // .ctor // var ctors = type.InstanceConstructors; for (int i = 0; i < ctors.Length; i++) { // find __construct() if (ctors[i] is SynthesizedPhpCtorSymbol synctor && synctor.PhpConstructor is SourceRoutineSymbol php_construct) { // annotate all generated .ctor() methods: for (int j = 0; j < ctors.Length; j++) { var ctor_id = CommentIdResolver.GetId(ctors[j]); if (ctors[j].IsFieldsOnlyConstructor()) { // annotate special .ctor that initializes only fields _writer.WriteLine($"<member name=\"{ctor_id}\">"); WriteSummary(_writer, Peachpie.CodeAnalysis.PhpResources.XmlDoc_FieldsOnlyCtor); _writer.WriteLine("</member>"); } else { WriteRoutine(ctor_id, php_construct); } } break; } } }