diff --git a/phpdotnet/phd/Package/Generic/XHTML.php b/phpdotnet/phd/Package/Generic/XHTML.php index e74fc254..57e99bc7 100644 --- a/phpdotnet/phd/Package/Generic/XHTML.php +++ b/phpdotnet/phd/Package/Generic/XHTML.php @@ -525,7 +525,7 @@ abstract class Package_Generic_XHTML extends Format_Abstract_XHTML { protected $isSectionChunk = array(); protected $params = array(); - private bool $classHasAttributes = false; + protected bool $classHasAttributes = false; public function __construct() { parent::__construct(); diff --git a/phpdotnet/phd/Package/PHP/XHTML.php b/phpdotnet/phd/Package/PHP/XHTML.php index 912ef562..f0aebfed 100644 --- a/phpdotnet/phd/Package/PHP/XHTML.php +++ b/phpdotnet/phd/Package/PHP/XHTML.php @@ -413,6 +413,10 @@ public function format_methodsynopsis_type($open, $tag, $attrs) { "intersection" => "&", }; } + if ($this->classHasAttributes) { + $this->classHasAttributes = false; + return "
"; + } } else { if ( isset($attrs[Reader::XMLNS_DOCBOOK]["class"]) diff --git a/tests/package/generic/attribute_formatting_002.phpt b/tests/package/generic/attribute_formatting_002.phpt index 44e0c909..4a9b0aac 100644 --- a/tests/package/generic/attribute_formatting_002.phpt +++ b/tests/package/generic/attribute_formatting_002.phpt @@ -150,4 +150,21 @@ Content: } +
+

9. Function with unknown attributes

+
+ #[\UnknownAttribute] + #[\AnotherUnknownAttribute] + void function_name)
+ +
+ +
+

10. Function with known attributes

+
#[\KnownAttribute] + #[\AnotherKnownAttribute] + void function_name)
+ +
+ diff --git a/tests/package/generic/data/attribute_formatting_002.xml b/tests/package/generic/data/attribute_formatting_002.xml index 3f2d070d..18e666ba 100644 --- a/tests/package/generic/data/attribute_formatting_002.xml +++ b/tests/package/generic/data/attribute_formatting_002.xml @@ -119,4 +119,22 @@ +
+ 9. Function with unknown attributes + + #[\UnknownAttribute] + #[\AnotherUnknownAttribute] + voidfunction_name + +
+ +
+ 10. Function with known attributes + + #[\KnownAttribute] + #[\AnotherKnownAttribute] + voidfunction_name + +
+