I want to overwrite a static method with a non static method. I'm getting this error:
Fatal error: Cannot make static method Person::say() non static in class Coder on line 22
I want to overwrite a classes parent static method makeCall()
with a more specific makeCall()
that would be non-static.
Code:
<?php
class Request {
public static function makeCall($url) {
// Do some cURL stuff...
}
}
class API extends Request {
const PRODUCTS = '/products';
private $api;
public function __construct($api) {
$this->api = $api;
}
public function getProducts() {
$this->makeCall(self::PRODUCTS);
}
public function makeCall($service) {
parent::makeCall($this->api . $service);
}
}
I could make the parent makeCall()
non-static, but I also want to be able to Request:makeCall()
in some places.