Tokenisation of psalm array types #430
Description
Summary
Psalm offers very widely supported syntax (by static analysis tools) for documenting array structure. Currently the tokeniser struggles with these forms:
- Space between the parameters
/**
* @return array<TKey, TValue>
*/
- Curly braces for defining object-like arrays
/**
* @return array{firstName:string, lastName:string}
*/
- Newline between the parameters
/**
* @return array{
* firstName:string,
* lastName:string
* }
*
*/
There's probably more cases missing. It will also be a good idea to tokenise the property name with a specific token so its name can be changed.
Motivation
Static analysis is a really powerful tool for avoiding errors, saving time and enforcing coding standards. It really sucks when the IDE is not colouring correctly the syntaxes needed for that analysis. It also provides really good visual feedback and a way of customising the colourisation of the tokens.
Describe alternatives you've considered
I am not aware of any way of customising that tokenisation.
Additional context
I am using VS Code.
Other
I am totally up for PRing this if it is OK to be contributor. I would probably need guidance with testing and setup though - I haven't contributed to a language grammar before.