@@ -1465,7 +1465,7 @@ private static function hasGetClassCheck(
1465
1465
&& strtolower ($ conditional ->right ->name ->name ) === 'class ' ;
1466
1466
1467
1467
$ right_variable_class_const = $ conditional ->right instanceof PhpParser \Node \Expr \ClassConstFetch
1468
- && $ conditional ->right ->class instanceof PhpParser \Node \Expr \Variable
1468
+ && ! $ conditional ->right ->class instanceof PhpParser \Node \Name
1469
1469
&& $ conditional ->right ->name instanceof PhpParser \Node \Identifier
1470
1470
&& strtolower ($ conditional ->right ->name ->name ) === 'class ' ;
1471
1471
@@ -1474,15 +1474,22 @@ private static function hasGetClassCheck(
1474
1474
&& $ conditional ->left ->name instanceof PhpParser \Node \Identifier
1475
1475
&& strtolower ($ conditional ->left ->name ->name ) === 'class ' ;
1476
1476
1477
- $ left_type = $ source ->node_data ->getType ($ conditional ->left );
1477
+ $ left_variable_class_const = $ conditional ->left instanceof PhpParser \Node \Expr \ClassConstFetch
1478
+ && !$ conditional ->left ->class instanceof PhpParser \Node \Name
1479
+ && $ conditional ->left ->name instanceof PhpParser \Node \Identifier
1480
+ && strtolower ($ conditional ->left ->name ->name ) === 'class ' ;
1478
1481
1479
1482
$ left_class_string_t = false ;
1480
1483
1481
- if ($ left_type && $ left_type ->isSingle ()) {
1482
- foreach ($ left_type ->getAtomicTypes () as $ type_part ) {
1483
- if ($ type_part instanceof TClassString) {
1484
- $ left_class_string_t = true ;
1485
- break ;
1484
+ if (!$ left_variable_class_const ) {
1485
+ $ left_type = $ source ->node_data ->getType ($ conditional ->left );
1486
+
1487
+ if ($ left_type && $ left_type ->isSingle ()) {
1488
+ foreach ($ left_type ->getAtomicTypes () as $ type_part ) {
1489
+ if ($ type_part instanceof TClassString) {
1490
+ $ left_class_string_t = true ;
1491
+ break ;
1492
+ }
1486
1493
}
1487
1494
}
1488
1495
}
@@ -1503,29 +1510,26 @@ private static function hasGetClassCheck(
1503
1510
&& $ conditional ->left ->name instanceof PhpParser \Node \Identifier
1504
1511
&& strtolower ($ conditional ->left ->name ->name ) === 'class ' ;
1505
1512
1506
- $ left_variable_class_const = $ conditional ->left instanceof PhpParser \Node \Expr \ClassConstFetch
1507
- && $ conditional ->left ->class instanceof PhpParser \Node \Expr \Variable
1508
- && $ conditional ->left ->name instanceof PhpParser \Node \Identifier
1509
- && strtolower ($ conditional ->left ->name ->name ) === 'class ' ;
1510
-
1511
1513
$ right_class_string = $ conditional ->right instanceof PhpParser \Node \Expr \ClassConstFetch
1512
1514
&& $ conditional ->right ->class instanceof PhpParser \Node \Name
1513
1515
&& $ conditional ->right ->name instanceof PhpParser \Node \Identifier
1514
1516
&& strtolower ($ conditional ->right ->name ->name ) === 'class ' ;
1515
1517
1516
- $ right_type = $ source ->node_data ->getType ($ conditional ->right );
1517
-
1518
1518
$ right_class_string_t = false ;
1519
1519
1520
- if ($ right_type && $ right_type ->isSingle ()) {
1521
- foreach ($ right_type ->getAtomicTypes () as $ type_part ) {
1522
- if ($ type_part instanceof TClassString) {
1523
- $ right_class_string_t = true ;
1524
- break ;
1520
+ if (!$ right_variable_class_const ) {
1521
+ $ right_type = $ source ->node_data ->getType ($ conditional ->right );
1522
+
1523
+ if ($ right_type && $ right_type ->isSingle ()) {
1524
+ foreach ($ right_type ->getAtomicTypes () as $ type_part ) {
1525
+ if ($ type_part instanceof TClassString) {
1526
+ $ right_class_string_t = true ;
1527
+ break ;
1528
+ }
1525
1529
}
1526
1530
}
1527
1531
}
1528
-
1532
+
1529
1533
if (($ left_get_class || $ left_static_class || $ left_variable_class_const )
1530
1534
&& ($ right_class_string || $ right_class_string_t )
1531
1535
) {
0 commit comments