-
-
Notifications
You must be signed in to change notification settings - Fork 51
Add support for any array keys #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for any array keys #236
Conversation
|
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:
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. |
|
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. |
|
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? |
Moving this to v2 |
|
I will definitely check it out, but a little later: #180 |
|
Is there anything else that needs to be done here? |
|
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. |
|
OK, thank you! |
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.