Tired of declaring after filters with the first parameter without doing anything?
DELETE IT :D, nothing will be broken.
Dispatcher now supports after filters with the only useful parameter.
Flight::after('myMethod', function (&$params, &$output) {
// $params Even if it is used it does not affect, but it had to be declared yes or yes even if it does nothing.
});
Now...
Flight::after('myMethod', function (&$output) {
// goodbye useless $params
});
IMPORTANT: both ways work exactly the same. Only one is shorter and cleaner.
To even make it even cleaner, you could change the filter to a PHP 7.4 arrow function.
Just make sure that what you do in the arrow function doesn't return false, unless you want to make other after filters for the same mapped method not run.
Tired of declaring after filters with the first parameter without doing anything?
DELETE IT :D, nothing will be broken.
Dispatcher now supports after filters with the only useful parameter.
Now...
To even make it even cleaner, you could change the filter to a PHP 7.4 arrow function.
Just make sure that what you do in the arrow function doesn't return
false
, unless you want to make other after filters for the same mapped method not run.