ScopedCallback is a PHP library that allows for running a function after the instance goes out of scope. It can be useful for making sure teardown or cleanup functions run even if exceptions are thrown. It also makes for a cleaner API for developers, by not requiring the callback to be called manually each time.

ScopedCallback was created in 2012 for use by the Wikimedia-Rdbms library and its DBConnRef concept.

Code stewardship

This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.