eclipse-pdt / pdt

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

Missing error on enum instantiation #213

Open the-liquid-metal opened 1 year ago

the-liquid-metal commented 1 year ago

Bug Description Missing error on enum instantiation.

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;

enum Test38: string {
    case Hearts = 'H';
    case Diamonds = 'D';
    case Clubs = 'C';
    case Spades = 'S';
    public static function newInstanceWithStatic() {
        return new static; // this statement must trigger error
    }
    public static function newInstanceWithSelf() {
        return new self;   // this statement must trigger error
    }
}

$test38a = new Test38; // this statement must trigger error
$test38b = Test38::newInstanceWithStatic(); // OK
$test38c = Test38::newInstanceWithSelf();   // OK

var_dump($test38a, $test38b, $test38c);