Skip to content
This repository has been archived by the owner on Jan 17, 2021. It is now read-only.

Commit

Permalink
README
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobconley committed Sep 19, 2019
1 parent 04cfa52 commit bf951a3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ For convenience, two methods are added to the global namespace -
A stream object can also be decoded directly if needed by using `(new toml\Decoder())->DecodeStream(...)`.


DictionaryAccess object
DictAccess object
-----

`dict<string,nonnull>` was chosen as the return type instead of `array` in light of the hhvm team's [previous stance on the matter](https://hhvm.com/blog/10649/improving-arrays-in-hack) and the fact that, since they broke PHP backwards compatibility, they likely won't continue to support a loose-typed array.

This also makes sense for security as TOML is largely designed to be a configuration format and the developer using this package should know at all times what the keys and data types are that they're reading.

For type safety and convenience, the `DictionaryAccess` object is provided. It wraps around the `dict<string, nonnull>` object, providing the following methods:
For type safety and convenience, the `DictAccess` object is provided. It wraps around the `dict<string, nonnull>` object, providing the following methods:

- `->exists(string $key) : bool` - Returns true if the given key has a value
- `->get(string $key) : nonnull` - Accesses the wrapped dictionary straight-up; equivalent to using the array access operator (`[$name]`)
Expand Down Expand Up @@ -58,4 +58,4 @@ I wrote this on a whim after discovering TOML and realizing Hack didn't have one

I also of course want to make a serializer for this project as well.

If you're interested in this project, feel free to reach out to me at [email protected] or just fork & pull request.
If you're interested in this project, feel free to reach out to me at [email protected] or just fork & pull request.

0 comments on commit bf951a3

Please sign in to comment.