This repository has been archived by the owner on Jan 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
04cfa52
commit bf951a3
Showing
1 changed file
with
3 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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]`) | ||
|
@@ -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. |