-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Remove underscore prefix in methods #14971
Conversation
/cc @phalcon/core-team |
We cannot do this now. It breaks backwards compatibility. If it was only private methods that would be fine but since it touches protected methods it will break applications that extend these classes and use those methods. We can put a @todo on this for v5 |
Is there any place where we can start collect things for v5? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make a small change here so that this can be merged safely without breaking BC.
Leave the underscore named methods where they are. Copy each of those methods to new ones without the underscore. From the one with the underscore, call the other one without. The underscore named methods become proxy ones. Add a @todo or @deprecated in the docblock of the underscore one so that we can remove those in v5.
This way we do what we need but also keep BC
@Jeckerson If you have time can you rebase and have look at the requested changes? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add the BC methods
Will try to add it during today. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to suggest to implement to logic in the methods that are going to be in v5.
Now we are getting extra unnecessary look ups groupResult()
calls _groupResult()
and it will be easier when cleaning up the deprecated methods.
I think this is going to break BC this way, because the logic is not quite right. For example, if someone had custom a namespace My;
class Model extends \Phalcon\Mvc\Model {
/**
* My custom _postSaveRelatedRecords implementation
*/
protected function _postSaveRelatedRecords(AdapterInterface $connection, $related): bool {
// This won't be ever called by Model
return parent::_postSaveRelatedRecords($connection, $related);
}
} Following this example, this solution only applies to those, who originally had namespace My;
class Model extends \Phalcon\Mvc\Model {
/**
* My custom function
*
* @throws Exception
* @throws Model\Exception
*/
public function doSomething(): void
{
// This will work, thanks to the proxy function
$this->_postSaveRelatedRecords(
$this->getWriteConnection(),
$this->dirtyRelated
);
}
} |
Hello!
In raising this pull request, I confirm the following:
Removed underscores in protected and extendable (not final) methods to be PSR-12 compliant.
Thanks