stable
Clone or download
request #10358: Plugins hooks should not rely on associative arrays
Current usage of events in Tuleap presents some drawbacks: * Developers must carefully read the Event::XXX docblock to know what exist as parameters (when docblock exists and when docblock is still accurate), * Plugins can sometimes erase data in the array parameters (data given by the core, or data given by previous listeners), * Need to add variables' docblock to know that $params['group'] is of type Project, * Lack of navigability unless you add @see Event::XXX docblocks everywhere, * ... The proposal is to send to listeners a real object as event: * First class collection instead of associative array * Explicit method names instead of inaccurate docblock * Logic for managing "output" data is left to the event object, not the listener * Type hinting and meaningful @return instead of wild guess * Better navigability Change-Id: I32045170c74e1d52c4fbfd527ae70582869be6d5
Modified Files
Name | ||||
---|---|---|---|---|
M | plugins/docman/include/docmanPlugin.class.php | +9 | −5 | Go to diff View file |
M | plugins/tracker/include/trackerPlugin.class.php | +10 | −6 | Go to diff View file |
M | src/common/autoload.php | +3 | −2 | Go to diff View file |
M | src/common/event/Event.class.php | +0 | −11 | Go to diff View file |
M | src/common/event/EventManager.class.php | +29 | −7 | Go to diff View file |
M | src/common/plugin/PluginProxy.php | +11 | −4 | Go to diff View file |
A | src/common/widget/Event/GetPublicAreas.php | +68 | −0 | Go to diff View file |
M | src/common/widget/Widget_ProjectPublicAreas.class.php | +5 | −9 | Go to diff View file |
M | tests/simpletest/common/event/EventManagerTest.php | +17 | −0 | Go to diff View file |