Feature/phpdoc templates
Closes: #89
Admittedly, not as effective as I was hoping (->value doesn't seem to give the more specific type) however, it all works, and IMO is an enhancement!
@brendt could you check this PR? I think that you are possibly a better reviewer for these changes.
Following some reading re the static type, I've filed a bug report with psalm here: vimeo/psalm#5221
->value doesn't seem to give the more specific type
If that isn't the case, I don't think there's enough value in adding this feature. How come it doesn't work?
Another consideration: string|int should still be supported as well, I believe the correct typehint should be TEnumValue|string|int. Also I prefer to use T, it's shorter and a general accepted convention when it comes to typing generics.
@brendt why should it support the generic and string|int typehints? 🤔
If we do both the generic loses its benefits for me. And you also shouldn't have an enum with mixed value types.
I was under the impression that @template doesn't work in phpstorm if you have psalm inspections disabled, maybe I missed them adding native support?
If so shouldn't we use the special @psalm-xyz doc-tag for the template and the original @return for the string|int?
This will let psalm know about the template which overrides the default scalar types and all without psalm will have the scalar type-hints. 🤔
I must admit I haven't used the psalm inspections in PhpStorm because it's too slow for my likings, so maybe @AAllport should provide some input :)
I'm fine adding the @psalm variants if those work as intended :)