The existing regexp for checking type hints and variable names of inline @var comments doesn't allow numbers:

^/\*\* @var [a-zA-Z_\\\\\[\]|]+ \$[a-zA-Z_]+ \*/$

PHP gives the following regexp for valid class names:

^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$

Here's my attempt at combining the two:

^/\*\* @var \\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff\\\\\[\]|]* \$[a-zA-Z0-9_]+ \*/$

Comments

psynaptic created an issue. See original summary.

psynaptic’s picture

Title: Numbers are not allowed in inline @var comment data types » Numbers are not allowed in inline @var comment type hints and variable names
psynaptic’s picture

Issue summary: View changes
klausi’s picture

Status: Active » Fixed

Committed a fix, thanks for reporting!

  • klausi committed de3b993 on 8.x-2.x
    Issue #2633706: Allow numbers in inline @var comment type hints and...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.