PHP: constant as variable in function
- by m4recek
I'm trying to use constant as a function paramter, is it possible to check type of this constant.
Example of what I want:
class ApiError {
const INVALID_REQUEST = 200;
}
class Response {
public function status(ApiError $status) {
//function code here
}
}
USE:
$response = new Response();
$response->status(ApiError::INVALID_REQUEST);
This shoud check that given $status is constant of class ApiError. Is something like this possible?