Skip to content

Conversation

@bancer
Copy link
Collaborator

@bancer bancer commented Mar 8, 2017

No description provided.

protected function _setCurrentStep($step) {
if (!in_array($step, $this->steps)) {
return;
}
Copy link
Owner

Choose a reason for hiding this comment

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

I'm not a fan of checks like this. I mean I'd be concerned where they got the step from if it's an invalid choice, this is sort of an error you should never reach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I do not remember exactly why that was needed. I think that has something to do with internal workings of this component to prevent setting the future step that is not in $this->steps yet. An infinite loop happened without this check. Notice while (current($this->steps) != $step) below. The clients cannot call _setCurrentStep() directly as it is protected so there is no need to worry.

Copy link
Owner

Choose a reason for hiding this comment

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

That would be the exact reason to leave comments in the code. Otherwise I would take out the code rather than just hiding it under private.

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.

2 participants