@@ -290,18 +290,55 @@ protected function getAttribs(array $info, array $cfg)
290290 'data-attributes ' => $ info ['attributes ' ],
291291 'data-chars ' => $ this ->valDumper ->findChars (\json_encode ($ info ['attributes ' ], JSON_UNESCAPED_UNICODE )),
292292 'data-declared-prev ' => $ info ['declaredPrev ' ],
293+ 'data-deprecated-desc ' => !empty ($ info ['isDeprecated ' ]) ? $ this ->getDeprecatedDesc ($ info ) : '' ,
293294 'data-inherited-from ' => $ info ['declaredLast ' ],
294295 );
295296 $ filter = \array_filter (array (
296297 'class ' => true ,
297298 'data-attributes ' => $ cfg ['attributeOutput ' ] && $ info ['attributes ' ],
298299 'data-chars ' => $ cfg ['attributeOutput ' ],
299300 'data-declared-prev ' => empty ($ info ['isInherited ' ]) && !empty ($ info ['declaredPrev ' ]),
301+ 'data-deprecated-desc ' => !empty ($ attribs ['data-deprecated-desc ' ]),
300302 'data-inherited-from ' => !empty ($ info ['isInherited ' ]) || $ info ['isPrivateAncestor ' ],
301303 ));
302304 return \array_intersect_key ($ attribs , $ filter );
303305 }
304306
307+ /**
308+ * Get deprecated description from a combination of #Deprecated and @deprecated
309+ *
310+ * @param array $info Abstraction info
311+ *
312+ * @return string
313+ */
314+ protected function getDeprecatedDesc (array $ info )
315+ {
316+ $ depAttrs = \array_filter ($ info ['attributes ' ], static function ($ attrInfo ) {
317+ return $ attrInfo ['name ' ] === 'Deprecated ' ;
318+ });
319+ $ depAttr = \array_shift ($ depAttrs ) ?: [];
320+ $ desc = '' ;
321+ if (isset ($ depAttr ['arguments ' ]['message ' ])) {
322+ $ desc = $ this ->helper ->dumpPhpDoc ($ depAttr ['arguments ' ]['message ' ], array (
323+ 'sanitize ' => true ,
324+ ));
325+ } elseif (isset ($ info ['phpDoc ' ]['deprecated ' ])) {
326+ $ desc = $ this ->helper ->dumpPhpDoc ($ info ['phpDoc ' ]['deprecated ' ][0 ]['desc ' ]);
327+ }
328+ $ since = '' ;
329+ if (isset ($ depAttr ['arguments ' ]['since ' ])) {
330+ $ since = 'since ' . $ this ->helper ->dumpPhpDoc ($ depAttr ['arguments ' ]['since ' ], array (
331+ 'sanitize ' => true ,
332+ ));
333+ } elseif (isset ($ info ['phpDoc ' ]['deprecated ' ][0 ]['version ' ])) {
334+ $ since = 'since ' . $ info ['phpDoc ' ]['deprecated ' ][0 ]['version ' ];
335+ }
336+ if ($ desc && $ since ) {
337+ $ since = '<em>( ' . $ since . ')</em> ' ;
338+ }
339+ return \implode (' ' , \array_filter ([$ desc , $ since ]));
340+ }
341+
305342 /**
306343 * Get css classes to apply to item
307344 *
0 commit comments