public
|
PHPDOC_TYPE = "(?xi)\n(?(DEFINE)\n (?<sp> [\\f\\n\\r\\t\\x0b ] )\n (?<lnum> [0-9]+ (?: _ [0-9]+ )* )\n (?<dnum> (?: [0-9]* (?: _ [0-9]+ )* \\. (?&lnum) ) | (?: (?&lnum) \\. [0-9]* (?: _ [0-9]+ )* ) )\n (?<exponent_dnum> (?: (?&lnum) | (?&dnum) ) e [+-]? (?&lnum) )\n (?<php_identifier> [[:alpha:]_\\x80-\\xff] [[:alnum:]_\\x80-\\xff]* )\n (?<php_type> \\\\ (?&php_identifier) (?: \\\\ (?&php_identifier) )* | (?&php_identifier) (?: \\\\ (?&php_identifier) )+ )\n (?<phpdoc_type> (?&php_identifier) (?: - [[:alnum:]_\\x80-\\xff]+ )+ )\n (?<variable> \\$ (?&php_identifier) )\n (?<variance> covariant | contravariant )\n (?<param> \\s*+ (?: & \\s*+ )? (?: \\.\\.\\. \\s*+ )? (?: (?&variable) \\s*+ )? =? )\n (?<trailing> (?: \\s*+ , (?: \\s*+ \\.\\.\\. (?: \\s*+ , )? )? )? \\s*+ )\n)\n(\n (?:\n \\* |\n\n \\$this |\n\n # String\n ' (?: [^'\\\\]*+ | \\\\' | \\\\ )*+ ' |\n \" (?: [^\"\\\\]*+ | \\\\\" | \\\\ )*+ \" |\n\n # Number\n [+-]? (?:\n (?&exponent_dnum) |\n (?&dnum) |\n 0x [0-9a-f]++ (?: _ [0-9a-f]++ )*+ |\n 0b [01]++ (?: _ [01]++ )*+ |\n 0o? [0-7]++ (?: _ [0-7]++ )*+ |\n [1-9] [0-9]*+ (?: _ [0-9]++ )*+ |\n 0\n ) |\n\n # Closure with optional \"<Type,...>\", and optional parameter and\n # return types\n (?: callable | \\\\? Closure ) \\s*+\n (?: \\s* < (?&sp)*+ (?: (?&variance) (?&sp)*+ )? (?! (?&variance) \\b ) (?: (?&php_identifier) \\s++ (?: of | as ) \\b (?&sp)*+ )? (?-1)\n (?: \\s*+ , (?&sp)*+ (?: (?&variance) (?&sp)*+ )? (?! (?&variance) \\b ) (?: (?&php_identifier) \\s++ (?: of | as ) \\b (?&sp)*+ )? (?-1) )*+\n (?&trailing) > )?\n \\( (?&sp)*+ (?: (?-1) (?¶m)\n (?: \\s*+ , (?&sp)*+ (?-1) (?¶m) )*+\n (?&trailing) | \\.\\.\\. \\s*+ )? \\)\n (?: \\s* : (?&sp)*+ (?-1) )? |\n\n # Native or PHPDoc type, possibly nullable, with optional\n # \"::CONST_*\", \"<Type,...>\", and/or \"{0?:Type,...}\"\n (?: \\? (?&sp)*+ )?\n (?: (?&php_type) | (?&phpdoc_type) | (?&php_identifier) )\n (?: :: [[:alpha:]_\\x80-\\xff*] [[:alnum:]_\\x80-\\xff*]*+ )?\n (?: \\s* < (?&sp)*+ (?: (?&variance) (?&sp)*+ )? (?! (?&variance) \\b ) (?-1)\n (?: \\s*+ , (?&sp)*+ (?: (?&variance) (?&sp)*+ )? (?! (?&variance) \\b ) (?-1) )*+\n (?&trailing) > )?\n (?: \\s* \\{ (?&sp)*+ (?:\n (?: (?-1) \\s*+ (?: \\? \\s*+ )? : (?&sp)*+ )? (?-1)\n (?: \\s*+ , (?&sp)*+ (?: (?-1) \\s*+ (?: \\? \\s*+ )? : (?&sp)*+ )? (?-1) )*+\n (?&trailing) | \\.\\.\\. \\s*+ )? \\} )*+ |\n\n # Conditional return type\n (?: (?&variable) | (?&php_identifier) ) \\s+ is (?: \\s++ not )? \\b (?&sp)*+ (?-1)\n \\s*+ \\? (?&sp)*+ (?-1)\n \\s*+ : (?&sp)*+ (?-1) |\n\n # Enclosing parentheses\n (?: \\? \\s*+ )? \\( (?&sp)*+ (?-1) \\s*+ \\)\n )\n (?: \\s* \\[ (?&sp)*+ (?: (?-1) \\s*+ )? \\] )*+\n (?: \\s* (?: \\| | & ) (?&sp)* (?-1) )?\n)"
A valid PHPDoc type
A valid PHPDoc type
In some locales, \s matches non-breaking space (\xA0 ), so an
alternative ((?&sp) ) is used in contexts where the start of a PHP
identifier would otherwise be parsed as whitespace.
|
#
|