<?php
interface Log {
public function alert($message);
}
class EchoLog implements Log {
public function alert($message) {
echo $message;
}
}
class TestLog {
private Log $log;
public function __construct(Log $log) {
$this->log = $log;
}
public function run() {
$this->log->alert('This is a alert');
}
}
$testLog = new TestLog(new EchoLog());
$testLog->run();
Parse error: syntax error, unexpected 'Log' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/2o3vJ on line 14
Process exited with code 255.
Output for 5.4.0 - 5.4.34
Parse error: syntax error, unexpected 'Log' (T_STRING), expecting variable (T_VARIABLE) in /in/2o3vJ on line 14
Process exited with code 255.