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

Skip to content

Conversation

ADmad
Copy link
Member

@ADmad ADmad commented Oct 29, 2019

@ADmad ADmad added this to the 4.0.0 milestone Oct 29, 2019
@ADmad
Copy link
Member Author

ADmad commented Oct 29, 2019

I wonder if making Table::save() return null instead of false would cause too much grief to those upgrading from 3.x. That would allow us to add return typehint and avoid explicit type checks.

Copy link
Member

@markstory markstory left a comment

Choose a reason for hiding this comment

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

I am wary of switching to null here. This is an important and frequently use method. The new exception could be a deprecation warning if we wanted to play it safe.

@ADmad
Copy link
Member Author

ADmad commented Oct 30, 2019

I am wary of switching to null here. This is an important and frequently use method.

Yup I was vary of that too, so didn't change the return type for save().

The new exception could be a deprecation warning if we wanted to play it safe.

I think we should keep the new exception. If the callback returns null/void then it's auto converted to false. Returning any other value type is just wrong and throwing an exception is the right thing to do.

@dereuromark
Copy link
Member

I noted down the nullable typehint part for the 5.x topics: https://github.com/cakephp/cakephp/wiki/5.x-Ideas
Until then I guess we can live with the status quo.

@markstory markstory merged commit cd62ed0 into 4.x Oct 30, 2019
@markstory markstory deleted the 4.x-table-save branch October 30, 2019 23:57
markstory added a commit to cakephp/docs that referenced this pull request Oct 31, 2019
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.

3 participants