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 accessing enum instance and static property #208

Open the-liquid-metal opened 1 year ago

the-liquid-metal commented 1 year ago

Bug Description Missing error on accessing enum instance and static property.

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 Test32 {
    case Hearts;
    case Diamonds;
    case Clubs;
    case Spades;
    public int $propInt;               // already correct error trigger
    public static float $staticString; // already correct error trigger

    // NOTE:
    // * $propFloat is instance dinamic property
    // * $propBool is static dinamic property.
    // in reality there is no static dinamic property.
    // $propBool is created to show that the IDE lack the error.

    public function setPropInt($intVal) {
        $this->propInt = $intVal;     // this statement must trigger error
    }
    public function setPropFloat($floatVal) {
        $this->propFloat = $floatVal; // this statement must trigger error
    }
    public function getPropInt() {
        return $this->propInt;        // this statement must trigger error
    }
    public function getPropFloat() {
        return $this->propFloat;      // this statement must trigger error
    }
    public static function setStaticString($stringVal) {
        static::$staticString = $stringVal; // this statement must trigger error
    }
    public static function setStaticBool($boolVal) {
        static::$staticBool = $boolVal;     // this statement must trigger error
    }
    public static function getStaticString() {
        return static::$staticString;       // this statement must trigger error
    }
    public static function getStaticBool() {
        return static::$staticBool;         // this statement must trigger error
    }
}

$test32 = Test32::Diamonds;

// these statements must trigger error
echo Test32::$staticString ."\n";
echo Test32::$staticBool ."\n";
Test32::$staticString = "hello";
Test32::$staticBool = true;

// these statements must trigger error
echo $test32->propInt ."\n";
echo $test32->propFloat ."\n";
$test32->propInt = 10;
$test32->propFloat = 20.34;