phpDocumentor / ReflectionDocBlock

MIT License
9.34k stars 117 forks source link

Add new tags #373

Closed ahjdev closed 1 month ago

ahjdev commented 2 months ago

This is a beta pr for checking my code. I will add template tag for sure.

But what about psalm, phan, phpstan tags? Should I handle them too?

ahjdev commented 2 months ago

I also thinks I should open a pr for type resolver repository beacuse of this classes not handled:

ConditionalTypeNode
ConditionalTypeForParameterNode
OffsetAccessTypeNode
ObjectShapeNode
jaapio commented 2 months ago

Right now we do not focus on the prefixed tags used by psalm and phpstan. Integrations do have the option to add new tags and register a factory twice to handle tags. I don't thing we should support this out of the box. The tags are mend to use by these tools. And are not general purpose tags.

Regarding the extra types, it would be nice to support them. But I'm wondering if we should add them to the type resolver and how. As users of the type resolver will assume that they get clear types and apart from the objectshape they are all fuzzy. Maybe we should introduce them as PseudoType of Mixed? This would allow other libraries to get the information they need but if they do not support they could interpret it as mixed?

ahjdev commented 2 months ago

Well I add them to PseudoType of Mixed last night (In Type Resolver). As far I checked the psalm etc they have extra types e.g: key-of and value-of. I will add them too.

About prefixed tags, I was thinking at least add some important of them. (lots of them will be generics and no need to new classes)

ahjdev commented 1 month ago

This looks good, if you could have a look at the phpstan issue. (Missing return in the static factory) You can just return null.

And run make code-style to see the code style issues we can merge this right away.

Thank you very much for your help

Ok I will fix them tommorow

ahjdev commented 1 month ago

I guess I'm done except I did not found (Missing return in the static factory).

ahjdev commented 1 month ago

I fix these things but why for god sake there is not a script in composer.json for phpcs-fixer

jaapio commented 1 month ago

We are using php-code-sniffer, there is a target in the make file named "code-style" to run it.

For historical reasons this project didn't have dev dependencies. Especially when phpunit had a direct dependency this was problematic. We could never build on a new major version without a version issue on phpunit. I think it would be possible now to add php-code-sniffer as a normal dev dependency. If you want to do that, please do that in a separate pr.

jaapio commented 1 month ago

When I'm back I will merge this and add some more tests to cover this new behavior.

Thanks for your efforts