Skip to content
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

Replace IteratorAggregate with Aggregate in ArrayInterface #269

Open
boesing opened this issue Oct 22, 2024 · 0 comments
Open

Replace IteratorAggregate with Aggregate in ArrayInterface #269

boesing opened this issue Oct 22, 2024 · 0 comments
Labels
bc break enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@boesing
Copy link
Owner

boesing commented Oct 22, 2024

Since there are internal PHP issues with native arrays regarding array key types (https://3v4l.org/Y2ld5), I was testing a bit and found out that we could work around this issue when we are actually refactoring the Array implementation to:

  1. provide Iterator implementation (which then can provide proper types rather than exposing ArrayIterator)
  2. we can also refactor Map implementation to persist keys and values in dedicated lists while having indexes pointing to the according value

The whole Map implementation should actually get refactored to avoid using array_* functions in most scenarios (esp. when it comes to array keys).

The return type of MapInterface#toNativeArray should also always have array-key, no matter of what the generic says. There is simply no guarantee that the array key is string and thus this is the best way to properly expose the weird PHP internal behavior which won't change too soon I guess.

I have some ideas but I might not work on this too soon, just want to dump my current thoughts.

@boesing boesing added enhancement New feature or request help wanted Extra attention is needed bc break labels Oct 22, 2024
@boesing boesing added this to the 2.0.0 milestone Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bc break enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant