My Environment (version of the project, operating system, or hardware):
Any environment will do. I'm using phpda 2.0.2 from composer.
My phpda.yml:
Any config file, e.g. the default.
When I run this command: vendor/bin/phpda
If the project analyzed uses PSR5 array union types, e.g.
* @return (string|array)[]
You get:
Warning "\array)" is not a valid Fqsen. on line [line + file]
PSR5 array union types are already supported by TypeResolver/ReflectionDocBlock. The problem seems to be that, in order to parse the union type, TypeResolver splits the line at ( and )[] (ref).
However, NameResolver strips every occurrence of [], hence TypeResolver will try to split (string|array), which in turn gives the following parts:
[ '(', 'string', '|', 'array)' ]
and the last one isn't recognised as a valid type.
My Environment (version of the project, operating system, or hardware): Any environment will do. I'm using phpda 2.0.2 from composer.
My
phpda.yml
: Any config file, e.g. the default.When I run this command:
vendor/bin/phpda
If the project analyzed uses PSR5 array union types, e.g.
You get:
PSR5 array union types are already supported by TypeResolver/ReflectionDocBlock. The problem seems to be that, in order to parse the union type, TypeResolver splits the line at
(
and)[]
(ref). However, NameResolver strips every occurrence of[]
, hence TypeResolver will try to split(string|array)
, which in turn gives the following parts:and the last one isn't recognised as a valid type.