Skip to content

Conversation

@kakserpom
Copy link
Contributor

Description

I've added the same FromZval/IntoZval conversions for BTreeMap that exist for HashMap.

I know a doc update wouldn't hurt, but I am too preoccupied with development atm.

@coveralls
Copy link

coveralls commented Jul 20, 2025

Pull Request Test Coverage Report for Build 16812403437

Details

  • 33 of 57 (57.89%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.5%) to 27.673%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/types/array/conversions/btree_map.rs 25 27 92.59%
src/types/array/conversions/hash_map.rs 0 3 0.0%
src/types/array/array_key.rs 6 10 60.0%
src/types/array/mod.rs 2 17 11.76%
Totals Coverage Status
Change from base Build 16812389301: 0.5%
Covered Lines: 1149
Relevant Lines: 4152

💛 - Coveralls

Copy link
Member

@ptondereau ptondereau left a comment

Choose a reason for hiding this comment

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

LGTM but would it be possible to have some tests?

@Xenira
Copy link
Member

Xenira commented Jul 20, 2025

Also could you elaborate on this? #520 (comment)

@kakserpom kakserpom force-pushed the array_btreemap_conversion_2 branch 2 times, most recently from bd65d8a to 08bfe39 Compare July 20, 2025 19:03
@kakserpom
Copy link
Contributor Author

@Xenira

Also could you elaborate on this? #520 (comment)

I've implemented your suggestion. I've also fixed the cause of clippy::implicit_hasher warning in hash_map by generalizing the hasher.

@kakserpom
Copy link
Contributor Author

LGTM but would it be possible to have some tests?

What's there to test? Rustc does the job pretty well :)

@kakserpom kakserpom changed the title feat(array): BTreeMap conversion feat(array): introducing BTreeMap conversion and refactoring HashMap conversion Jul 20, 2025
@ptondereau
Copy link
Member

LGTM but would it be possible to have some tests?

What's there to test? Rustc does the job pretty well :)

Just ensuring the conversion if it makes sense

@kakserpom kakserpom force-pushed the array_btreemap_conversion_2 branch 2 times, most recently from 68d9d9c to eb2b2d1 Compare July 21, 2025 21:35
@kakserpom
Copy link
Contributor Author

I've changed the behavior of impl TryFrom<ArrayKey<'_>> for String. Now it converts numeric keys into strings, instead of giving an error.

@kakserpom kakserpom force-pushed the array_btreemap_conversion_2 branch 3 times, most recently from ccce30c to ad0dfa8 Compare July 22, 2025 00:38
@kakserpom
Copy link
Contributor Author

And also I've moved the code that treats numeric string keys as long, now it happens in ArrayKey conversion impls. So no more boilerplate in impl ZendHashTable.

@kakserpom kakserpom force-pushed the array_btreemap_conversion_2 branch from ad0dfa8 to 6c83ceb Compare July 22, 2025 00:41
Xenira added a commit to kakserpom/ext-php-rs that referenced this pull request Aug 7, 2025
Xenira added a commit to kakserpom/ext-php-rs that referenced this pull request Aug 7, 2025
@Xenira
Copy link
Member

Xenira commented Aug 7, 2025

I've changed the behavior of impl TryFrom<ArrayKey<'_>> for String. Now it converts numeric keys into strings, instead of giving an error.

You are probably right. This would indeed be the desired behaviour for TryFrom.

And also I've moved the code that treats numeric string keys as long, now it happens in ArrayKey conversion impls. So no more boilerplate in impl ZendHashTable.

This has some implications on types and I don't like how much we implicitly convert string and int values. But that is an issue for later.

@Xenira Xenira force-pushed the array_btreemap_conversion_2 branch from d7774ce to aec7bfb Compare August 7, 2025 18:14
@Xenira Xenira merged commit 54e9328 into extphprs:master Aug 7, 2025
55 checks passed
@davidcole1340 davidcole1340 mentioned this pull request Aug 7, 2025
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.

4 participants