Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some issues of lithium\util\Collection. #474

Merged
merged 3 commits into from May 23, 2012
Merged

Fix some issues of lithium\util\Collection. #474

merged 3 commits into from May 23, 2012

Conversation

jails
Copy link
Contributor

@jails jails commented May 23, 2012

Solving some bugs on unset() and changing the ArrayAccess::offsetExist() behavior. ArrayAccess::offsetExist() should indicate if an offset exists and imo it would work as array_key_exists(). ArrayAccess::offsetExist() is indeed a magic method called on isset() but imo it's an inconsistency in the PHP language.

$data = array(
'Hello',
Copy link
Member

Choose a reason for hiding this comment

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

I don't follow why you changed the test here. Wouldn't it be better to have both?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah a bug occurs when you try to unset the first element in a foreach but you're right, it's better to keep both test.

@jails
Copy link
Contributor Author

jails commented May 23, 2012

I refactored the tests to be more consistent with older tests

@@ -32,7 +32,7 @@
*
* $coll = new Collection(array('data' => array(0, 1, 2, 3, 4)));
*
* $coll->first(); // 1 (the first non-empty value)
Copy link
Member

Choose a reason for hiding this comment

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

Just to clarify, the change here points out a BC break in first()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well I just found that it works like that so i decide to update the docblock but it's not a direct consequence of this PR. The BC break must have happened in a previous PR.

nateabele added a commit that referenced this pull request May 23, 2012
Fix some issues of lithium\util\Collection.
@nateabele nateabele merged commit 08d94f4 into UnionOfRAD:data May 23, 2012
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.

None yet

2 participants