eclipse-pdt / pdt

PHP Development Tools project (PDT)
https://eclipse.org/pdt
Eclipse Public License 2.0
188 stars 46 forks source link

Missing error on intersection types with scalar type #186

Open the-liquid-metal opened 1 year ago

the-liquid-metal commented 1 year ago

Bug Description Missing error on intersection types with scalar type.

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

<?php
declare(strict_types=1);

namespace ns1\ns2;

interface Test10 {
    public function fn01(int & float $par1): int;  // this statement must trigger error
    public function fn02(int & bool $par1): int;   // this statement must trigger error
    public function fn03(int & array $par1): int;  // this statement must trigger error
    public function fn04(int & string $par1): int; // this statement must trigger error
    public function fn05(int & object $par1): int; // this statement must trigger error

    public function fn06(int $par1): int & float;  // this statement must trigger error
    public function fn07(int $par1): int & bool;   // this statement must trigger error
    public function fn08(int $par1): int & array;  // this statement must trigger error
    public function fn09(int $par1): int & string; // this statement must trigger error
    public function fn10(int $par1): int & object; // this statement must trigger error
}

class Test10b {
    public function fn1(int & float $par1): int {} // this statement must trigger error
    public function fn2(int $par1): int & float {} // this statement must trigger error
}

trait Test10c {
    public function fn1(int & float $par1): int {} // this statement must trigger error
    public function fn2(int $par1): int & float {} // this statement must trigger error
}