Dear all,
should we allow using PHP's assert [1] in MediaWiki code?
It would allow us to formulate and automatically verify conditions about code, while at the same time providing readable documentation of code for free.
Possible, exemplary use cases would be: - automatically verifyable documentation of code's intent - guarding against logic pitfalls like forgetting to set a variable in all branches of switches, if/else cascades - guarding against using uninitialized variables
What do you think?
Kind regards, Christian
P.S.: For typical MediaWiki use cases, PHP's assert is even faster than throwing exceptions behind 'if'-guards.
[1] http://php.net/manual/en/function.assert.php (Not to confuse with PHPUnit's functions for assertions, which solve a different problem.)