I want to be able to declare an abstract function in an parent class, with an unknown number of arguments:
abstract function doStuff(...);
and then define an implementation with a set of hinted arguments:
/**
* @param int $userID
* @param int $serviceproviderID
*/
static function doStuff($userID, $serviceproviderID) {}
The best approach I've got so far is this,
abstract function doStuff();
/**
* @param int $userID
* @param int $serviceproviderID
*/
static function doStuff() {
$args = func_get_args();
...
}
But every time the function is called, I get a bunch of 'missing argument' warnings because of the hints. Is there a better way?
Edit: The question's wrong, please don't waste your time answering. The following is what I was looking for, and it seems to work without warnings.
abstract class Parent {
abstract function doStuff();
}
/**
* @param type $arg1
* @param type $arg2
*/
class Child extends Parent {
function doStuff($arg1, $arg2) {
...
}
}