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

Breadcrumb

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

function Stub::__sleep

@internal

File

vendor/symfony/var-dumper/Cloner/Stub.php, line 50

Class

Stub
Represents the main properties of a PHP variable.

Namespace

Symfony\Component\VarDumper\Cloner

Code

public function __sleep() : array {
    $properties = [];
    if (!isset(self::$defaultProperties[$c = static::class])) {
        $reflection = new \ReflectionClass($c);
        self::$defaultProperties[$c] = [];
        foreach ($reflection->getProperties() as $p) {
            if ($p->isStatic()) {
                continue;
            }
            self::$defaultProperties[$c][$p->name] = $p->hasDefaultValue() ? $p->getDefaultValue() : ($p->hasType() ? NoDefault::NoDefault : null);
        }
    }
    foreach (self::$defaultProperties[$c] as $k => $v) {
        if (NoDefault::NoDefault === $v || $this->{$k} !== $v) {
            $properties[] = $k;
        }
    }
    return $properties;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal