File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -572,12 +572,17 @@ protected function convertPhpDocToArray( PhpDocNode $phpdoc_node ) {
572572 }
573573
574574 // Split into summary and description
575- $ text_lines = array_filter ( explode ( "\n" , trim ( $ text_content ) ) );
575+ $ text_lines = explode ( "\n" , trim ( $ text_content ) );
576576 if ( ! empty ( $ text_lines ) ) {
577- $ docblock_data ['summary ' ] = trim ( $ text_lines [0 ] );
578- if ( count ( $ text_lines ) > 1 ) {
579- $ docblock_data ['description ' ] = trim ( implode ( "\n" , array_slice ( $ text_lines , 1 ) ) );
577+ // Summary is the first lines before a blank line
578+ $ summary = '' ;
579+ while ( ( $ line = array_shift ( $ text_lines ) ) && $ line ) {
580+ $ summary .= $ line . ' ' ;
580581 }
582+ $ docblock_data ['summary ' ] = trim ( $ summary );
583+
584+ // The rest is the description.
585+ $ docblock_data ['description ' ] = trim ( implode ( "\n" , $ text_lines ) );
581586 }
582587
583588 // Extract tags
Original file line number Diff line number Diff line change @@ -355,7 +355,7 @@ function export_docblock_from_data( $docblock_data ) {
355355
356356 // Format descriptions according to legacy expectations:
357357 // - description (summary) should be plain text
358- // - long_description should be wrapped in HTML paragraphs with linebreaks removed
358+ // - long_description should be wrapped in HTML paragraphs with linebreaks removed. TODO: Convert with markdown, ` and >.
359359 $ description = $ docblock_data ['summary ' ] ?? '' ;
360360 $ long_description = $ docblock_data ['description ' ] ?? '' ;
361361
You can’t perform that action at this time.
0 commit comments