kphp
kphp copied to clipboard
KPHP allows calling methods on null instances
<?php
class Foo {
public function f() {
var_dump("OK");
}
}
function test() {
/** @var Foo */
$foo = null;
$foo->f();
}
test();
PHP:
Stack trace:
#0 example.php(15): test()
#1 {main}
...
KPHP:
string(2) "OK"
KPHP will produce a warning if we access an object via $this, but otherwise there will be no warnings or errors.