Skip to content

Conversation

@mspirkov
Copy link
Contributor

Currently, valid types are causing exceptions. I suggest not validating array keys. Let PHPStan/Psalm handle this. I believe it should not be the responsibility of TypeResolver.

image

@jaapio
Copy link
Member

jaapio commented Nov 28, 2025

I get what you are trying to achieve here, but I think this would be a breaking change for people who rely on this behaviour. Rather than removing the validation I would suggest to introduce an interface which can be implemented by any type that is accepted as an array key. This way we can keep the validation, but also extend the supported types.

I think the following types should now be supported:

  • Int
  • String
  • ConstantExpression

I'm ok with removing this validation in V2 because you are right, it might not be the responsibility of this library to validate the types. That's a mistake that we made in the past.

With the amount of activity I see from your side now, I'm starting to think I might be good to work on v2. I never started it because there was to much other stuff I was working on. And this library didn't get that much of attention. A V2 version would allow us to implement generics correctly. And get rid of some old code that has been waiting for years to be improved. V2 doesn't need to be a full rewrite, but it would allow us to do some breaking changes. And fix some problems that cannot be resolved right now.

I'm not requesting you to do the work, but I would love to hear your opinion.

@mspirkov
Copy link
Contributor Author

Yes, I agree with you. This will indeed break backward compatibility. It would be great to have a fully functional and expandable version. So I'm in favor of releasing a second version.
If you need any help, I'm here to assist.

@jaapio
Copy link
Member

jaapio commented Nov 28, 2025

I already made a proposal for generics, I think it should be possible with too much work, as all the parsing is in place. We just have to think about a set of types for generics. You can read #180

Let's continue the discussion over there regarding generics I will create a V2 branch.

Do you want to continue with this pr with my proposal for an interface or are we moving this to v2?

@mspirkov
Copy link
Contributor Author

Do you want to continue with this pr with my proposal for an interface or are we moving this to v2?

Moving this to v2

@mspirkov
Copy link
Contributor Author

I will definitely check it out, but a little later: #180

@mspirkov mspirkov changed the base branch from 1.x to 2.x November 29, 2025 14:57
@mspirkov
Copy link
Contributor Author

Is there anything else that needs to be done here?

@jaapio
Copy link
Member

jaapio commented Nov 30, 2025

I didn't have a look at this after we decided to move to a V2 implementation.

I'm focusing on the generics first. Spend the morning trying some new ways to solve that problem.

I promise you that this will be merged, or when some rework is needed I will take care of this.

@mspirkov
Copy link
Contributor Author

OK, thank you!

@jaapio jaapio merged commit 034c3c2 into phpDocumentor:2.x Nov 30, 2025
29 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