Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jan 8, 2020. It is now read-only.

added missing return $this to setValue method.#7114

Closed
matwright wants to merge 5 commits into
zendframework:masterfrom
matwright:master
Closed

added missing return $this to setValue method.#7114
matwright wants to merge 5 commits into
zendframework:masterfrom
matwright:master

Conversation

@matwright
Copy link
Copy Markdown
Contributor

added return $this to the setValue method to implement fluid interface like other setters in this class.

added return $this to the setValue method to implement fluid interface like other setters in this class.
@Ocramius
Copy link
Copy Markdown
Member

Ocramius commented Jan 9, 2015

Requires a test case to prevent regressions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Docblock of the method should also be modified

@matwright
Copy link
Copy Markdown
Contributor Author

ok, will do that shortly.

@matwright
Copy link
Copy Markdown
Contributor Author

DocBlock has been updated. For the regression test, as this method had no previous return value I'm not sure what to test exactly. This update cannot impact existing functionality and all current test cases are passing.

@Ocramius
Copy link
Copy Markdown
Member

Ocramius commented Jan 9, 2015

@matwright the test should simply assert that the return value is the same of the object the method is called upon

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@return self imo for consistency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@samsonasik The other setters in this class use @return DateSelect
would you like me to update this and the other setter docblocks to show return self ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

change only for this method i think because it is new introduced docblock. there is inconsistencies about it in other files too. i created PR in the past but can't finish to update all.

@samsonasik
Copy link
Copy Markdown
Contributor

you can use :

$this->assertInstanceOf('Zend\Form\Element\DateSelect', $element->setValue('now'));

@Ocramius
Copy link
Copy Markdown
Member

Ocramius commented Jan 9, 2015

@samsonasik should be assertSame

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

setValue('hello world') must be end up with Exception because of this https://github.com/matwright/zf2/blob/master/library/Zend/Form/Element/DateSelect.php#L97-L101

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

thanks @samsonasik just updated that to a valid date string

@samsonasik
Copy link
Copy Markdown
Contributor

👍

@Ocramius Ocramius added this to the 2.3.4 milestone Jan 10, 2015
@Ocramius Ocramius self-assigned this Jan 10, 2015
Ocramius added a commit that referenced this pull request Jan 12, 2015
Ocramius added a commit that referenced this pull request Jan 12, 2015
@Ocramius Ocramius closed this in d76734a Jan 12, 2015
Ocramius added a commit that referenced this pull request Jan 12, 2015
@Ocramius
Copy link
Copy Markdown
Member

Merged, thanks @matwright and @samsonasik!

master: d76734a
develop: 4567312

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants