Releases: alwaysblank/brief
3.0.1
3.0.0
- Add ArrayAccess
- Improve some internals
- Bump allowed PHP version
Version 2
A refactoring of the internals to make things a bit cleaner, and some external improvements as well.
Big change is this release:
Properties that don't exist now return null
, not false
!
This has been changed to better reflect that
- They don't exist (which is...what null means)
- Sometimes the value you want is
false
Given PHP's weak typing you may not need to update previous code that uses the earlier version, but it never hurts to be careful.
Fix dynamic key bug
This fixes a fairly serious bug where the following would happens:
$b = Brief::make([]);
$b->some_key = "some value";
echo $b->some_key; // "some value"
echo $b->literally_any_key_not_already_set; // "some value" <-- uh oh
This was the result of bad handling of collapsing alias chains on new dynamic keys. It had no effect on Briefs that were instantiated w/ a full array and didn't dynamically set keys, but for ones that did the result was clearly not desirable.
Additionally this release includes some formatting updates to the code that have no effect on functionality or behavior.
Alpha Release for 2.0
This should be usable, but I'm not doing a formal release before I've had an opportunity to test it a bit in semi-real-world situations.
Add `find` method
The find
method opens up some interesting possibilities when dealing with keyed arrays. It is called like so:
$Brief = new Brief(['key2' => 'value']);
echo $Brief->find('key1', 'key2');
// value
It receives an array of keys, and will return the value for the first key it can match, going from left to right. With a little work, this can allow you to do things like alias keys (i.e. item
=> itemprop
) or set defaults by extending the Brief
class, or creating "base" Brief
instances and then copying and modifying them.
Initial Release
1.0.0 feat(construction): allow passing of null/bool values