To Reproduce
Steps to reproduce the behavior: copy-paste this script to the IDE
<?php
declare(strict_types=1);
namespace ns1\ns2;
enum Test39: int {
case Hearts = 1;
case Diamonds = 2;
case Clubs = 3;
case Spades = 4;
}
var_dump(Test39::Hearts == Test39::Diamonds); // bool(false)
var_dump(Test39::Hearts === Test39::Diamonds); // bool(false)
var_dump(Test39::Hearts > Test39::Diamonds); // bool(false)
var_dump(Test39::Hearts < Test39::Diamonds); // bool(false)
$card1 = Test39::Hearts;
$card2 = Test39::Diamonds;
$mixed = 10;
// common construct, $card1 & $card2 can be any asignment of enum case
if ($card1 == $card2) {} // OK
if ($card1 === $card2) {} // OK
if ($card1->value == $card2->value) {} // OK
if ($card1->value === $card2->value) {} // OK
if ($card1 > $card2) {} // this statement should trigger warning
if ($card1->value > $card2->value) {} // OK
// common construct, $mixed can be any value other than enum case
if ($card1 == $mixed) {} // this statement should trigger warning
if ($card1 === $mixed) {} // this statement should trigger warning
if ($card1->value == $mixed) {} // OK
if ($card1->value === $mixed) {} // OK
if ($card1 > $mixed) {} // this statement should trigger warning
if ($card1->value > $mixed) {} // OK
// rare construct, less relevant
if (Test39::Hearts == Test39::Diamonds) {} // this statement should trigger warning
if (Test39::Hearts === Test39::Diamonds) {} // this statement should trigger warning
if (Test39::Hearts > Test39::Diamonds) {} // this statement should trigger warning
if (Test39::Hearts->value > Test39::Diamonds->value) {} // OK
Bug Description Missing warning on comparing enum case.
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