final private static function sortConstants(ReflectionClass $reflection): array
    {
        $constants = [];
        while ($reflection && __CLASS__ !== $reflection->getName()) {
            $scope = [];
            foreach ($reflection->getReflectionConstants() as $const) {
                if ($const->isPublic()) {
                    $scope[$const->getName()] = $const->getValue();
                }
            }
            $constants = $scope + $constants;
            $reflection = $reflection->getParentClass();
        }


        return $constants;
    }
final private static function sortConstants(ReflectionClass $reflection): array
    {
        $constants = [];
        while ($reflection && __CLASS__ !== $reflection->getName()) {
            $scope = [];
            foreach ($reflection->getReflectionConstants() as $const) {
                if ($const->isPublic()) {
                    $scope[$const->getName()] = $const->getValue();
                }
            }
            $constants = $scope + $constants;
            $reflection = $reflection->getParentClass();
        }


        return $constants;
    }
final private static function sortConstants ( ReflectionClass $ reflection ) : array { $ constants = [ ] ; while ( $ reflection && __CLASS__ !== $ reflection -> getName ( ) ) { $ scope = [ ] ; foreach ( $ reflection -> getReflectionConstants ( ) as $ const ) { if ( $ const -> isPublic ( ) ) { $ scope [ $ const -> getName ( ) ] = $ const -> getValue ( ) ; } } $ constants = $ scope + $ constants ; $ reflection = $ reflection -> getParentClass ( ) ; } return $ constants ; }
Sorts member constants

@param ReflectionClass $reflection The reflection instance

@return array
Sorts member constants