move PhpParser/Evaluation classes in a specific namespave + composer dumpautoload

This commit is contained in:
odain
2025-09-02 19:19:56 +02:00
parent 1962cd7a88
commit ac2b787e09
33 changed files with 92 additions and 42 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace Combodo\iTop\PhpParser\Evaluation;;
use PhpParser\Node\Expr;
use PhpParser\Node\Expr\StaticPropertyFetch;
class StaticPropertyFetchEvaluator implements iExprEvaluator {
public function GetHandledExpressionType(): string {
return StaticPropertyFetch::class;
}
public function Evaluate(Expr $oExpr): mixed {
/** @var StaticPropertyFetch $oExpr */
$sClassName = $oExpr->class->name;
$sProperty = $oExpr->name->name;
if (class_exists($sClassName)){
$class = new \ReflectionClass($sClassName);
if (array_key_exists($sProperty, $class->getStaticProperties())) {
$oReflectionProperty = $class->getProperty($sProperty);
if ($oReflectionProperty->isPublic()){
return $class->getStaticPropertyValue($sProperty);
}
}
}
return null;
}
}