enum icon indicating copy to clipboard operation
enum copied to clipboard

Feature/phpdoc templates

Open AAllport opened this issue 4 years ago • 8 comments

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!

AAllport avatar Feb 12 '21 18:02 AAllport

@brendt could you check this PR? I think that you are possibly a better reviewer for these changes.

Gummibeer avatar Feb 13 '21 08:02 Gummibeer

Following some reading re the static type, I've filed a bug report with psalm here: vimeo/psalm#5221

AAllport avatar Feb 14 '21 19:02 AAllport

->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?

brendt avatar Feb 19 '21 05:02 brendt

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 avatar Feb 19 '21 05:02 brendt

@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.

Gummibeer avatar Feb 19 '21 08:02 Gummibeer

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?

brendt avatar Feb 19 '21 10:02 brendt

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. 🤔

Gummibeer avatar Feb 19 '21 10:02 Gummibeer

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 :)

brendt avatar Feb 19 '21 10:02 brendt