pdt
pdt copied to clipboard
Missing error on LSP violation (mixed type case)
Bug Description Missing error on LSP violation (mixed type case).
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;
interface Test11 {
public function fn1(mixed $par1): int;
public function fn2(mixed $par1): int;
}
class Test11b implements Test11
{
public function fn1(int $par1): int {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// -------------------------------------------------------------------------
interface Test11c {
public function fn1(mixed $par1): int|float;
public function fn2(mixed $par1): int|float;
}
class Test11d implements Test11c
{
public function fn1(int|float $par1): int|float {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// -------------------------------------------------------------------------
interface Test11e {
public function fn1(mixed $par1): Test11b & Test11c;
public function fn2(mixed $par1): Test11b & Test11c;
}
class Test11f implements Test11e
{
public function fn1(Test11b & Test11c $par1): Test11b & Test11c {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// =========================================================================
class Test1g {
public function fn1(mixed $par1): int {}
public function fn2(mixed $par1): int {}
}
class Test11h extends Test1g
{
public function fn1(int $par1): int {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// -------------------------------------------------------------------------
class Test11i {
public function fn1(mixed $par1): int|float {}
public function fn2(mixed $par1): int|float {}
}
class Test11j extends Test11i
{
public function fn1(int|float $par1): int|float {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// -------------------------------------------------------------------------
class Test11k {
public function fn1(mixed $par1): Test11b & Test11c {}
public function fn2(mixed $par1): Test11b & Test11c {}
}
class Test11l extends Test11k
{
public function fn1(Test11b & Test11c $par1): Test11b & Test11c {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// =========================================================================
trait Test11m {
public function fn1(mixed $par1): int {}
public function fn2(mixed $par1): int {}
}
class Test11n {
use Test11m;
}
class Test11o extends Test11n
{
public function fn1(int $par1): int {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// -------------------------------------------------------------------------
trait Test11p {
public function fn1(mixed $par1): int|float {}
public function fn2(mixed $par1): int|float {}
}
class Test11q {
use Test11p;
}
class Test11r extends Test11q
{
public function fn1(int|float $par1): int|float {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}
// -------------------------------------------------------------------------
trait Test11s {
public function fn1(mixed $par1): Test11b & Test11c {}
public function fn2(mixed $par1): Test11b & Test11c {}
}
class Test11t {
use Test11s;
}
class Test11u extends Test11t
{
public function fn1(Test11b & Test11c $par1): Test11b & Test11c {} // this statement must trigger error
public function fn2(mixed $par1): mixed {} // this statement must trigger error
}