Skip to content

Conversation

@mspirkov
Copy link
Contributor

Problem

In https://github.com/yiisoft/yii2-apidoc, we want to handle all possible PHPStan/Psalm types. Currently, this is quite difficult to do, as some types are replaced with Mixed_.

Solution

I propose storing the original TypeNode in Mixed_ so that the type can be restored later.

@jaapio
Copy link
Member

jaapio commented Nov 18, 2025

I do not want to expose the internal used parser nodes as they are hard to work with.
I think we should add the missing types to cover these use-cases.

@mspirkov
Copy link
Contributor Author

Okay, I'll get on it.

@mspirkov mspirkov marked this pull request as draft November 18, 2025 11:35
@jaapio
Copy link
Member

jaapio commented Nov 18, 2025

Tnx, you might want to have a look at how the other pseudo types are implemented. Maybe we need to remove the final keyword from the mixed type.

@mspirkov mspirkov changed the title Add the TypeNode property to Mixed_ Add support for conditional types, offset access type and key-of, value-of, int-mask, int-mask-of Nov 18, 2025
@mspirkov mspirkov changed the title Add support for conditional types, offset access type and key-of, value-of, int-mask, int-mask-of Add support for conditional types, offset access types and key-of, value-of, int-mask, int-mask-of Nov 18, 2025
@mspirkov
Copy link
Contributor Author

Done. Please take a look

@mspirkov mspirkov marked this pull request as ready for review November 18, 2025 14:19
@mspirkov
Copy link
Contributor Author

By the way, it's very inconvenient to fix the code style, because Codesniffer is not installed in the repository itself. It's very difficult to understand where the error occurred.

@jaapio
Copy link
Member

jaapio commented Nov 18, 2025

Can you make sure your new types do extend the Mixed_ type, so we do not have a breaking change because of the changed return type.

For the rests this is very nice. Thanks a lot!

@mspirkov
Copy link
Contributor Author

Done. The types key-of, value-of, int-mask, and int-mask-of caused exceptions to be thrown, so I don't use Mixed_ there.

Copy link
Member

@jaapio jaapio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few suggestions to make the implementation complete. After that we can merge this an tag a new release.

Thanks for all your efforts!

@mspirkov
Copy link
Contributor Author

Done. Thank you for your quick response.

@mspirkov mspirkov requested a review from jaapio November 19, 2025 04:55
@mspirkov
Copy link
Contributor Author

I want to add another feature. Can we merge it so we don't have to deal with merge conflicts later?
It seems that a release could be made after adding another feature.

@jaapio jaapio merged commit 696c4b1 into phpDocumentor:1.x Nov 19, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants