src/Traits/ReflectionClassLikeTrait.php
private function collectSelfConstants()
    {
        $expressionSolver = new NodeExpressionResolver($this);
        $localConstants   = [];

        // constants can be only top-level nodes in the class, so we can scan them directly
        foreach ($this->classLikeNode->stmts as $classLevelNode) {
            if ($classLevelNode instanceof ClassConst) {
                $nodeConstants = $classLevelNode->consts;
                if (!empty($nodeConstants)) {
                    foreach ($nodeConstants as $nodeConstant) {
                        $expressionSolver->process($nodeConstant->value);
                        $localConstants[$nodeConstant->name->toString()] = $expressionSolver->getValue();
                        $this->constants = $localConstants + $this->constants;
                    }
                }
            }
        }
    }
private function collectSelfConstants()
    {
        $expressionSolver = new NodeExpressionResolver($this);
        $localConstants   = [];

        // constants can be only top-level nodes in the class, so we can scan them directly
        foreach ($this->classLikeNode->stmts as $classLevelNode) {
            if ($classLevelNode instanceof ClassConst) {
                $nodeConstants = $classLevelNode->consts;
                if (!empty($nodeConstants)) {
                    foreach ($nodeConstants as $nodeConstant) {
                        $expressionSolver->process($nodeConstant->value);
                        $localConstants[$nodeConstant->name->toString()] = $expressionSolver->getValue();
                        $this->constants = $localConstants + $this->constants;
                    }
                }
            }
        }
    }
private function collectSelfConstants ( ) { $ expressionSolver = new NodeExpressionResolver ( $ this ) ; $ localConstants = [ ] ; // constants can be only top-level nodes in the class, so we can scan them directly foreach ( $ this -> classLikeNode -> stmts as $ classLevelNode ) { if ( $ classLevelNode instanceof ClassConst ) { $ nodeConstants = $ classLevelNode -> consts ; if ( ! empty ( $ nodeConstants ) ) { foreach ( $ nodeConstants as $ nodeConstant ) { $ expressionSolver -> process ( $ nodeConstant -> value ) ; $ localConstants [ $ nodeConstant -> name -> toString ( ) ] = $ expressionSolver -> getValue ( ) ; $ this -> constants = $ localConstants + $ this -> constants ; } } } } }
Collects list of constants from the class itself
Collects list of constants from the class itself