I'm looking for a regex string to parse a property type from it's comment as below.
/**
* Identity
*
* @var integer
*/
protected $id;
I'm using the ReflectionProperty class to get the comment as a string as the var dump below:
string(55) "/** * Identity * * @var integer */"
How would use the regex to return the type after @var and nothing else.
Thanks
The proposed solution in the comments seems rather excessive... should be much easier like this - as types never contain spaces, just match until the space.
/@var\s*([^\s]+)/i