Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Modernize the README for v4 #304

Merged
merged 2 commits into from
Mar 25, 2022
Merged

Modernize the README for v4 #304

merged 2 commits into from
Mar 25, 2022

Conversation

lexidor
Copy link
Contributor

@lexidor lexidor commented Dec 20, 2021

Fixes #287

@@ -67,6 +67,19 @@ foreach ($items as $item) {

In the code, `<ul />` creates a ul with no children. Then we dynamically append children to it for each item in the `$items` list.

Alternatively, you can pass an array of children to `<ul>...</ul>` instead. This is especially useful when dealing with larger xhp trees where it would be harder to get a variable reference to the `ul`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Alternatively, you can pass an array of children to `<ul>...</ul>` instead. This is especially useful when dealing with larger xhp trees where it would be harder to get a variable reference to the `ul`.
Alternatively, you can pass a `vec` of children to `<ul>...</ul>` instead. This is especially useful when dealing with larger xhp trees where it would be harder to get a variable reference to the `ul`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intentionally used the word array here. Xhp-lib can handle all Hack arrays in hhvm 4.103+ and all legacy arrays in hhvm 4.102-. AnyArray implements XhpChild.

https://github.com/facebook/hhvm/blob/master/hphp/hack/hhi/hackarray.hhi#L19

abstract class AnyArray<<<__RequireDynamic>> +Tk as arraykey, <<__RequireDynamic>> +Tv>
implements KeyedContainer<Tk, Tv>, \XHPChild {}

@fredemmott fredemmott merged commit 995c2c3 into hhvm:main Mar 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update README to reflect xhp-4
4 participants