pdt
pdt copied to clipboard
Missing error on instantiation with unreachable constructor
Bug Description Missing error on instantiation with unreachable constructor.
Eclipse environment Version: 2023-06 (4.28.0) Build id: 20230608-1333 PDT: 8.0.0.202306050832
System
- PHP Version: 8.2.7, 8.1.20, 8.0.29, 7.4.33 (via https://onlinephp.io/)
To Reproduce Steps to reproduce the behavior: copy-paste this script to the IDE
<?php
declare(strict_types=1);
namespace ns1\ns2;
class Test03
{
public static function create(int $par1, int $par2): self {
return new self($par1, $par2);
}
private function __construct(
public int $prop1,
public int $prop2,
){}
}
class Test03b
{
public static function create(int $par1, int $par2): self {
return new self($par1, $par2);
}
protected function __construct(
public int $prop1,
public int $prop2,
){}
}
trait Test03c
{
public static function create(int $par1, int $par2): self {
return new self($par1, $par2);
}
private function __construct(
public int $prop1,
public int $prop2,
){}
}
class Test03d {
use Test03c;
}
trait Test03e
{
public static function create(int $par1, int $par2): self {
return new self($par1, $par2);
}
protected function __construct(
public int $prop1,
public int $prop2,
){}
}
class Test03f {
use Test03e;
}
$test3 = new Test03(10, 20); // this statement must trigger error
$test3b = new Test03b(10, 20); // this statement must trigger error
$test3d = new Test03d(10, 20); // this statement must trigger error
$test3f = new Test03f(10, 20); // this statement must trigger error
var_dump($test3, $test3b, $test3d, $test3f);