Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Caster.php

function Caster::getClassProperties

1 call to Caster::getClassProperties()
Caster::castObject in vendor/symfony/var-dumper/Caster/Caster.php
Casts objects to arrays and adds the dynamic property prefix.

File

vendor/symfony/var-dumper/Caster/Caster.php, line 175

Class

Caster
Helper for filtering out properties in casters.

Namespace

Symfony\Component\VarDumper\Caster

Code

private static function getClassProperties(\ReflectionClass $class) : array {
    $classProperties = [];
    $className = $class->name;
    if ($parent = $class->getParentClass()) {
        $classProperties += self::$classProperties[$parent->name] ??= self::getClassProperties($parent);
    }
    foreach ($class->getProperties() as $p) {
        if ($p->isStatic()) {
            continue;
        }
        $classProperties[match (true) {    $p->isPublic() => $p->name,
            $p->isProtected() => self::PREFIX_PROTECTED . $p->name,
            default => "\x00" . $className . "\x00" . $p->name,
        
        }] = \PHP_VERSION_ID >= 80400 && $p->isVirtual() ? new VirtualStub($p) : new UninitializedStub($p);
    }
    return $classProperties;
}
RSS feed
Powered by Drupal