To Reproduce
Steps to reproduce the behavior: copy-paste this script to the IDE
<?php
declare(strict_types=1);
namespace ns1\ns2;
// just a dummy
class Test52 {}
class StrictClass1 {
public function fnPublic() {}
protected function fnProtected() {}
private function fnPrivate() {}
public function test() {
$this->fnPublic(); // OK
$this->fnProtected(); // OK
$this->fnPrivate(); // OK
$this->fnUndefined(); // this statement must display error
}
}
class StrictClass2 extends StrictClass1 {
public function test() {
$this->fnPublic(); // OK
$this->fnProtected(); // OK
$this->fnPrivate(); // this statement must display error
$this->fnUndefined(); // this statement must display error
}
}
class LooseClass1 {
public function fnPublic() {}
protected function fnProtected() {}
private function fnPrivate() {}
public function __call($name, $args) {
$this->$name(...$args);
}
public function test() {
$this->fnPublic(); // OK
$this->fnProtected(); // OK
$this->fnPrivate(); // OK
$this->fnUndefined(); // OK
}
}
class LooseClass2 extends LooseClass1 {
public function test() {
$this->fnPublic(); // OK
$this->fnProtected(); // OK
$this->fnPrivate(); // OK
$this->fnUndefined(); // OK
}
}
$strict = new StrictClass1;
$strict->fnPublic(); // OK
$strict->fnProtected(); // this statement must display error
$strict->fnPrivate(); // this statement must display error
$strict->fnUndefined(); // this statement must display error
$loose = new LooseClass1;
$loose->fnPublic(); // OK
$loose->fnProtected(); // OK
$loose->fnPrivate(); // OK
$loose->fnUndefined(); // OK
function myFunc(StrictClass1 $strict, LooseClass1 $loose) {
$strict->fnPublic(); // OK
$strict->fnProtected(); // this statement must display error
$strict->fnPrivate(); // this statement must display error
$strict->fnUndefined(); // this statement must display error
$loose->fnPublic(); // OK
$loose->fnProtected(); // OK
$loose->fnPrivate(); // OK
$loose->fnUndefined(); // OK
}
$strict->test();
$loose->test();
myFunc($strict, $loose);
(new StrictClass2)->test();
(new LooseClass2)->test();
Bug Description Missing error on invoking undeclared/inaccessible instance method.
Eclipse environment Version: 2023-06 (4.28.0) Build id: 20230608-1333 PDT: 8.0.0.202306050832
System
To Reproduce Steps to reproduce the behavior: copy-paste this script to the IDE