Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Don't iterate if object is null #767

Merged
merged 2 commits into from
Jan 18, 2017
Merged

Don't iterate if object is null #767

merged 2 commits into from
Jan 18, 2017

Conversation

jaypatel512
Copy link
Contributor

foreach ($this->links as $link) {
if ($link->getRel() == $rel) {
return $link->getHref();
if ($this->links) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of just testing if this is a non-falsy value, can we add a test like if (is_array($this->links))?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Completed the changes.

Copy link
Contributor

@bluk bluk left a comment

Choose a reason for hiding this comment

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

👍

@jaypatel512 jaypatel512 merged commit c340969 into master Jan 18, 2017
@jaypatel512 jaypatel512 deleted the getlinks branch January 18, 2017 19:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants