<?php
interface Log {
public function alert($message);
}
class EchoLog implements Log {
public function alert($message) {
echo $message;
}
}
class TestLog {
private $log;
const TEST = ['hoi'];
public function __construct(Log $log) {
$this->log = $log;
}
public function run() {
$this->log->alert($this->TEST[0]);
}
}
$testLog = new TestLog(new EchoLog());
$testLog->run();
Warning: Undefined property: TestLog::$TEST in /in/CBONk on line 23
Warning: Trying to access array offset on value of type null in /in/CBONk on line 23
Output for 7.4.0 - 7.4.33
Notice: Undefined property: TestLog::$TEST in /in/CBONk on line 23
Notice: Trying to access array offset on value of type null in /in/CBONk on line 23