[feature/migrations] Fixing returns of callables and handling data state

Lots of comments and some other miscellaneous fixes.

PHPBB3-9737