To Reproduce
Steps to reproduce the behavior: copy-paste this script to the IDE
<?php
declare(strict_types=1);
namespace ns1\ns2;
class Test44 {
public int $prop1 = 10;
public function func1() {
echo $this->prop1."\n";
}
public static function staticFuncAccessingObjectProp() {
echo $this->prop1."\n"; // this statement must trigger error
}
public static function staticFuncAccessingObjectFunc() {
$this->func1(); // this statement must trigger error
}
}
Test44::staticFuncAccessingObjectProp();
Test44::staticFuncAccessingObjectFunc();
Bug Description Misleading warning on using $this when not in object context.
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