diff --git a/src/docblock/Factory.php b/src/docblock/Factory.php index 369dfdee..b9d0c775 100644 --- a/src/docblock/Factory.php +++ b/src/docblock/Factory.php @@ -9,12 +9,15 @@ class Factory { 'invalid' => 'TheSeer\\phpDox\\DocBlock\\InvalidParser', 'generic' => 'TheSeer\\phpDox\\DocBlock\\GenericParser', - 'description' => 'TheSeer\\phpDox\\DocBlock\\DescriptionParser', - 'param' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', - 'var' => 'TheSeer\\phpDox\\DocBlock\\VarParser', - 'return' => 'TheSeer\\phpDox\\DocBlock\\VarParser', - 'throws' => 'TheSeer\\phpDox\\DocBlock\\VarParser', - 'license' => 'TheSeer\\phpDox\\DocBlock\\LicenseParser', + 'description' => 'TheSeer\\phpDox\\DocBlock\\DescriptionParser', + 'param' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'property-read' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'property-write' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'property' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'var' => 'TheSeer\\phpDox\\DocBlock\\VarParser', + 'return' => 'TheSeer\\phpDox\\DocBlock\\VarParser', + 'throws' => 'TheSeer\\phpDox\\DocBlock\\VarParser', + 'license' => 'TheSeer\\phpDox\\DocBlock\\LicenseParser', 'internal' => 'TheSeer\\phpDox\\DocBlock\\InternalParser', 'inheritdoc' => 'TheSeer\\phpDox\\DocBlock\\InheritdocParser' diff --git a/src/docblock/Parser.php b/src/docblock/Parser.php index b8e093aa..6722f716 100644 --- a/src/docblock/Parser.php +++ b/src/docblock/Parser.php @@ -41,7 +41,7 @@ public function parse($block, array $aliasMap) { } $buffer = []; - \preg_match('/^\@([a-zA-Z0-9_]+)(.*)$/', $line, $lineParts); + \preg_match('/^\@([a-zA-Z0-9_-]+)(.*)$/', $line, $lineParts); $name = ($lineParts[1] ?? '(undefined)'); $payload = (isset($lineParts[2]) ? \trim($lineParts[2]) : ''); diff --git a/templates/html/components.xsl b/templates/html/components.xsl index 6bf1b7e2..435bcac4 100644 --- a/templates/html/components.xsl +++ b/templates/html/components.xsl @@ -287,11 +287,61 @@ + +

magic

+ +
+ +

magic — Read only

+ +
+ +

magic — Write only

+ +
+ +
  • + + + — + + + + + + + + +
    + + + +
    +
  • +
    + + +
  • $ diff --git a/templates/html/synopsis.xsl b/templates/html/synopsis.xsl index 994f47c1..46f5385f 100644 --- a/templates/html/synopsis.xsl +++ b/templates/html/synopsis.xsl @@ -74,6 +74,21 @@ ;
  • + +
  • + magic (r/o) (w/o)  + + + + + object + + + + +  ; +
  • +
    diff --git a/tests/Integration/docblock/FactoryTest.php b/tests/Integration/docblock/FactoryTest.php index e15b31c5..c0874c5b 100644 --- a/tests/Integration/docblock/FactoryTest.php +++ b/tests/Integration/docblock/FactoryTest.php @@ -25,11 +25,14 @@ public static function getInstanceMapDataprovider() { 'invalid' => 'TheSeer\\phpDox\\DocBlock\\InvalidParser', 'generic' => 'TheSeer\\phpDox\\DocBlock\\GenericParser', - 'description' => 'TheSeer\\phpDox\\DocBlock\\DescriptionParser', - 'param' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', - 'var' => 'TheSeer\\phpDox\\DocBlock\\VarParser', - 'return' => 'TheSeer\\phpDox\\DocBlock\\VarParser', - 'license' => 'TheSeer\\phpDox\\DocBlock\\LicenseParser', + 'description' => 'TheSeer\\phpDox\\DocBlock\\DescriptionParser', + 'param' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'property-read' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'property-write' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'property' => 'TheSeer\\phpDox\\DocBlock\\ParamParser', + 'var' => 'TheSeer\\phpDox\\DocBlock\\VarParser', + 'return' => 'TheSeer\\phpDox\\DocBlock\\VarParser', + 'license' => 'TheSeer\\phpDox\\DocBlock\\LicenseParser', 'internal' => 'TheSeer\\phpDox\\DocBlock\\InternalParser' ]; diff --git a/tests/Integration/docblock/ParserTest.php b/tests/Integration/docblock/ParserTest.php index d478479a..7abb07a8 100644 --- a/tests/Integration/docblock/ParserTest.php +++ b/tests/Integration/docblock/ParserTest.php @@ -56,6 +56,7 @@ public function docblockSources() { ['param_without_description'], ['param_without_varname'], ['param_without_varname_and_description'], + ['property'], ['see'], ['since'], ['throws'], diff --git a/tests/data/docbock/property b/tests/data/docbock/property new file mode 100644 index 00000000..99e23d7a --- /dev/null +++ b/tests/data/docbock/property @@ -0,0 +1,5 @@ +/** + * @property int $state The class state + * @property-read int $pastState The previous class state + * @property-write int $call The number or call + */ diff --git a/tests/data/docbock/property.xml b/tests/data/docbock/property.xml new file mode 100644 index 00000000..0750b308 --- /dev/null +++ b/tests/data/docbock/property.xml @@ -0,0 +1 @@ +