Page MenuHomePhabricator Docs: Remove unnecessary assign-by-reference in Hook definitions
Open, Needs TriagePublic


The hook documentation pages on each contain an infobox which gives an example function definition for the hook.

I've noticed that a lot of the function signatures specify arguments that should be passed by reference, for example:

It feels that in a lot of cases this by-reference designation is unnecessary, as the argument is an object; objects are always passed by reference in PHP5. I suspect this is a hold-over from when MediaWiki supported PHP4, where the & was necessary to ensure a reference was passed, rather than a copy of the object.

The documentation should be updated to contain the correct function signatures for modern PHP. This will also help make it clearer which properties are actually intended for modification by the callback.

This will require some familiarity with the hooks in question, so probably requires developer input.

Event Timeline

HappyDog created this task.Mar 10 2018, 9:53 PM
Restricted Application added a project: Documentation. · View Herald TranscriptMar 10 2018, 9:53 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
HappyDog updated the task description. (Show Details)Mar 10 2018, 9:53 PM
HappyDog updated the task description. (Show Details)